DEV Community

loading...

Discussion on: Publishing an Eleventy site to Github Pages

Collapse
ddhogan profile image
Donna Hogan Author

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!

Collapse
erwald profile image
Erich Grunewald

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