git ssb

0+

Grey the earthling / gkn.me.uk



Commit d3e4419ce813e12642c2f439ea85de6fe42cb137

Reorder nearby to next, prev, up

I want to keep Up separate,
because it leads to a different type of page from the other 2.

Next is first because I think it's the most useful:
this follows the original reading order.
Greg K Nicholson committed on 2/16/2018, 7:31:52 PM
Parent: dfa263b68c7644035d15afa896a0b04e59f2a3f5

Files changed

themes/ran/templates/article.htmlchanged
themes/ran/templates/period_archives.htmlchanged
themes/ran/templates/tag.htmlchanged
themes/ran/templates/article.htmlView
@@ -154,8 +154,16 @@
154154 <hr class="visuallyhidden">
155155 {%- endif -%}
156156 <nav class="nearby">
157157 <ul>
158 + {%- if article.next_article -%}
159 + <li class="next">
160 + <a href="/{{- article.next_article.url -}}" rel="next">
161 + <span></span>
162 + {{- article.next_article.title | trim -}}
163 + </a>
164 + </li>
165 + {%- endif -%}
158166 {%- if article.prev_article -%}
159167 <li class="prev">
160168 <a href="/{{- article.prev_article.url -}}" rel="prev">
161169 <span></span>
@@ -168,16 +176,8 @@
168176 <span></span>
169177 {{- article.date | strftime(DATE_FORMAT_DAY) -}}
170178 </a>
171179 </li>
172- {%- if article.next_article -%}
173- <li class="next">
174- <a href="/{{- article.next_article.url -}}" rel="next">
175- <span></span>
176- {{- article.next_article.title | trim -}}
177- </a>
178- </li>
179- {%- endif -%}
180180 </ul>
181181 </nav>
182182 {{- super() -}}
183183 {%- endblock -%}
themes/ran/templates/period_archives.htmlView
@@ -58,8 +58,52 @@
5858 {%- block maincontent -%}
5959 <nav class="nearby">
6060 <ul>
6161 {%- for article in articles |
62 + selectattr("date", "greaterthan", dates[0].date) |
63 + reverse -%}
64 + {%- if loop.index == 1 -%}
65 + {%- if period | length == 1 -%}
66 + <li class="next">
67 + <a href="/{{- article.date | strftime('%Y') -}}"
68 + rel="next">
69 + <span></span>
70 + <time datetime="{{- article.date |
71 + strftime('%Y') -}}">
72 + {{- article.date |
73 + strftime(DATE_FORMAT_YEAR) -}}
74 + </time>
75 + </a>
76 + </li>
77 + {%- elif period | length == 2 -%}
78 + <li class="next">
79 + <a href="/{{- article.date | strftime('%Y/%m') -}}"
80 + rel="next">
81 + <span></span>
82 + <time datetime="{{- article.date |
83 + strftime('%Y-%m') -}}">
84 + {{- article.date |
85 + strftime(DATE_FORMAT_MONTH) -}}
86 + </time>
87 + </a>
88 + </li>
89 + {%- else -%}
90 + <li class="next">
91 + <a href="/{{- article.date |
92 + strftime('%Y/%m/%d') -}}"
93 + rel="next">
94 + <span></span>
95 + <time datetime="{{- article.date |
96 + strftime('%Y-%m-%d') -}}">
97 + {{- article.date |
98 + strftime(DATE_FORMAT_DAY) -}}
99 + </time>
100 + </a>
101 + </li>
102 + {%- endif -%}
103 + {%- endif -%}
104 + {%- endfor -%}
105 + {%- for article in articles |
62106 selectattr("date", "lessthan",
63107 dates[ dates | length - 1].date) -%}
64108 {%- if loop.index == 1 -%}
65109 {%- if period | length == 1 -%}
@@ -129,52 +173,8 @@
129173 </time>
130174 </a>
131175 </li>
132176 {%- endif -%}
133- {%- for article in articles |
134- selectattr("date", "greaterthan", dates[0].date) |
135- reverse -%}
136- {%- if loop.index == 1 -%}
137- {%- if period | length == 1 -%}
138- <li class="next">
139- <a href="/{{- article.date | strftime('%Y') -}}"
140- rel="next">
141- <span></span>
142- <time datetime="{{- article.date |
143- strftime('%Y') -}}">
144- {{- article.date |
145- strftime(DATE_FORMAT_YEAR) -}}
146- </time>
147- </a>
148- </li>
149- {%- elif period | length == 2 -%}
150- <li class="next">
151- <a href="/{{- article.date | strftime('%Y/%m') -}}"
152- rel="next">
153- <span></span>
154- <time datetime="{{- article.date |
155- strftime('%Y-%m') -}}">
156- {{- article.date |
157- strftime(DATE_FORMAT_MONTH) -}}
158- </time>
159- </a>
160- </li>
161- {%- else -%}
162- <li class="next">
163- <a href="/{{- article.date |
164- strftime('%Y/%m/%d') -}}"
165- rel="next">
166- <span></span>
167- <time datetime="{{- article.date |
168- strftime('%Y-%m-%d') -}}">
169- {{- article.date |
170- strftime(DATE_FORMAT_DAY) -}}
171- </time>
172- </a>
173- </li>
174- {%- endif -%}
175- {%- endif -%}
176- {%- endfor -%}
177177 </ul>
178178 </nav>
179179 <hr class="visuallyhidden">
180180 {{- super() -}}
themes/ran/templates/tag.htmlView
@@ -9,11 +9,23 @@
99 {% endblock %}
1010 {% block maincontent %}
1111 <nav class="nearby">
1212 <ul>
13 + {%- for othertag, otherarticles in tags | sort if
14 + othertag.slug > tag.slug and
15 + otherarticles | list | length > 1 -%}
16 + {%- if loop.index == 1 %}
17 + <li class="next">
18 + <a href="/entries/{{- othertag.slug -}}" rel="next">
19 + <span></span>
20 + {{- othertag -}}
21 + </a>
22 + </li>
23 + {%- endif -%}
24 + {%- endfor -%}
1325 {%- for othertag, otherarticles in tags | sort | reverse if
14- othertag.slug < tag.slug and
15- otherarticles | list | length > 1 -%}
26 + othertag.slug < tag.slug and
27 + otherarticles | list | length > 1 -%}
1628 {%- if loop.index == 1 -%}
1729 <li class="prev">
1830 <a href="/entries/{{- othertag.slug -}}" rel="prev">
1931 <span></span>
@@ -27,20 +39,8 @@
2739 <span></span>
2840 {{- ARCHIVES_TITLE -}}
2941 </a>
3042 </li>
31- {%- for othertag, otherarticles in tags | sort if
32- othertag.slug > tag.slug and
33- otherarticles | list | length > 1 -%}
34- {%- if loop.index == 1 %}
35- <li class="next">
36- <a href="/entries/{{- othertag.slug -}}" rel="next">
37- <span></span>
38- {{- othertag -}}
39- </a>
40- </li>
41- {%- endif -%}
42- {%- endfor -%}
4343 </ul>
4444 </nav>
4545 <hr class="visuallyhidden">
4646 {{- super() -}}

Built with git-ssb-web