Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange problem on Jekyll 4.0.0 version #74

Open
zhandosweb opened this issue Dec 21, 2019 · 2 comments
Open

Strange problem on Jekyll 4.0.0 version #74

zhandosweb opened this issue Dec 21, 2019 · 2 comments

Comments

@zhandosweb
Copy link

zhandosweb commented Dec 21, 2019

Hello!

Please, let me ask one question. I faced a strange problem.

I installed a plugin. Then I go to my post.md, and write: {% last_modified_at %}.

And there I get the error: Liquid Exception: No such file or directory - etc... Here is a screenshot of the problem: http://i.imgur.com/v3EgzGe.png

Here is my code: http://i.imgur.com/hJ5vdEW.png. But, if I put before {% last_modified_at %} any text, there is no error, screenshot: http://i.imgur.com/bDaK7i9.png

Why I faced with this problem? And how I can resolve it?

Sorry for bad English, I'm still learning. Believe, that you understand me.

@gjtorikian
Copy link
Owner

Hello. Do you have the gem installed in your Gemfile, like this?

It is very strange that the error asks for #excerpt, because that file does not exist in this plugin at all. If you remove {% last_modified_at %}, is the error still there?

@emmahsax
Copy link

emmahsax commented Mar 20, 2020

I'm getting a very similar error.
Gemfile:

gem 'jekyll-last-modified-at', '~> 1.2.1', group: :jekyll_plugins

_config.yml:

plugins:
  - jekyll-last-modified-at

HTML:

<footer>
  Last modified at {% last_modified_at %}.
</footer>

Error:

Liquid Exception: No such file or directory - /path/to/repository/repo_name/.html does not exist! in /_layouts/default.html

If I change the HTML to be:

<footer>
  Last modified at {{ page.last_modified_at }}.
</footer>

the error disappears, and it renders the date correctly.

Or, if I move the code to somewhere not in the footer (in a markdown file instead), it also renders the page last modified date:

---
title: Page
---

Last modified at {% last_modified_at %}.

renders:
image

My end goal is to just show the date the entire site was last modified at, to eventually be used in an Atom RSS feed.

I am using Jekyll 3.8.6.


UPDATE: I think I misunderstood what this gem does. It gets the modified date for each page, not the whole site. I ended up writing this, which loops through all of the pages and gathers the last_modified_at into an array, and then sorts to find the most recent:

{% assign modified_dates = "" | split: ',' %}
{% assign pages = site.html_pages | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.url != "/404.html"' %}
{% for page in pages %}
  {% if page.last_modified_at %}
    {% assign modified_dates = modified_dates | push: page.last_modified_at %}
  {% endif %}
{% endfor %}

{{ modified_dates | sort | last }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants