Jekyll and link to internal files: page not found

I am building my website (published with GitHub Pages) and I would like to do the following: inside one of the main pages (a .md file) I would like to insert a link to another .md file, so that I can organize my projects nicely.

The current structure of the directory is the following:

  • _research_projects/
  • _congif.yml

In the file I want to insert a link to _research_projects/ . Therefore I inserted in the first file the following:

[Project 1](/_research_projects/

The file contains just the following at the moment:

layout: default

This is a test!

In the file _config.yml I added the following:

  - jekyll-relative-links

  enabled: true
  collections: true

But it still does not work: while in the GitHub repository the link works (it goes to the file _research_projects/ if I click on the link), if I click on the link from the webpage, I get the error message:

Whoops, this page doesn't exist.
Move along. (404 error)

try it without the _ like [Project 1](/research_projects/

folders with an underscore are not usually output to the site folder - assuming it is a collection it is probably in the site folder without the leading underscore.

If you are building locally you should check to see what it is in the site folder.

1 Like

An underscore in front on a directory name is fine in the case of a collection, otherwise it should not have an underscore.

But since it works locally that isn’t your problem.

I suspect you are using a subpage domain and left that part out of your question.


Given homepage

Then you are referencing



Which is not valid.


Two things.

First set config file to match your remote environment


baseurl: /my-repo/

The URL will only be used locally for prod builds and for things like sitemap. But baseurl will be used on every build or server.

The link will be shown as server started on


Then second thing is to make your URL into a relative URL.

[Project 1]({{ '/_research_projects/' | relative_url }})

There is still the chance your URL is bad like a typo or the page moves.

But this is safer as it will give an error at build / server start:

[Project 1]({{ site.baseurl }}{% link _research_projects/ %})

Note no quotes in 2nd case.

And then your result will be a link like this:

Including the subpath.

Relative links

I see you have this plugin set up and it is used on the remote set up. I don’t think it does anything relevant to this question.


BTW for SEO it is better to use hyphens as Google crawlers splits items by hyphens but seems underscore terms as a whole word.



Also make sure you are using Jekyll 3 set in Gemfile to match GitHub Pages environment. Jekyll 4 handles the link tag differently so you’ll get weirdness if you use Jekyll 4 locally and Jekyll 3 on the remote.

1 Like