content
content copied to clipboard
Prefetch query for all pages in home page
Is your feature request related to a problem? Please describe
I have a static website generated via nuxi build && nuxi generate
. When clicking a link via nuxt-link from home page, it takes some time to load the next page. This didn't use to happen in content v1. It was instantaneous. I saw nuxt performing some fetch query to load the page.
Describe the solution you'd like
Can we prefetch these queries for rest of the pages from home page?
<link rel="prefetch" href="/api/_content/query/601930371" />
Describe alternatives you've considered
Additional context
package.json
{
"private": true,
"version": "1.0",
"scripts": {
"dev": "MIX_APP_ENV=dev nuxi dev",
"staging": "MIX_APP_ENV=staging nuxi dev",
"build:dev": "MIX_APP_ENV=dev nuxi build",
"build:staging": "MIX_APP_ENV=staging nuxi build",
"build:prod": "MIX_APP_ENV=production nuxi build",
"generate": "nuxi generate",
"preview": "nuxi preview",
"start": "node .output/server/index.mjs"
},
"devDependencies": {
"@nuxt/content": "^2.0.0",
"nuxt": "npm:nuxt3@latest",
"sass": "^1.52.1"
},
"dependencies": {
"@fortawesome/fontawesome-pro": "^6.1.1",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-brands-svg-icons": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/pro-duotone-svg-icons": "^6.1.1",
"@fortawesome/pro-light-svg-icons": "^6.1.1",
"@fortawesome/vue-fontawesome": "3.0.0-5",
"@nuxt/kit": "npm:@nuxt/kit-edge@latest",
"@nuxtjs/sentry": "^5.1.7",
"@nuxtjs/sitemap": "^2.4.0",
"@popperjs/core": "^2.11.5",
"@sentry/tracing": "^7.0.0",
"@sentry/vue": "^7.0.0",
"autoprefixer": "10.4.5",
"axios": "^0.27.2",
"bootstrap": "5.2.0-beta1",
"dayjs": "^1.11.2",
"primevue": "^3.13.1"
},
"resolutions": {
"autoprefixer": "10.4.5",
"resolve": "1.20.0"
}
}
Smart pre-fetching is not yet implemented in Nuxt 3, that's why you can feel this loading time and it don't feel instantaneous. This is something should and will implement in Nuxt 3 and once it does, you can feel the same behavior as Content V1.
Keep eye on https://github.com/nuxt/nuxt.js/issues/13482 for implmentation
Thank you. Got it.