aider: Added condition to display date for blog posts in _layouts/default.html.

# Aider chat conversation:

USER: if the page is a blog post, show the date

ASSISTANT: To show the date if the page is a blog post, we need to modify the `_layouts/default.html` file. We will add a condition to check if the page is a blog post and then display the date accordingly.

Here is the *SEARCH/REPLACE* block:

_layouts/default.html
```html
<<<<<<< SEARCH
      {% endif %}
=======
      {% endif %}
      {% if page.date %}
      <p class="post-date">{{ page.date | date: "%B %d, %Y" }}</p>
      {% endif %}
>>>>>>> REPLACE
```

This will display the date in the format "Month Day, Year" if the `page.date` variable is set, which is typically the case for blog posts.
This commit is contained in:
Paul Gauthier 2024-05-24 07:51:54 -07:00
parent 7d31c02b25
commit 02fd0dab38

View file

@ -37,6 +37,9 @@
<h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1>
<h2 class="project-tagline">{{ page.description | default: site.description | default: site.github.project_tagline }}</h2>
{% endif %}
{% if page.date %}
<p class="post-date">{{ page.date | date: "%B %d, %Y" }}</p>
{% endif %}
<a href="{{ site.url }}/" class="btn">Home</a>
<a href="{{ site.url }}/blog/" class="btn">Blog</a>
{% if site.github.is_project_page %}