Search code examples
emacsjekyllorg-mode

Internal links in Jekyll using Org mode


I saw this question about linking to internal content using markdown. How can I link to other posts using Org mode?

I tried the markdown format and I get the following error:

...error:
             Error: Unknown tag 'post'
             Error: Run jekyll build --trace for more information.

Solution

  • You can get a relative URL to another blog post inside a jekyll post with {% post_url 1025-08-26-blog-post-name %} (with no trailing .html or .org on the post name).

    To actually make it a link, you'll need to wrap it in an html link. Assuming you've got your org-publish settings set up to write HMTL, this can be a little tricky, since it seems that the standard org-mode link syntax doesn't work properly for jekyll-inserted links. Instead, you can just insert the anchor html directly into your org file using an org-mode HTML escape:

    Blah blah surrounding text @@html:<a href="{% post_url 1025-08-26-blog-post-name %}">@@Text describing link to my other post@@html:</a>@@ more surrounding text