So I’ve got a Jekyll site, it has a file called CHANGELOG.md in it but when I get Jekyll to build the site, instead of getting CHANGELOG.html, I get a directory called CHANGELOG containing a file called index.html.
Why, please, and how can I get Jekyll to create CHANGELOG.html?
OK … so it looks like this is (a) by design and (b) being triggered by the permalink behaviour:
When you use permalinks that omit the .html file extension (called “pretty URLs”) Jekyll builds the file as index.html placed inside a folder with the page’s name.
Testing has revealed that this is being triggered because the config file says:
permalink: /news/:title/
which omits the .html extension.
So, if I want CHANGELOG.html, is my only choice to put an overriding permalink in the front matter for that specific file, or is it possible to have another permalink defined in the config, e.g.:
permalink: title
so that this gets used if /news/ isn’t appropriate?
I’m giving up on this. I don’t seem to be able to come up with a permalink syntax for the file that can be generalised, e.g. taking the title and adding .html to it.
In other words, if I use something like:
permalink: :title.html
the page isn’t built but no errors are generated.
So I’m just going to leave the permalink out and let Jekyll go back to creating a directory with index.html inside it. I don’t like it but at least the site builds.
@rdyar For the site I’m working on, most of the pages are being manually edited and have got their permalink manually set in each page.
There are a few pages that are being ingested from elsewhere so I have very limited control over what I can do by way of front matter. For those, I’m trying to find an automatic or templated way or setting the permalink, which is why I was trying to use the title approach.
Unfortunately, I don’t seem to be able to get much in the way of diagnostics out of Jekyll as to why it is refusing to build the pages when I’m trying out some of the ideas. It just doesn’t output the pages at all but doesn’t complain either.
I might see if I can do a bit more with altering the front matter on these files but it is tricky. As the moment, leaving it to no permalink at all does give me generated pages, just as a directory and a file rather than just as a file.
Only other suggestion I can offer is if you have a public repo we can look at to see exactly what’s going on with your _config.yml settings and page content.
You can also run try running the Jekyll serve and build commands with the --verbose flag enabled. It’ll show you more detail on the pages Jekyll is reading, writing, or skipping…
jekyll serve --verbose
You’ll see stuff like this in your terminal/console which may give you a clue what is the problem.