re: Publishing an Eleventy site to Github Pages VIEW POST

re: Thanks for this, very helpful. I would have figured there was some way of automatically appending {{site.pathPrefix}} to every link (or some subset...

Thank you for the feedback, Erich!
Your reply inspired me to look into it a little further, and learned I can use the built-in URL filter since I'm deploying to a sub-directory.

Using this, one of my links looks like this: <a href="{{ '/myFirstPost' | url }}">First Post</a>, where the | is the filter operator, and url indicates to use the url filter.

All I had to change was the formatting of those links to other posts, and add the trailing slash to the pathPrefix in .eleventy.js.
This also means I can delete _data/site.json, since there's no need to declare the pathPrefix there too.

I am going to update this mini-tutorial, thank you again!


Thanks, that's just what I was looking for!

Code of Conduct Report abuse