When I test my blog locally, the links in my post template (below) properly go to the correct URL relative to the root of my blog. However, when I deploy it, the URLs are relative to my post path, and so they end up being wrong.
E.g.)
The post page: 127.0.0.1:4000/medablog//medabots/2021/07/22/New-Medawatch-Who-Dis.html
Correctly redirects to my author page: 127.0.0.1:4000/medablog/authors/variant.html
Online, the post page: medablog/medabots/2021/07/23/New-Medawatch-Who-Dis.html
Incorrectly redirects to: medablog/medabots/2021/07/23/medablog//authors/variant.html
Here’s my post template:
---
layout: default
---
<h1 style="margin-bottom: 0">{{ page.title }}</h1>
{%- assign author = site.authors | where: "name", page.author | first -%}
<p style="margin-bottom: 0"><small>- <a href="{{ site.baseurl }}/authors/{{ author.slug | slugify }}.html">{{ author.name }}</a> {{ page.date | date_to_rfc822 }}</small></p>
<hr>
<br>
{{ page.content }}
<br>
<hr>
<p style="margin-bottom: 0; text-align: right;"><small>Tags:{%- for tag in page.tags -%} <a href="{{ site.baseurl }}/tags/{{ tag | slugify }}.html">{{ tag }}</a>{%- endfor -%}</small></p>
In order to use later versions of Jekyll and my own plugins to play around with, I’ve got a GitHub Action to deploy pages from my master branch to the gh-pages branch, which is what actually gets deployed.
Here’s the repo: github.com/Medabots/medablog
The gh-pages branch: github.com/Medabots/medablog/tree/gh-pages
I’m using site.baseurl everywhere, so I’m not sure why exactly my deployed page is unable to correctly parse the absolute path… Any ideas?