Replies: 10 comments 5 replies
-
One thing I've done is install the content repo as a git npm module and import the markdown from there! |
Beta Was this translation helpful? Give feedback.
-
Could it be possible to add an option in the astro function Something like |
Beta Was this translation helpful? Give feedback.
-
What I am looking for is way to install content from npm. So one would publish a content collection via npm and then use it multiple astro projects. Important part would be that one can use this content collection package additionally to any local content collections and possibly even use the remote content in ones own content collection entries. |
Beta Was this translation helpful? Give feedback.
-
my monorepo has this structure:
How can i make the things i dont want to do as they are yuck:
what I want: 🚀 // @zenobius/content/index.ts
export const documentDir = path.resolve(__dirname, 'documents') // @zenobius/app-web-with-astro/astro.config.ts
import { defineConfig } from 'astro/config';
import react from '@astrojs/react';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import markdoc from '@astrojs/markdoc';
import { documentDir } from '@zenobius/content'; 1️⃣ 🚀
export default defineConfig({
// Enable React to support React JSX components.
integrations: [react(), markdoc()],
compressHTML: false,
trailingSlash: 'never',
contentDir: documentDir, 2️⃣ 🚀
build: {
format: 'directory'
},
vite: {
ssr: {
noExternal: ['@astrojs/react']
},
plugins: [vanillaExtractPlugin()]
},
}); or ❤️ // @zenobius/app-web-with-astro/src/content/config.ts
import { defineCollection } from 'astro:content';
import { blogSchema, authorSchema } from '../schemas';
import { documentDir } from '@zenobius/content'; 1️⃣ ❤️
// 2. Define your collections
const blogCollection = defineCollection({
type: 'content',
source: path.resolve(documentDir, 'posts'), 2️⃣ ❤️
schema: blogSchema,
});
// 3. Export multiple collections to register them
export const collections = {
'blog': blogCollection,
}; I think perhaps ❤️ is more scalable and in line with opinions of the astro leadership. |
Beta Was this translation helpful? Give feedback.
-
We have tens of thousands of markdown content files that would overwhelm source tracking in our Astro repo, so what we're doing is using Git LFS to store a pointer to a compressed Then we have some script commands in our We have a separate repo and database for generating the content markdown files, so tracking individual line changes doesn't matter to us. |
Beta Was this translation helpful? Give feedback.
-
My use case for this: I'm working on a no-code github pages blog tool. I don't want users to have to open the src folder. It's scary for them. Also, I didn't see this blog post linked in this thread, but it has details for using symlinks for this: https://www.eliostruyf.com/symlink-content-astro-portability/ |
Beta Was this translation helpful? Give feedback.
-
This is a feature I'd like to see myself coming from nuxt / docus where you can do this, just to make things tidy. I tried relocating the src dir using the config but that fails to work if its located outside of the main astro directory |
Beta Was this translation helpful? Give feedback.
-
Its a very good idea |
Beta Was this translation helpful? Give feedback.
-
I am looking to do this with monorepo as well. Ideally to have multiple sites and have one package that has core UI components as well as shared content. |
Beta Was this translation helpful? Give feedback.
-
I made this package to have list of the files https://github.com/Its-Just-Nans/plugin-astro-content |
Beta Was this translation helpful? Give feedback.
-
In the current astro architecture (as far as I could research), the content/data (markdown etc.) is either put:
./src/pages/*
repository; traditional astro style./content
collections folder (https://docs.astro.build/en/guides/content-collections/); new astro RFCWhen using Gatsby, there is a feature I really enjoy, is to having to
content
folder, be external to the code folder of the project (theme); even having both in two different repositories.For example:
The effect of this setup, is that both at development time and build time, the
data
repository is cloned into the./content/*
folder of the (gatsby)theme
repository/project; which is used to generate all of the static pages of the site.I wonder, is there already a way to achieve this behavior with astro? Is this a feature that could be envisionned in the astro ecosystem.
One solution is to using
git submodule
(where the content repo is a submodule of the theme repo). This does not really work, as a submodule is "pinned" to a git reference commit ID, thus having to update to the latest commit, the submodule in the theme repository, each time the content/data repository is updated.The idea would be that the theme repository, could be triggered for a re-build, either with a cron job, or a CI-job triggered by an action in the data repository (to the theme repository) each time the data changes.
Beta Was this translation helpful? Give feedback.
All reactions