-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exploring Mutate #84
base: main
Are you sure you want to change the base?
Exploring Mutate #84
Conversation
The refactor within this is looking super clean, nice carving! |
Could we stamp each collection or node with metadata which references the transformer used? That would limit you to one transformer per collection in terms of |
I suppose we could also allow mutations to pass config args specifying which transformer to use for |
I think the default would be to place it at the root-most common path which matches the wildcard. If the user wants their content to go to a specific path, then I agree they'd be required to use the named wildcard fields in their query. Ex. the user must specify the path: 'content/markdown/posts/[category]/[slug].md', |
based on your ideas I started moving metadata into _flatbread on collections. "_flatbread": {
"reference": "ab2c",
"referenceField": "id",
"collection": "Author",
"filename": "daes.md",
"path": "content/markdown/authors/daes.md",
"slug": "daes",
"sourcedBy": "@flatbread/source-filesystem",
"transformedBy": "@flatbread/transformer-markdown"
}
This is kind of what I was thinking too
Can you elaborate on this? not sure I understand |
for create what if we default to the first transformer provided and allow it to be overridden by a field on the content entry? and for updates use the same transformer that was used to read it? |
This sounds good to me |
If someone has: The default would be to add the new file to If we allow a
|
How do we create the slug? Does a slug make sense if it's not post / article data? I'm almost tempted to say we should remove the * functionality and require named variable paths for everything |
Yeah I was thinking about if we should remove the glob functionality as well. That would definitely simplify the moving pieces and force more organization. |
Maybe this should be part of the config, an optional But this will confuse people into thinking that the |
maybe we could add a config option to encapsulate content: [
{
path: '../../packages/flatbread/content/posts',
collection: 'Post',
refs: {
authors: 'Author',
},
onCreate: {
slugField: 'title',
},
},
], |
I'd like to keep the glob functionality, just not the wildcard matching. I was thinking if we only allowed paths like |
also, I've been adding code to make it easier to support using custom fields for Ids in the future, by using
|
Open questions
fixes #93
fixes #10