postalserver / docs

📚 Documentation for the Postal mail server!
https://docs.postalserver.io
135 stars 59 forks source link

Fix prerequisites link #35

Closed bb closed 1 year ago

bb commented 1 year ago

Because URLs are structured like directories, relative links in the "same" folder need to use ../

willpower232 commented 1 year ago

the link works currently so I'm not sure what needs fixing?

bb commented 1 year ago

Please visit https://docs.postalserver.io/install/installation/ -- you'll see this:

CleanShot 2023-01-27 at 17 16 01@2x

Click the link in the red ellipsis (compare target in bottom left).

Reason is that the "installation.md" (file) is published as a directory (with the slash and an implicit index.html), as shown in the blue circle in the screenshot.

willpower232 commented 1 year ago

Aha so the real issue is that the site sometimes has a trailing slash but also works without the trailing slash leading to a bit of confusion

@jaydrogers do you have any ideas about how best to solve this?

bb commented 1 year ago

The docs site itself does always have a trailing slash because https://docs.postalserver.io/install/installation is redirected to https://docs.postalserver.io/install/installation/

But of course making the links work in both Markdown and compiled would be best.

jaydrogers commented 1 year ago

I did some testing and only noticed the trailing / issue on local.

On production, it is not able to be replicated. I have a feeling this related to the Node server locally itself where GitHub pages probably has a proxy in front of it handling the trailing slash stuff.

Regarding this PR

When I tested the change, it actually created issues for me (both in Markdown and in web form).

We appreciate the efforts, but from my perspective I don't see any reason to merge. See my video for further detail.

Full video demo

https://www.dropbox.com/s/ho2f4fkkmjxr48d/PostalServer-Docs_PR-35.mp4?dl=0

bb commented 1 year ago

Wow, you really went the extra mile with the video demo @jaydrogers 😍. I totally agree with you not merging the change. Just removing the trailing slashes everywhere is better. However, things are not as obvious as they seem.

Seeing your video, I was really confused because I explicitly verified that https://docs.postalserver.io/install/installation was always redirected to https://docs.postalserver.io/install/installation/ when I wrote the previous comment. So I wondered why this was happening for me, but not for you.

The answer is in the difference between actually following the links via HTTP-only or the way Nuxt (?) handles it (fetch+pushstate, like pjax or Turbo do it): The former adds the slash, the latter does not add it.

Proof:

curl -i https://docs.postalserver.io/install/installation
HTTP/2 301
server: GitHub.com
content-type: text/html
location: https://docs.postalserver.io/install/installation/
...

So... by hitting the installation page directly from an external source, I got a 301 redirect to installation/, then got the 404 when clicking on "prerequisites" (then made a PR).

A bit of googling reveals that maaaany people have issues with Github Pages' handling of trailing slashes. Absolutely not worth the effort. Reaching this conclusion from a single-charachter-PR is 🤯.

willpower232 commented 1 year ago

Thanks for the research both of you, every day is a school day!

jaydrogers commented 1 year ago

Haha, thanks @bb and @willpower232!

Yes, I was stumped myself so that's why I went the extra effort to publish my findings because I wasn't sure what was going on either 😆

@willpower232: One other thing to keep tabs on is we are running Nuxt Content v1 (which is now in "legacy support"). All new features are being added to Nuxt Content v2: https://content.nuxtjs.org/

I say the doc site works well for now, but at some point it may be advantageous to do the upgrade.

We will cross that bridge as Nuxt V2 matures a little more. I'm actually implementing it for another project (https://github.com/serversideup/docker-php/pull/110) and will keep you posted how it turns out.

Thanks for your help guys!

willpower232 commented 1 year ago

As the nuxt person :tm:, I guess the upgrade is dependent on your time :sweat_smile: I'll be ready to mess around with the content when required :pray: