I'm configuring a Jekyll website with the Lanyon theme but the configuration on the site url,baseurl and permalinks is so unclear to me.
Thus my _config.yml
uses:
url: "https://edgeoftech.github.io/"
baseurl: /blog
permalink: pretty
And my about.md
page uses:
permalink: /about
When the site is served, main page is served at http://127.0.0.1:4000/blog/
and about page at http://127.0.0.1:4000/blog/about
, but the ABOUT link on the website takes me to http://127.0.0.1:4000/about
.
How can I configure both the link and the 'about' page to be linked to the same url?
I found your question as I was actively searching for the answer myself. I've just sorted it out with the Hyde theme, which is closely related. My _config.yml
file looks very similar:
url: https://annedorko.github.io/
baseurl: "/intp/"
permalink: pretty
The trick is actually in the hard-coded URLs. There are two primary places to fix this. The first is in the sidebar.html
– be sure to add the site.baseurl
in front of the node.url
.
<a class="sidebar-nav-item{% if page.url == node.url %} active{% endif %}" href="{{ site.baseurl }}{{ node.url }}">{{ node.title }}</a>
You'll also need to edit all the relative links in head.html
, similar to this:
<link rel="stylesheet" href="{{ site.baseurl }}public/css/poole.css">
Finally, be sure to add the updated post links on index.html
:
<a href="{{ site.baseurl }}{{ post.url }}">
{{ post.title }}
</a>
This may not cover all of your scenarios as the themes are a bit different (though still based off of Poole), but should get you started in the right direction. Best of luck!