wearelucid / lucid-nuxt-2021

Nuxt.js Boilerplate
7 stars 0 forks source link

Issues with trailing slashes in urls #12

Open marcoeh opened 3 years ago

marcoeh commented 3 years ago

We should decide whether we want trailing slashes in our urls or not (or add a config option). So we can force trailing slashes or remove them. There should be 301 redirects in place.

Things to consider:

marcoeh commented 3 years ago

Related issue here

mornir commented 3 years ago

Someone also wrote a great post about this topic 😏

marcoeh commented 3 years ago

Matomo Tracking

tl;dr Both versions get tracked…

es isch biz tricky mit trailing slashes, es werded denn halt beidi versione tracked uf matomo. somit erschiint example.com/about uf matomo als about und example.com/about/ als about/index . dem chönnti mer biz entgegestüüre wenn mer usefindet wie mer mitem nuxt/matomo module die default wert überschriibt wos übermittled und dete trailing slashes stripped oder forciert. das gseht denn so us wie bi fischer:

matomo

How to fix this

Answer from matomo support

Did you want to alter the historical data or fix this for future tracking? Historical data can't be altered unfortunately. You can delete old data with the GDPR tool. For the future you can set a custom URL in the tracker with _paq.push(['setCustomUrl', 'customHomepageURL']);

What we could/should do:

Make a PR for nuxt-matomo that adds an option to strip or force trailing slashes before the request to matomo is being fired. See this line.

marcoeh commented 3 years ago

I opened up a pull request.

marcoeh commented 3 years ago

Some info about redirects in nuxt: https://deltener.com/blog/nuxt-redirects/

True HTTP Status Codes When Using Nuxt Generate It’s common to use Nuxt to create super fast JAMStack sites. In these cases serverMiddleware isn’t available since you are running generate. If you want server-side redirects with real HTTP status codes you have to use whatever methods your hoster has. Here are the methods for Netlify and Zeit