~dmbaturin/soupault

2

Rewriting internal links when clean_urls=true

Details
Message ID
<b77434a0-8f20-09a3-9b8b-ccb2c1d2a1ac@baturin.org>
DKIM signature
pass
Download raw message
Hi everyone,

Thomas Letan raises a valid point in the cleopatra setup description:

>The issue we have with this feature is that the internal links within
your websiste needs to take their /final/ URL into account, rather than
their actual name.
>If one day |soupault| starts rewriting internal URLs when |clean_url|
is enabled, we might reconsider using it.

Right now the implementation assumes that people never change their mind
about clean URLs.

That assumption isn't far from truth because if any other site links to
any of your pages, converting from traditional to clean URLs or back is
a logistical nightmare, unless you want to contribute to an already
rampant link rot problem.

The question is how to facilitate that transition best. First possible
approach is to do the rewriting inside soupault. The problem with it is
that _just_ changing the internal links does nothing to ensure original
links still work. If anything, it's "instant link rot, just add water".

For people who self-host their websites rather than use Neocities/Github
Pages/Netlify, automatically generating a list of 301 redirects for
.htaccess or nginx config is a viable option.
Adding that to soupault seems like serious feature creep though, and it
goes against the "unopinionated" design goal. What use is a list of
redirect rules in Apache/nginx syntax if you are using lighttpd, or
cherokee... or Microsoft IIS, for that matter. 

As a solution, we can include an "original path" field in the JSON index
data. Then an external script can take that data and generate redirects
for pages where effective and original URL differ.

What do you think?
Details
Message ID
<bbeece09-27f2-0267-0538-36372806b265@aoirthoir.com>
In-Reply-To
<b77434a0-8f20-09a3-9b8b-ccb2c1d2a1ac@baturin.org> (view parent)
DKIM signature
pass
Download raw message
If you do 301 redirects in soupault i suggest a setting, say 
301redirects = true/false... if false just output build/ like normal... 
if true, then create two sets of files in build where appropriate based 
on the setting of clean_urls... if clean_urls = false then 
site/cats.html results build/cats/index.html redirects to 
build/cats.html etc. I would only implement this if you need it or your 
get a request.. but in theory it should not be to difficult to output 
two build/pages for every site/page... of course i dont write ocaml so i 
cannot really accurately comment on that.

Internal links tho are another matter.. if a link points to a .html and 
clean urls are used, a setting should be available to convert all over 
those and the same in the reverse situation. But even in this situation, 
while its a thing that probably should be implemented sometime...i dont 
see it as high priority myself. The more problematic issue for me would 
be when I change sections... moving one section to a sub section and so 
on.. and for me i would automate all of that myself by hand.
Details
Message ID
<4d5e7286-7585-4f57-a64a-86189b29e2fc@aoirthoir.com>
In-Reply-To
<bbeece09-27f2-0267-0538-36372806b265@aoirthoir.com> (view parent)
DKIM signature
pass
Download raw message
Honestly all this should just be a Lua plugin... that way the user can 
decide what to do... and have much more finessed control over it...