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.html | changed |
themes/ran/templates/period_archives.html | changed |
themes/ran/templates/tag.html | changed |
themes/ran/templates/article.html | ||
---|---|---|
@@ -154,8 +154,16 @@ | ||
154 | 154 … | <hr class="visuallyhidden"> |
155 | 155 … | {%- endif -%} |
156 | 156 … | <nav class="nearby"> |
157 | 157 … | <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 -%} | |
158 | 166 … | {%- if article.prev_article -%} |
159 | 167 … | <li class="prev"> |
160 | 168 … | <a href="/{{- article.prev_article.url -}}" rel="prev"> |
161 | 169 … | <span> ← </span> |
@@ -168,16 +176,8 @@ | ||
168 | 176 … | <span> ↑ </span> |
169 | 177 … | {{- article.date | strftime(DATE_FORMAT_DAY) -}} |
170 | 178 … | </a> |
171 | 179 … | </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 -%} | |
180 | 180 … | </ul> |
181 | 181 … | </nav> |
182 | 182 … | {{- super() -}} |
183 | 183 … | {%- endblock -%} |
themes/ran/templates/period_archives.html | ||
---|---|---|
@@ -58,8 +58,52 @@ | ||
58 | 58 … | {%- block maincontent -%} |
59 | 59 … | <nav class="nearby"> |
60 | 60 … | <ul> |
61 | 61 … | {%- 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 | | |
62 | 106 … | selectattr("date", "lessthan", |
63 | 107 … | dates[ dates | length - 1].date) -%} |
64 | 108 … | {%- if loop.index == 1 -%} |
65 | 109 … | {%- if period | length == 1 -%} |
@@ -129,52 +173,8 @@ | ||
129 | 173 … | </time> |
130 | 174 … | </a> |
131 | 175 … | </li> |
132 | 176 … | {%- 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 -%} | |
177 | 177 … | </ul> |
178 | 178 … | </nav> |
179 | 179 … | <hr class="visuallyhidden"> |
180 | 180 … | {{- super() -}} |
themes/ran/templates/tag.html | |||
---|---|---|---|
@@ -9,11 +9,23 @@ | |||
9 | 9 … | {% endblock %} | |
10 | 10 … | {% block maincontent %} | |
11 | 11 … | <nav class="nearby"> | |
12 | 12 … | <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 -%} | ||
13 | 25 … | {%- 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 -%} | ||
16 | 28 … | {%- if loop.index == 1 -%} | |
17 | 29 … | <li class="prev"> | |
18 | 30 … | <a href="/entries/{{- othertag.slug -}}" rel="prev"> | |
19 | 31 … | <span> ← </span> | |
@@ -27,20 +39,8 @@ | |||
27 | 39 … | <span> ↑ </span> | |
28 | 40 … | {{- ARCHIVES_TITLE -}} | |
29 | 41 … | </a> | |
30 | 42 … | </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 -%} | ||
43 | 43 … | </ul> | |
44 | 44 … | </nav> | |
45 | 45 … | <hr class="visuallyhidden"> | |
46 | 46 … | {{- super() -}} |
Built with git-ssb-web