Problem rendering content if filename changes

I have a very odd occurrence to me that I’m trying to debug…
I am looping through every page in my site and dumping them all out on a single page so users can print
write out the contents with {{page_item.content}}
and if the file is called it processes the {{}} variables, if the file is called it doesn’t process the variables

{% for page_item in site.pages %}
    {% if "/about/" == page_item.permalink %}
{{ page_item.permalink }}
{{ }}
    {% endif %}
{% endfor %}

If the file is named, the page_item|jsonify includes the value of the site.baseurl variable.
But if I rename the file to, the page_item|jsonify just includes the literal string {{site.baseurl}}

Here’s the first 8 lines of the md file:

layout: page
title: About
permalink: /about/
description:  (About Page)
# About

When run the script above on, it prints out html "/data<h1>About</a>"
("/data" is the value of site.baseurl)
When I run the script above on the same file, but named, it prints out html

Oddly to me, the contents of the page written out to the _site folder’s about/index.html are proper.

this is missing the if part I think, not sure that would cause the issue though, but I have probably seen stranger things happen.

Other than that I am not sure, I think I understand your question, but you might want to proof read it.

Thanks, nice catch. I’ll edit my original post. That was me cutting and pasting poorly, there is an if there, the full code that is trying to print the page content is…

{% for page_item in site.pages %}
    {% if "/about/" == page_item.permalink %}
{{ page_item.permalink }}
{{ }}
    {% endif %}
{% endfor %}

what if you try other names for the file - does it only work if it is and fails if it is anything else? or does it randomly work?

why aren’t you using the .content part in your actual code? without that don’t you get all kinds of stuff? or are you just looking at the content part of that?

I think the item.content might not be fully processed? if there is markdown in it is it rendered as html or markdown? I wonder if the liquid is processed, I sort of remember something about that.

The content of the Page, rendered or un-rendered depending upon what Liquid is being processed and what page is.

little vague but sounds like what you are seeing, just a bit of a mystery as to why it is inconsistant.

I’ve tried renaming the file to lots of different names. it works as through, through fails. I first found this out because didn’t work as expected.

I want to use page_item.content to render the page. I am using page_item|jsonify to look a the difference between files quickly since the json version of the content element will have the rendered variables for, but have the template, raw strings for

There’s got to be some reason why the liquid isn’t processed for files.

I have seen this before but don’t remember what exactly was the cause… I was trying to show the css of a site on a page in the site and it worked one way as unprocessed raw text and when I renamed the file to something else it was totally different as it was getting processed (?). I looked at that site to see if I left a note about why I thought that happened but I don’t see anything. It was something about the alphanumeric order of things I think.

maybe @ashmaroli has an idea.

basically you can do what you want, it just only works as you want it if the filename starts with a certain letter right? otherwise the liquid is not processed.

I tired to edit your post but I think it is still a bit off at the bottom. At the top I changed it to say if the file is called it doesn’t process.. you had does.

Thanks, for the cleanup on the question. I hope @ashmaroli has an idea.

It seems like the liquid variables aren’t expanded if the filename starts with certain letters (q and up).

AHA! I figured it out. The page where my loop was running was called “” so I think any pages in site.pages after weren’t rendered yet. I renamed to and now everything works.

It was a combination of your help, and a comment found via google,

Thanks. I can live with this hack.

ah - yes, I think that was the same thing I had - the filename I wanted my css to show on had to be after the css was rendered (or vice versa - can’t remember).

makes sense.

1 Like

When I forget this solution in a few years, I hope this thread will show up through DDG and help future me :slight_smile:
Thanks for being so responsive and helping me debug.

There is a long-standing issue-ticket pinned in the Jekyll repository related to the issue here: