Skip to content

SpinalCMS/bridgetown-internal-markdown-links

Repository files navigation

🔗 Bridgetown Internal Markdown links

This plugin allows you to write paths in your markdown similar to how you can within liquid, serbea or erb template files, like so:

[Check out the docs](_pages/docs.erb)

Instead of:

[Check out the docs](/docs/)

(and do a find/replace throughout your site, if the slug changes for that page).

This plugin uses Bridgetown's url_for() helper in the background.

Installation

Run this command to add this plugin to your site's Gemfile:

bundle add bridgetown_internal_markdown_links

Then add the initializer to your configuration in config/initializers.rb:

init :bridgetown_internal_markdown_links

Usage

Link parsing is opt-in per collection.

Configuration

Add the following in your config/initializers.rb:

config.internal_markdown_links.collections = ["posts", "docs"]

Parsing of internal links is now happening for the collections “posts” and “docs”.

Disable per file

Set internal_markdown_links: false in the frontmatter.

Testing (TBD)

  • Run bundle exec rake test to run the test suite
  • Or run script/cibuild to validate with Rubocop and Minitest together.

Sponsored By Spinal

Spinal CMS logo

Contributing

  1. Fork it (https://github.com/SpinalCMS/bridgetown-internal-markdown-links/fork)
  2. Clone the fork using git clone to your local development machine.
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request