# Jekyll Markdown "link" and "post\_url" error

**URL:** <https://talk.jekyllrb.com/t/jekyll-markdown-link-and-post-url-error/5467>\
**Category:** Help\
**Created:** [January 7, 2021, 4:46pm UTC](https://talk.jekyllrb.com/t/jekyll-markdown-link-and-post-url-error/5467 "2021-01-07T16:46:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jwmc999](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/jwmc999/32/3089_2.png) [@Jwmc999](https://talk.jekyllrb.com/u/Jwmc999)\
**Post date:** [January 7, 2021, 4:46pm UTC](https://talk.jekyllrb.com/t/jekyll-markdown-link-and-post-url-error/5467/1 "2021-01-07T16:46:53Z")

</div>

Hi.  
This `link` and `post_url` problems seem not resolved by myself, after a week of struggling, I post this here.

My jekyll is v.4.2.0, so I did as below:

```auto
---
layout: default
---
# Blog Post
* [Prologue]({% link Prologue.md %})

# Journey Codes
* [Data Structure (DS)]({% link _posts/Data-Structure/2020-12-12-about.md %})
* [C Language (C)]()
* [Discrete Mathematics (M)]()

[back]({% link index.md %})

```

Then receive error message:

```auto
$ bundle exec jekyll build
Configuration file: C:/Users/user/Desktop/Jwmc999.github.io/_config.yml
            Source: C:/Users/user/Desktop/Jwmc999.github.io
       Destination: C:/Users/user/Desktop/Jwmc999.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
  Liquid Exception: Could not find document '_posts/Data-Structure/2020-12-12-about.md' in tag 'link'. Make sure the document exists and the path is correct. in post.md
                    ------------------------------------------------
      Jekyll 4.2.0 Please append `--trace` to the `build` command
                     for any additional information or backtrace.
                    ------------------------------------------------
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/tags/link.rb:32:in `render': Could not find document '_posts/Data-Structure/2020-12-12-about.md' in tag 'link'. (ArgumentError)

Make sure the document exists and the path is correct.
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/liquid-4.0.3/lib/liquid/block_body.rb:103:in `render_node_to_output'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/liquid-4.0.3/lib/liquid/block_body.rb:91:in `render'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/liquid-4.0.3/lib/liquid/template.rb:208:in `block in render'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/liquid-4.0.3/lib/liquid/template.rb:242:in `with_profiling'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/liquid-4.0.3/lib/liquid/template.rb:207:in `render'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/liquid-4.0.3/lib/liquid/template.rb:220:in `render!'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:39:in `block (3 levels) in render!'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:59:in `measure_counts'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:38:in `block (2 levels) in render!'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:63:in `measure_bytes'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:37:in `block in render!'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:70:in `measure_time'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:36:in `render!'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:131:in `render_liquid'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:80:in `render_document'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:63:in `run'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:547:in `render_regenerated'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:539:in `block in render_pages'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:538:in `each'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:538:in `render_pages'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:211:in `render'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:80:in `process'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:28:in `process_site'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:65:in `build'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:36:in `process'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
        from C:/Ruby27-x64/bin/jekyll:23:in `load'
        from C:/Ruby27-x64/bin/jekyll:23:in `<main>'

```

Links to ‘Prologue.md’, ‘index.md’, and ‘post.md’ work, and those three locate in root. The thing is, when I try to link to files under subdirectories, `link` and 'post\_url` do not work. However, if I put the same files on root, they work.  
I am looking for a way to avoid moving all posts to root…

I googled link-tag errors on Jekyll v4.0 but didn’t really make changes.

Any insight on how can I fix it?

In case, my repo is [GitHub - Jwmc999/Jwmc999.github.io](https://github.com/Jwmc999/Jwmc999.github.io).

Thank you.

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [January 7, 2021, 7:18pm UTC](https://talk.jekyllrb.com/t/jekyll-markdown-link-and-post-url-error/5467/2 "2021-01-07T19:18:15Z")

</div>

Your link tag to the about post matches the path on github exactly so I don’t know what is wrong with that.

What if you use this? I don’t know if the tag supports sub directories

```auto
{% post_url Data-Structure/2020-12-12-about %}

```

Without .md I think.

I haven’t used post\_url but I use link tag a lot with subpaths

Given path

```auto
foo/bar.md

```

You can do link tag with the exact path

```auto
{% link foo/bar.md %}

```

Note that the path given to link must always be relative to the repo root - not a relative path like `./bar.md` within folder `foo`.

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [January 8, 2021, 7:54am UTC](https://talk.jekyllrb.com/t/jekyll-markdown-link-and-post-url-error/5467/3 "2021-01-08T07:54:46Z")

</div>

You have `collections_dir : .` in your config file.  
Remove that and the tags will work properly.

---

<div class="post-metadata">

**Author:** ![Jwmc999](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/jwmc999/32/3089_2.png) [@Jwmc999](https://talk.jekyllrb.com/u/Jwmc999)\
**Post date:** [January 8, 2021, 8:25am UTC](https://talk.jekyllrb.com/t/jekyll-markdown-link-and-post-url-error/5467/4 "2021-01-08T08:25:06Z")

</div>

Thanks million!!! It works!!!  
Thank you very muchhhhhhh! 🤩
