# Liquid Tags Not Working in Markdown Files in Non-Post Subdirectory

**URL:** <https://talk.jekyllrb.com/t/liquid-tags-not-working-in-markdown-files-in-non-post-subdirectory/1870>\
**Category:** Help\
**Created:** [June 4, 2018, 6:03pm UTC](https://talk.jekyllrb.com/t/liquid-tags-not-working-in-markdown-files-in-non-post-subdirectory/1870 "2018-06-04T18:03:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kimardenmiller](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/kimardenmiller/32/1046_2.png) [@kimardenmiller](https://talk.jekyllrb.com/u/kimardenmiller)\
**Post date:** [June 4, 2018, 6:03pm UTC](https://talk.jekyllrb.com/t/liquid-tags-not-working-in-markdown-files-in-non-post-subdirectory/1870/1 "2018-06-04T18:03:01Z")

</div>

Liquid tags like {{ site.baseurl }} not rendering in non-post subdirectory (called “momentum\_content”) markdown. Non-rendered, raw Liquid tags shown here: [https://kimardenmiller.github.io/Momentum/test/](https://kimardenmiller.github.io/Momentum/test/)

Liquid tags seem to work fine in markdown within \_posts.

jekll build --verbose says it’s rendering the files:

> Rendering: momentum\_content/test.md  
> Pre-Render Hooks: momentum\_content/test.md  
> Rendering Liquid: momentum\_content/test.md  
> Rendering Markup: momentum\_content/test.md  
> Rendering Layout: momentum\_content/test.md

… but a little differently than it renders posts, where “Rendering Liquid” is not listed:

> Rendering: \_posts/2018-04-28-rebuilding.markdown  
> Pre-Render Hooks: \_posts/2018-04-28-rebuilding.markdown  
> Rendering Markup: \_posts/2018-04-28-rebuilding.markdown  
> Rendering Layout: \_posts/2018-04-28-rebuilding.markdown  
> Layout source: site

Have tried using collections, but makes no difference:

> collections:  
> momentum\_content:  
> output: true

Full source at: [GitHub - kimardenmiller/momentum](https://github.com/kimardenmiller/Momentum)

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [June 4, 2018, 6:32pm UTC](https://talk.jekyllrb.com/t/liquid-tags-not-working-in-markdown-files-in-non-post-subdirectory/1870/2 "2018-06-04T18:32:50Z")

</div>

I believe the problem is your `post.html` layout and [this line](https://github.com/kimardenmiller/Momentum/blob/master/_layouts/post.html#L21). You don’t need `page.content` nor do you need the Markdownify filter… just plain ole `{{ content }}` will do the trick.

You’re essentially applying it twice which is why you’re getting the unrendered Liquid. I just cloned your repo and replaced `{{page.content | markdownify }}` with `{{ content }}` and the Liquid tags in your `test.md` file output as expected.

---

<div class="post-metadata">

**Author:** ![KhBh](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/khbh/32/4845_2.png) [@KhBh](https://talk.jekyllrb.com/u/KhBh)\
**Post date:** [April 23, 2020, 11:17am UTC](https://talk.jekyllrb.com/t/liquid-tags-not-working-in-markdown-files-in-non-post-subdirectory/1870/3 "2020-04-23T11:17:38Z")

</div>

What about in a context where I’m rendering the `content` of a _different_ page?

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [April 23, 2020, 2:03pm UTC](https://talk.jekyllrb.com/t/liquid-tags-not-working-in-markdown-files-in-non-post-subdirectory/1870/4 "2020-04-23T14:03:43Z")

</div>

That depends on how you’re pulling in content from a different page. Usually that’s done via a `for` loop on an object. In that case you prepend `content` with whatever you named the items in the loop to e.g. `foo.content`

Example

```auto
{% for foo in site.posts %}
  {{ foo.title }}
  {{ foo.content }}
{% endfor %}
```

---

<div class="post-metadata">

**Author:** ![KhBh](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/khbh/32/4845_2.png) [@KhBh](https://talk.jekyllrb.com/u/KhBh)\
**Post date:** [April 23, 2020, 2:21pm UTC](https://talk.jekyllrb.com/t/liquid-tags-not-working-in-markdown-files-in-non-post-subdirectory/1870/5 "2020-04-23T14:21:37Z")

</div>

Right, but in that context, specifically in [an html include, I’ve had the problem before that the markdown didn’t render](https://talk.jekyllrb.com/t/rendering-markdown-inside-an-html-include/4186) and it required a ` | markdownify`… which now seems to have escaped the liquid tags 😔 It seems I’m stretching Jekyll to its limit having an include inside page content inside an include inside page content 😆

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [April 23, 2020, 2:54pm UTC](https://talk.jekyllrb.com/t/liquid-tags-not-working-in-markdown-files-in-non-post-subdirectory/1870/6 "2020-04-23T14:54:23Z")

</div>

Includes are a different beast. They depend on the file extension used as well. If you have a `.html` include it’s going to need the `markdownify` filter. But if it’s `.md` then I believe it will parse the text as Markdown without the filter.

Though that’s likely not what you want either since you have HTML in the include and you’ll find all sorts of goofiness changing the include’s extension to `.md` since indents will be interpreted as code blocks and your HTML markup will get mangled.
