-2

I wonder how to convert only two pages in a Vue3 project to be rendered on the server-side to enhance their SEO. I also want to avoid migrating to Nuxt.js.

Thanks for your help in advance.

I tried using Node.js configs according to Vue3's documentation but it can only accept a stringified Vue root component.

https://staging-cf.vuejs.org/guide/scaling-up/ssr.html#ssr-vs-ssg

1
  • 1
    The question is too unspecific for SO. There's more than just Nuxt, it's unknown what's your setup but Vite SSR is less opinionated and works well with Vite, staging-cf.vuejs.org/guide/scaling-up/ssr.html#vite-ssr . You can't just import .vue sfc files in node server without a build tool because it's not valid JS Commented Dec 12, 2023 at 11:06

1 Answer 1

1

No, this is not possible with Vue3 alone

You'll either need a

Static site generator

This is not possible with only Vue3 - It's just not supposed to be a static site generator (such as VitePress, as suggested in your link).

or

Server side generated pages

You'll need something like what you already suggested - Nuxt.Js or similar. It features something called pre-rendered routes and a generate command. Similar to Nuxt2 exclude and running nuxt generate.

Nuxt will pre-render some routes while other will only be available through SSR.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.