pmoreno-rodriguez / grav-theme-editorial

Editorial is a GravCMS port of the Editorial theme from HTML5Up.net.
https://editorial.pmdesign.dev
Other
15 stars 4 forks source link

Recent Articles Date Issue #18

Closed Zarius01 closed 1 year ago

Zarius01 commented 1 year ago

Hi Rodriguez,

While I'm uncertain as perhaps I've done something wrong in the configuration I suspect this is a bug. When using the recent-posts modular the dates of the articles on the modular page for each article appears to be showing the date of the creation of the modular page rather than the date of the article.

For example: Within the blog pages I see my last three articles listed with the correct dates of June 18, June 15, and June 14, however on the modular recent-articles section all three most recent articles are listed with the date June 14, which was the day I created the recent-articles modular.

pmoreno-rodriguez commented 1 year ago

Hi @Zarius01

Thank you very much for reporting this bug. There is indeed an error in the lines of code in the recent-posts.html.twig file in the partials folder, specifically those that refer to datestamp:

{% if (page.header.publish_date) %}
             {% set datestamp = page.header.publish_date %}
         {% elseif (page.header.date) %}
             {% set datestamp = page.header.date %}
         {% else %}
             {% set datestamp = page.modified %}
         {% endif %}

Change page to p. And everything will work normally. It should be something like this:

{# Set page date stamp #}
         {% if (p.header.publish_date) %}
             {% set datestamp = p.header.publish_date %}
         {% elseif (p.header.date) %}
             {% set datestamp = p.header.date %}
         {% else %}
             {% set datestamp = p.modified %}
         {% endif %}

I'll upload a new version with this change and a few more, but in the meantime you can try what I suggest to see if it works.

Zarius01 commented 1 year ago

Hi @pmoreno-rodriguez ,

Thank you for looking into this issue. I tested your suggested fix and this appears to be working correctly. Thank you again for your assistance.