4

I ran htmlproofer and got this failure.

internally linking to /posts/title, which does not exist

how do I fix the liquid tags in jekyll so that the HTML outputs correctly when built?

I think it has something to do with this line in index.html

<a href="{{ post.url | relative_url }}" title="{{ post.title }}"></a>

when I add {{ post }} in this line

<a href="{{ post.url | relative_url }}{{ post }}" title="{{ post.title }}">

the posts at least show on the index.html, even though it makes the site look broken. When {{ post }} is removed the main page looks normal, but when clicking on posts they lead to a 404...

marcanuy
  • 23,118
  • 9
  • 64
  • 113

1 Answers1

3

HTMLProofer should check the generated site located at _site directory. This folder contains the generated files of your websites that has been processed by Jekyll, that way the failing links would be checked properly by htmlproofer.

For example:

htmlproofer --check-html \
        --internal-domains localhost:4000 \
        --assume-extension \
        --disable-external \
        _site
marcanuy
  • 23,118
  • 9
  • 64
  • 113
  • try with `{{ post.title }}` and setting in `_config.yml` the property: baseurl="" – or `{{ post.title }}` – marcanuy Jun 29 '17 at 12:33
  • What is the generated url that leads to a 404 page? – marcanuy Jun 29 '17 at 17:02
  • example.com/projectname/year/month/title or https://mrjules.gitlab.io/chalked5/2016/10/configuring-chalk. I can't open blog posts from `index.html` – WinterJules Jul 02 '17 at 15:07
  • just downloaded your website and works for me, is the CI failing? it looks like there is some problem with permalinks (as it is published now, if you add `.html` to your blog posts it works, but it shouldn't be necessary) – marcanuy Jul 02 '17 at 22:16
  • in my `_config.yml` permalinks was set to `permalink: /:year/:month/:slug`. I changed it to `permalink: /:year/:month/:title.html` and now the posts open. My about page doesn't seem to generate `.html` even when adding `permalink: /:title.html` to the about page. – WinterJules Jul 04 '17 at 00:00
  • Solved my about page issue. Thanks marcanuy. If you didn't point out the `.html` permalink, I would have never thought to check my permalink setting in `_config.yml` – WinterJules Jul 04 '17 at 00:41