I'm learning Jekyll by customizing a theme I bought, and I made the date to display in a way I want by editing this tag and leaving only %B and %Y (that's probably not the way this is called, I'm still learning)
{% if page.date %}
<div class="project-date">
<strong>Date </strong><span>{{ page.date | date: "%B %Y"}}</span>
</div>
{% endif %}
Now on every page that has a Date: field on the frontmatter, I put whatever date is needed there, 2022-01-01 outputs to January 2022 as I want.
But what I also would like is to leave a short remark on each of these entries, separately. So on a Page 1 and its custom date, I'd like to have it display January 2022 - for 2 months and on Page 2 where the date is March 2023, I'd like to add "for 1 month" comment.
How do I achieve this?
If I understand your problem correctly, you want to display additional data based on certain pages configuration. You can achieve it in a similar way as displaying dates, so add to the layout file:
and then in Page 1 have a configuration option at the top of the file:
And accordingly for other pages.
However, if you need to generate
months_ago
dynamically, you can just use liquid filters in layout file, eg. minus method