Hello there ,
These days I play around with nuxt SSR full static and prismic.
I created a demo project, you can see the code here and check-out production at the link.
1. first problem
in my project I have two languages (English and German) and 3 different type of documents:
- unrepeatable type index document.
- repeatable type page document. ( about, blog, contact )
- unrepeatable type blog-post document.
my link.resolver looks like this
export default function (doc) {
if (doc.type === 'index') {
if (doc.lang === 'en-us') return '/'
else return `/${doc.lang}/`
} else if (doc.type === 'page') {
return `/${doc.lang}/${doc.uid}`
} else if (doc.type === 'blog-post') {
if (doc.lang === 'en-us') return `/post/${doc.uid}`
else return `/${doc.lang}/post/${doc.uid}`
}
}
As you can see I want to create my page structure where I will hide the language prefix if it is the main language ( en-us ) , however if i write the condition in the link.resolver for document type page I get error.I guess its the same problem that I found in the forum, however i struggle to implement the validation or perhaps I have a wrong page structure in the pages directory.
2. second problem
for some reason, none of my dynamic pages were generated by Nuxt.
Currently i implemented a hacky way where I render nuxt-links with all alternative languages of each document. I guess I need to use the route resolver but I do not have experience with it.