Content as Data v2 #1286
thescientist13
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Overview
Coming out of #1167 / #1266, wanted to track a few thoughts / questions / outstanding items that I didn't have a good answer for at the time, and so wanted to carryover into a discussion for further refining / iteration.
Carryovers
Active Frontmatter
The current API for templating out frontmatter at build time is to use this convention of combining template literal syntax and
globalThis
.I suppose something more "traditional" might be something like handlebars, etc
Wondering if there is a better way to execute / expose this API? The main issue is that it has to rely on isomorphic APIs, and
fetch
is just that kind of API, in particular for prerendering scenarios at build time, where we spin up an instance of the dev server with just the content as data plugin configured.One thought was that at least for production builds, we could each inline query into a
<script>
tag into the HTML? This would avoid having to do afetch
if the data was desired on the client side as well even with a production build.We would have to be able to trace queries to pages, so as not to bloat the HTML for every page with every query. (which I think is what prevents us from completing #349)
"Noisy" Active Frontmatter
In cases where you would say want to serialize a collection into HTML is a little "noisy" due to all the properties of the graph being part of the out, with a lot items in your collection could potentially add a lot of extra content to the HTML
We are already pruning a lot of it, but maybe we could strip out the attribute? That would be bad though if someone was trying to hydrate off of it on the client side.
Naming (Graph)
I wonder if there is a case to rename
graph
topages
instead? A graph implies nodes, some sort of linking structure, etc which it is definitely not in its current state.While we're on naming, should our
compilation.context
directories have their names changed too,outputDir
->outputDirUrl
scratchDir
->scratchDirUrl
optimizedFileName
Standalone Plugin
Since I know we plan on moving Markdown to its own plugin, should this be standalone too? One consideration is that if user's don't like the "native" implementation, they could basically just never enable the
activeContent
flag and write their own plugin / resolvers / etc.Beta Was this translation helpful? Give feedback.
All reactions