I am currently planning to develop a web application using NuxtJS/NextJS framework with SSR Universal architecture, I am facing difficulties related to SEO, because previously my project was written in .NET , so all URLs have .html
at the end..
Ex:
- domain.com/hotels (this is Cate)
- domain.com/hotels-5-star.html (this is a Sub cate of Hotels Cate)
The example above is specific to my problem, which means that according to Google, the shorter the URL, the better, so my pages have all been shortened to a single "/", however because of the structure page has 2 hierarchies, Cate and Sub cate, so for Google to distinguish this, the URL (sub cate) must insert .html
at the end.
Can I use NuxtJS/NextJS build pages with the same URL as above?, I have researched but found a specific solution, maybe my experience is not much so I need the help of experts on NuxtJS/NextJS
3
Answers
I’m not an expert in SEO, but I would just use
5-star
as a query indomain.com/hotels
This would mean you could use the single hierarchy like so:
domain.com/hotels?rating=5-stars
As far as using html files as URL routing for the site, the nuxt
generate
property builds the project into html files which is under your control. The structure comes from what you set in the pages directoryyeah, in
nuxtjs
, you can use@nuxtjs/router
to custom your router path like thisnuxt.config.js
router.js
pages/hotels.vue
Nowadays, all modern apps are having some pretty URLs looking like
domain.com/hotels/
With a trailing slash at the end. Don’t mix and match them. Either put them everywhere or nowhere.
SEO-wise, trailing slashes do not matter, you can let them.
Modern JS frameworks are doing a great job at this, and they know that if you reach
domain.com/hotels/
, you’re actually wanting to serve the.html
(aka the.vue
) file in it, no need to add it.In Nuxt.js, the directory structures would look like this:
or
As for this
Don’t stress it too much, you don’t need to make super shorts paths neither.
Just keep it semantic and logic. Having
domain.com/h5s
will be super bad.Also, having
domain.com/hotels/5-stars
ordomain.com/hotels/?rating=5
is totally fine.Basically, make them somehow readable for the end user.
PS: be aware that Next.js >> React and Nuxt.js >> VueJS.