Skip to content

Commit

Permalink
Better headings on archive pages, refs #469
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jul 16, 2024
1 parent ff200b9 commit 13f4dcb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion blog/templatetags/blog_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ def blog_mixed_list(context, items):


@register.inclusion_tag("includes/blog_mixed_list.html", takes_context=True)
def blog_mixed_list_with_dates(context, items, year_headers=False, day_headers=False):
def blog_mixed_list_with_dates(context, items, year_headers=False, day_headers=False, day_links=False):
context.update(
{
"items": items,
"showdate": not day_headers,
"year_headers": year_headers,
"day_headers": day_headers,
"day_links": day_links,
}
)
return context
Expand Down
2 changes: 1 addition & 1 deletion templates/archive_day.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% block title %}Archive for {{ date|date:"l, jS F Y" }}{% endblock %}

{% block primary %}
<h2>{{ date|date:"l, jS F Y"}}</h2>
<h2 class="archive-h2">{{ date|date:"l, jS F Y"}}</h2>
{% load blog_tags %}
{% blog_mixed_list items %}

Expand Down
2 changes: 1 addition & 1 deletion templates/archive_month.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h2 class="archive-h2">{{ date|date:"F Y"}}</h2>

{% load blog_tags %}

{% blog_mixed_list_with_dates items day_headers=1 %}
{% blog_mixed_list_with_dates items day_headers=1 day_links=1 %}

{% include "_pagination.html" %}

Expand Down
4 changes: 2 additions & 2 deletions templates/archive_year.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
{% block title %}Archive for {{ year }}{% endblock %}

{% block primary %}
<div class="entry">
<h2>Archive for {{ year }}</h2>
<h2 class="archive-h2">Archive for {{ year }}</h2>

<div class="entry">
<ul>
{% for month in months %}
<li><strong><a href="/{{ year }}/{{ month.date|date:"M" }}/">{{ month.date|date:"F" }}</a></strong> - {% for count in month.counts_not_0 %}{{ count.1 }} {% if count.0 == "entry" %}{{ count.1|pluralize:"entry,entries" }}{% else %}{{ count.0 }}{{ count.1|pluralize }}{% endif %}{% if not forloop.last %}, {% endif %}{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion templates/includes/blog_mixed_list.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load entry_tags %}{% load humanize %}
{% for item in items %}
{% if year_headers %}{% ifchanged item.obj.created.year %}<h3 class="blog-mixed-list-year">{{ item.obj.created.year }}</h3>{% endifchanged %}{% endif %}
{% if day_headers %}{% ifchanged item.obj.created.date %}<h3 class="blog-mixed-list-year">{{ item.obj.created.date }}</h3>{% endifchanged %}{% endif %}
{% if day_headers %}{% ifchanged item.obj.created.date %}<h3 class="blog-mixed-list-year">{% if day_links %}<a href="/{{ item.obj.created|date:"Y/M/j/" }}">{{ item.obj.created.date }}</a>{% else %}{{ item.obj.created.date }}{% endif %}</h3>{% endifchanged %}{% endif %}
{% if item.type == "photoset" %}
<div class="photoset segment">
<a class="primary" href="{{ item.obj.get_absolute_url }}"><img class="primary" src="{{ item.obj.primary.url_s }}" alt="{{ item.obj.primary.title }}" width="75" height="75"></a>
Expand Down

0 comments on commit 13f4dcb

Please sign in to comment.