You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my blog, I have pages that require features from document-driven (ie. using navigation variable) and some pages that is not document-driven at all (ie. home page).
Since I have not created documents for pages that is not content-driven, I see a console error message saying that it was not able to find a document required for such pages. In other words, there is no markdown file for my home page (since I do not need it) but document-driven will still try to fetch page data for my home page from content folder, resulting in an error message.
If I'm not mistaken, enabling document-driven will make the application fetch page data from /api/_content for every initial page load. I think this page fetching happens in this plugin (/content/src/runtime/plugins/documentDriven.ts) by utilizing Nuxt hook content:document-driven:start, content:document-driven:finish and app:data:refresh to refresh page data on client side.
So the question is, is there a way to override this behavior, to avoid fetching page data for pages that do not require document-driven?
I was thinking, maybe making my own NuxtPlugin and somehow use Nuxt hooks to override the document-driven hooks could resolve this..
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In my blog, I have pages that require features from document-driven (ie. using
navigation
variable) and some pages that is not document-driven at all (ie. home page).Since I have not created documents for pages that is not content-driven, I see a console error message saying that it was not able to find a document required for such pages. In other words, there is no markdown file for my home page (since I do not need it) but document-driven will still try to fetch page data for my home page from
content
folder, resulting in an error message.If I'm not mistaken, enabling document-driven will make the application fetch page data from
/api/_content
for every initial page load. I think this page fetching happens in this plugin (/content/src/runtime/plugins/documentDriven.ts
) by utilizing Nuxt hookcontent:document-driven:start
,content:document-driven:finish
andapp:data:refresh
to refresh page data on client side.So the question is, is there a way to override this behavior, to avoid fetching page data for pages that do not require document-driven?
I was thinking, maybe making my own NuxtPlugin and somehow use Nuxt hooks to override the document-driven hooks could resolve this..
Beta Was this translation helpful? Give feedback.
All reactions