ElMassimo / iles

🏝 The joyful site generator
https://iles.pages.dev
MIT License
1.07k stars 31 forks source link

PrettyUrls settings appears to be the wrong way around #195

Closed ohuu closed 1 year ago

ohuu commented 1 year ago

The prettyUrls setting appears to be the wrong way around. I would expect routes to be like this .../products/index.html when prettyUrls is set to true. However the routes appear like this .../products.html which requires one to explicitly include .html at the end of the url

It might just be me but that seems to be the opposite of what you want?

ohuu commented 1 year ago

Actually this setting looks to be broken. Dynamic routes appear to be ignored

ElMassimo commented 1 year ago

When vendors like Netlify and Vercel say "prettyUrls", they mean /products instead of /products/.

Here's an example of a dynamic route with prettyUrls, and an example of a dynamic route with prettyUrls: false.

If you open a discussion with a repo example, I can take a look 😃

ohuu commented 1 year ago

We're not using Netlify or Vercel to host our site. We're using DigitalOcean's App Platform and all our urls are like this /products/1.html. I assumed prettyUrls would instruct Iles to create something like this /products/1/index.html so that the url would look like this /products/1. Is this what Iles is supposed to be doing?

ElMassimo commented 1 year ago

As specified in the documentation for prettyUrls:

Whether to skip .html and trailing slashes in link hrefs and router paths.

With prettyUrls: false, links will be normalized to ensure a "standard" server can serve the corresponding HTML page. For example, the canonical for /products/1/index.html is /products/1/, while the only valid URL for /products/1.html is /products/1.html.

With prettyUrls: true, you rely on service providers to route things differently than "standard" servers. As a result, you can safely use /products/1 as a shortcut for /products/1.html, as the service provider would be able to route it correctly.


Seems like DigitalOcean does not support this feature, so you would need to use prettyUrls: false to ensure links are not broken.

îles won't change the structure of your HTML site, if you want /products/1/index.html instead of /products/1.html, change the structure of the pages accordingly. For example, src/pages/products/[page]/index.vue.

ohuu commented 1 year ago

Ahh, that's how it works! Thanks I got it working now.