Browse code

Merge pull request #5 from Keats/v0.4

Update theme to gutenberg 0.4

Vincent Prouillet authored on 04/08/2018 03:56:56 • GitHub committed on 04/08/2018 03:56:56
Showing 10 changed files

... ...
@@ -30,6 +30,19 @@ paginate_by = 5
30 30
 
31 31
 The posts should therefore be in directly under the `content` folder.
32 32
 
33
+The theme requires tags and categories taxonomies to be enabled in your `config.toml`:
34
+
35
+```toml
36
+taxonomies = [
37
+    # You can enable/disable RSS
38
+    {name = "categories", rss = true},
39
+    {name = "tags", rss = true},
40
+]
41
+```
42
+If you want to paginate taxonomies pages, you will need to overwrite the templates
43
+as it only works for non-paginated taxonomies by default.
44
+
45
+
33 46
 ## Options
34 47
 
35 48
 ### Top-menu
... ...
@@ -3,8 +3,10 @@ compile_sass = true
3 3
 title = "after-dark theme"
4 4
 description = ""
5 5
 
6
-generate_tags_pages = true
7
-generate_categories_pages = true
6
+taxonomies = [
7
+    {name = "categories", rss = true},
8
+    {name = "tags", rss = true},
9
+]
8 10
 
9 11
 [extra]
10 12
 author = "Vincent"
... ...
@@ -1,7 +1,9 @@
1 1
 +++
2 2
 title = "What is Gutenberg"
3 3
 date = 2017-09-24
4
-category = "Hello world"
4
+
5
+[taxonomies]
6
+categories = ["Hello world"]
5 7
 +++
6 8
 
7 9
 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu feugiat sapien. Aenean ligula nunc, laoreet id sem in, interdum bibendum felis. Donec vel dui neque. Praesent ac sem ut justo volutpat rutrum a imperdiet tellus. Nam lobortis massa non hendrerit hendrerit. Vivamus porttitor dignissim turpis, eget aliquam urna tincidunt non. Aliquam et fringilla turpis. Nullam eros est, eleifend in ornare sed, hendrerit eget est. Aliquam tellus felis, suscipit vitae ex vel, fringilla tempus massa. Nulla facilisi. Pellentesque lobortis consequat lectus. Maecenas ac libero elit.
... ...
@@ -2,6 +2,8 @@
2 2
 title = "A first theme for Gutenberg"
3 3
 date = 2017-09-25
4 4
 category = "Prog"
5
+
6
+[taxonomies]
5 7
 tags = ["rust", "ssg", "other"]
6 8
 +++
7 9
 
8 10
similarity index 60%
9 11
rename from templates/categories.html
10 12
rename to templates/categories/list.html
... ...
@@ -7,11 +7,11 @@
7 7
 
8 8
     <h1>Categories</h1>
9 9
 
10
-    {% if categories %}
10
+    {% if terms %}
11 11
         <ul>
12
-            {% for category in categories %}
12
+            {% for term in terms %}
13 13
                 <li>
14
-                    <a href="{{ category.permalink }}">{{ category.name }}</a>({{ category.pages | length }})
14
+                    <a href="{{ term.permalink }}">{{ term.name }}</a>({{ term.pages | length }})
15 15
                 </li>
16 16
             {% endfor %}
17 17
         </ul>
18 18
similarity index 78%
19 19
rename from templates/category.html
20 20
rename to templates/categories/single.html
... ...
@@ -6,9 +6,9 @@
6 6
         {{ super() }}
7 7
     {% endblock header %}
8 8
 
9
-    <h1>{{ category.name }}</h1>
9
+    <h1>{{ term.name }}</h1>
10 10
 
11
-    {% for page in category.pages %}
11
+    {% for page in term.pages %}
12 12
         {{ post_macros::page_in_list(page=page) }}
13 13
     {% endfor %}
14 14
 {% endblock content %}
... ...
@@ -19,16 +19,17 @@
19 19
                 {% if config.extra.author %}
20 20
                     Published by {{ config.extra.author }}
21 21
                 {% endif %}
22
-                {% if page.category %}
23
-                    in <a href="{{ get_taxonomy_url(kind="category", name=page.category) }}">{{ page.category }}</a>
22
+                {% if page.taxonomies.categories %}
23
+                    {% set category = page.taxonomies.categories[0] %}
24
+                    in <a href="{{ get_taxonomy_url(kind="categories", name=category) }}">{{ category }}</a>
24 25
                 {% endif %}
25
-                {% if page.tags %}
26
+                {% if page.taxonomies.tags %}
26 27
                     and tagged
27
-                    {% for tag in page.tags %}
28
-                        <a href="{{ get_taxonomy_url(kind="tag", name=tag) }}">{{ tag }}</a>
29
-                        {% if page.tags | length > 1 %}
30
-                            {% if loop.index != page.tags | length %}
31
-                                {% if loop.index == page.tags | length - 1 %}
28
+                    {% for tag in page.taxonomies.tags %}
29
+                        <a href="{{ get_taxonomy_url(kind="tags", name=tag) }}">{{ tag }}</a>
30
+                        {% if page.taxonomies.tags | length > 1 %}
31
+                            {% if loop.index != page.taxonomies.tags | length %}
32
+                                {% if loop.index == page.taxonomies.tags | length - 1 %}
32 33
                                     and
33 34
                                 {% else %}
34 35
                                     ,
35 36
similarity index 59%
36 37
rename from templates/tags.html
37 38
rename to templates/tags/list.html
... ...
@@ -7,10 +7,10 @@
7 7
 
8 8
     <h1>Tags</h1>
9 9
 
10
-    {% if tags %}
10
+    {% if terms %}
11 11
         <ul>
12
-            {% for tag in tags %}
13
-                <li><a href="{{ tag.permalink }}">{{ tag.name }}</a> ({{ tag.pages | length }})</li>
12
+            {% for term in terms %}
13
+                <li><a href="{{ term.permalink }}">{{ term.name }}</a> ({{ term.pages | length }})</li>
14 14
             {% endfor %}
15 15
         </ul>
16 16
     {% endif %}
17 17
similarity index 77%
18 18
rename from templates/tag.html
19 19
rename to templates/tags/single.html
... ...
@@ -5,9 +5,9 @@
5 5
         {{ super() }}
6 6
     {% endblock header %}
7 7
 
8
-    <h1>{{ tag.name }}</h1>
8
+    <h1>{{ term.name }}</h1>
9 9
 
10
-    {% for page in tag.pages %}
10
+    {% for page in term.pages %}
11 11
         {{ post_macros::page_in_list(page=page) }}
12 12
     {% endfor %}
13 13
 {% endblock content %}
... ...
@@ -2,7 +2,7 @@ name = "after-dark"
2 2
 description = "A robust, elegant dark theme"
3 3
 license = "MIT"
4 4
 homepage = "https://github.com/Keats/after-dark"
5
-min_version = "0.2"
5
+min_version = "0.4.0"
6 6
 
7 7
 [extra]
8 8
 
... ...
@@ -13,5 +13,5 @@ homepage = "https://vincent.is"
13 13
 
14 14
 [original]
15 15
 author =  "comfusion"
16
-homepage = "https://comfusion.github.io/after-dark/"
17
-repo = "https://github.com/comfusion/after-dark"
16
+homepage = "https://git.habd.as/comfusion/after-dark/"
17
+repo = "https://git.habd.as/comfusion/after-dark/"