Skip to content

Commit ba5d25c

Browse files
committedMar 20, 2018
Replace hard coded archive pages with new layouts
1 parent ffef5a9 commit ba5d25c

13 files changed

+59
-112
lines changed
 

‎docs/_docs/05-configuration.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -851,10 +851,10 @@ tag_archive:
851851

852852
Which would create category and tag links in the breadcrumbs and page meta like: `/categories/#foo` and `/tags/#foo`.
853853

854-
**Note:** these are simply hash (fragment) links into the full taxonomy index pages. For them to resolve properly, the category and tag index pages need to exist at [`/categories/index.html`](https://github.com/{{ site.repository }}/blob/master/docs/\_pages/category-archive.html) (copy to `_pages/category-archive.html`) and [`/tags/index.html`](https://github.com/{{ site.repository }}/blob/master/docs/\_pages/tag-archive.html) (copy to `_pages/tag-archive.html`).
854+
**Note:** these are simply hash (fragment) links into the full taxonomy index pages. For them to resolve properly, the category and tag index pages need to exist at [`/categories/index.html`](https://github.com/{{ site.repository }}/blob/master/docs/_pages/category-archive.md) (copy to `_pages/category-archive.md`) and [`/tags/index.html`](https://github.com/{{ site.repository }}/blob/master/docs/_pages/tag-archive.md) (copy to `_pages/tag-archive.md`).
855855
{: .notice--warning}
856856

857-
If you have the luxury of using Jekyll Plugins, then [**jekyll-archives**][jekyll-archives] will create a better experience as discrete taxonomy pages would be generated, and their corresponding links would be "real" (not just hash/fragment links into a larger index). However, the plugin will not generate the taxonomy index pages (`category-archive.html` and `_pages/tag-archive.html`) so you'd still need to manually create them if you'd like to have them (see note above).
857+
If you have the luxury of using Jekyll Plugins, then [**jekyll-archives**][jekyll-archives] will create a better experience as discrete taxonomy pages would be generated, and their corresponding links would be "real" (not just hash/fragment links into a larger index). However, the plugin will not generate the taxonomy index pages (`category-archive.md` and `tag-archive.md`) so you'd still need to manually create them if you'd like to have them (see note above).
858858

859859
First, you'll need to make sure that the `jekyll-archives` plugin is installed. Either run `gem install jekyll-archives` or add the following to your `Gemfile`:
860860

‎docs/_docs/10-layouts.md

+14-40
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ Below are sample archive pages you can easily drop into your project, taking car
142142
* [All Posts Grouped by Collection -- List View][posts-collection]
143143
* [Portfolio Collection -- Grid View][portfolio-collection]
144144

145-
[posts-categories]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/category-archive.html
146-
[posts-tags]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/tag-archive.html
147-
[posts-year]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/year-archive.html
145+
[posts-categories]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/category-archive.md
146+
[posts-tags]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/tag-archive.md
147+
[posts-year]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/year-archive.md
148148
[posts-collection]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/collection-archive.html
149-
[portfolio-collection]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/portfolio-archive.html
149+
[portfolio-collection]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/portfolio-archive.md
150150

151151
Post and page excerpts are auto-generated by Jekyll which grabs the first paragraph of text. To override this text with something more specific use the following YAML Front Matter:
152152

@@ -158,34 +158,18 @@ excerpt: "A unique line of text to describe this post that will display in an ar
158158

159159
Adding `type=grid` to the `archive-single` helper will display archive posts in a 4 column grid. For example to create an archive displaying all documents in the portfolio collection:
160160

161-
**Step 1:** Create a portfolio archive page (eg. `_pages/portfolio-archive.html`) with the following YAML Front Matter:
161+
Create a portfolio archive page (eg. `_pages/portfolio-archive.md`) with the following YAML Front Matter:
162162

163163
```yaml
164164
---
165-
layout: archive
166-
title: "Portfolio"
165+
title: Portfolio
166+
layout: collection
167167
permalink: /portfolio/
168-
author_profile: false
168+
collection: portfolio
169+
entries_layout: grid
169170
---
170171
```
171172

172-
**Step 2:** Loop over all documents in the portfolio collection and output in a grid:
173-
174-
```html
175-
{% raw %}<div class="grid__wrapper">
176-
{% for post in site.portfolio %}
177-
{% include archive-single.html type="grid" %}
178-
{% endfor %}{% endraw %}
179-
</div>
180-
```
181-
182-
To produce something like this:
183-
184-
<figure>
185-
<img src="{{ '/assets/images/mm-archive-grid-view-example.jpg' | absolute_url }}" alt="archive grid view example">
186-
<figcaption>Grid view example.</figcaption>
187-
</figure>
188-
189173
Teaser images are assigned similar to header images using the following YAML Front Matter:
190174

191175
```yaml
@@ -202,32 +186,22 @@ If you have the luxury of using Jekyll plugins, the creation of category and tag
202186

203187
![archive taxonomy layout example]({{ "/assets/images/mm-layout-archive-taxonomy.png" | absolute_url }})
204188

205-
If you're not using the `jekyll-archives` plugin then you need to create archive pages yourself. Sample taxonomy archives can be found by grabbing the HTML sources below and adding to your site.
189+
If you're not using the `jekyll-archives` plugin then you need to create archive pages yourself. Sample taxonomy archives can be found by grabbing the Markdown sources below and adding to your site.
206190

207191
| Name | HTML Source |
208192
| -------------------- | --- |
209-
| [Categories Archive](https://mmistakes.github.io/minimal-mistakes/categories/) | [category-archive.html](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/category-archive.html) |
210-
| [Tags Archive](https://mmistakes.github.io/minimal-mistakes/tags/) | [tag-archive.html](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/tag-archive.html) |
193+
| [Categories Archive](https://mmistakes.github.io/minimal-mistakes/categories/) | [category-archive.md](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/category-archive.md) |
194+
| [Tags Archive](https://mmistakes.github.io/minimal-mistakes/tags/) | [tag-archive.md](https://github.com/mmistakes/minimal-mistakes/blob/master/docs/_pages/tag-archive.md) |
211195

212196
The **Tags Archive** page that responds to urls such as `/tags/#tips` looks something like this:
213197

214198
```html
215199
---
216-
layout: archive
217-
permalink: /tags/
218200
title: "Posts by Tag"
201+
layout: tags
202+
permalink: /tags/
219203
author_profile: true
220204
---
221-
222-
{% raw %}{% include group-by-array collection=site.posts field="tags" %}
223-
224-
{% for tag in group_names %}
225-
{% assign posts = group_items[forloop.index0] %}
226-
<h2 id="{{ tag | slugify }}" class="archive__subtitle">{{ tag }}</h2>
227-
{% for post in posts %}
228-
{% include archive-single.html %}
229-
{% endfor %}
230-
{% endfor %}{% endraw %}
231205
```
232206

233207
## Home Page Layout

‎docs/_docs/14-helpers.md

-12
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,6 @@ Instead of repeating `{% raw %}{{ site.url }}{{ site.baseurl }}{% endraw %}` ove
5353

5454
A liquid include file for Jekyll that allows an object to be grouped by an array.
5555

56-
The Liquid based taxonomy archives found amongst the demo pages rely on this helper.
57-
58-
| Description | | |
59-
| ----------- | ------------------------ | --------------------------- |
60-
| All posts grouped by category | [Source][category-array] | [Demo][category-array-demo] |
61-
| All posts grouped by tag | [Source][tag-array] | [Demo][tag-array-demo] |
62-
63-
[category-array]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/category-archive.html
64-
[category-array-demo]: {{ "/categories/" | absolute_url }}
65-
[tag-array]: https://github.com/{{ site.repository }}/blob/master/docs/_pages/tag-archive.html
66-
[tag-array-demo]: {{ "/tags/" | absolute_url }}
67-
6856
## Figure
6957

7058
Generate a `<figure>` element with a single image and caption.

‎test/_pages/category-archive.html

-16
This file was deleted.

‎test/_pages/category-archive.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "Posts by Category"
3+
layout: categories
4+
permalink: /categories-archive/
5+
author_profile: true
6+
---

‎test/_pages/edge-case.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Edge Case
3+
layout: category
4+
permalink: /categories/edge-case/
5+
taxonomy: Edge Case
6+
---
7+
8+
Sample post listing for the category `Edge Case`.

‎test/_pages/markup.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Markup
3+
layout: tag
4+
permalink: /tags/markup/
5+
taxonomy: markup
6+
---
7+
8+
Sample post listing for the tag `markup`.

‎test/_pages/portfolio-archive.html

-12
This file was deleted.

‎test/_pages/portfolio-archive.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Portfolio
3+
layout: collection
4+
permalink: /portfolio/
5+
collection: portfolio
6+
entries_layout: grid
7+
---
8+
9+
Sample document listing for the collection `_portfolio`.

‎test/_pages/tag-archive.html

-16
This file was deleted.

‎test/_pages/tag-archive.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "Posts by Tag"
3+
permalink: /tags-archive/
4+
layout: tags
5+
author_profile: true
6+
---

‎test/_pages/year-archive.html

-14
This file was deleted.

‎test/_pages/year-archive.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "Posts by Year"
3+
permalink: /year-archive/
4+
layout: posts
5+
author_profile: true
6+
---

0 commit comments

Comments
 (0)
Please sign in to comment.