ElMassimo / iles

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

Option to output "pretty" HTML paths #204

Closed lucperkins closed 1 year ago

lucperkins commented 1 year ago

Many static site generators enable you to output so-called "pretty" HTML paths, i.e. instead of /about.html they produce /about/index.html. I've been using iles a fair amount recently and haven't found a way to do this. If i"m mistaken, please let me know! Otherwise, this would be very nice to have, and I'd be happy to contribute this if you can provide some pointers on the best way to do so (i.e. should this be a Vite plugin? An iles plugin? Something built into iles?).

userquin commented 1 year ago

@lucperkins check https://iles-docs.netlify.app/config#prettyurls, by default true, you can disable it

EDIT: so you want the folder to be generated and inside it the index.html, sorry... rn not supported

lucperkins commented 1 year ago

@userquin Yes, precisely, I'd like everything generated as index.html files. To be honest, I think that people would expect setting prettyUrls to true to provide this (and not just activate it as a routing principle). What would be the best way to contribute this option to the project? Happy to do so, as I don't think it'd be too difficult.

ElMassimo commented 1 year ago

Please see the discussion in this issue for reference:


I'd prefer îles to be explicit in terms of the structure of the HTML files it generates, if you want /about/index.html, create a about/index.mdx or about/index.vue page.

Have in mind popular hosting options support routing /about to /about.html.


If you want this behavior, you could create a module which uses the extendRoutes hook, allowing you to control the output.

userquin commented 1 year ago

If you want this behavior, you could create a module which uses the extendRoutes hook, allowing you to control the output.

This can break PWA here, maybe we can protect against providing custom manifestTransform: it is working this way for example SvelteKit pwa integration:

lucperkins commented 1 year ago

@ElMassimo One potential drawback of this from a static site gen perspective is that it breaks most link checkers. If I have Markdown content with a local link to /foo/bar, for example, that link is now "broken" from the standpoint of a link checker like htmltest. I will definitely take up your advice (thanks!) and provide this functionality myself, but I do think that this decision goes firmly against the grain of what static site generators like Hugo, Jekyll, Astro, and many others provide.

ElMassimo commented 1 year ago

While inner-link checking is nice, I'd recommend checking all links in the built site by using a tool such as lychee.

I typically use it in the CI after deploying, and it helps to detect any dead links, especially to third-party sites.

lucperkins commented 1 year ago

@ElMassimo Personally, I prefer (and recommend!) separate link checks for internal and external links (which htmltest supports). To me, checking internal links is very much an every-single-PR thing whereas external link checks shouldn't make a PR fail (because they're dependent on factors outside your project). Lychee is great for external links but AFAICT can't do internal or external only on a specific run. Anyhoo, not suggesting this approach is for everyone, just explaining my reasoning 😄