Skip to content

Latest commit



106 lines (72 loc) · 2.51 KB

File metadata and controls

106 lines (72 loc) · 2.51 KB

Jekyll Relative Links


A Jekyll plugin to convert relative links to Markdown files to their rendered equivalents.

What it does

Let's say you have a link like this in a Markdown file:


While that would render as a valid link on, it would not be a valid link on Pages. Instead, this plugin converts that link to:


It even work with pages with custom permalinks. If you have with the following:

permalink: /bar/

# bar

Then [foo]( will render as [foo](/bar/).

The default Jekyll's configuration permalink: pretty in the _config.yaml file removes the .html extensions from the generated links.


Because Markdown files rendered by GitHub Pages should behave similar to Markdown files rendered on


  1. Add the following to your site's Gemfile:
gem 'jekyll-relative-links'
  1. Add the following to your site's config file:
  - jekyll-relative-links

Note: If you are using a Jekyll version less than 3.5.0, use the gems key instead of plugins.


You can configure this plugin in _config.yml under the relative_links key. This is optional and defaults to:

  enabled:     true
  collections: false

Excluding files

To exclude specific directories and/or files:

    - directory

Processing Collections

Setting the collections option to true enables relative links from collection items (including posts).

Assuming this structure

├── _my_collection
│   ├──
│   └── some_subdir
│       └──
├── _config.yml

the following will work:

File Link [Some Doc](_my_collection/ [Another Doc](_my_collection/some_subdir/
_my_collection/ [Index](../
_my_collection/ [Another Doc](some_subdir/
_my_collection/some_subdir/ [Index](../../
_my_collection/some_subdir/ [Some Doc](../


Even if the plugin is enabled (e.g., via the :jekyll_plugins group in your Gemfile) you can disable it by setting the enabled key to false.