Skip to content

Commit 2aa1c10

Browse files
Reorganize posts and projects so permalinks can be auto-generated
1 parent 3334ae7 commit 2aa1c10

19 files changed

+33
-44
lines changed

_config.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ links:
1818
# Used for Sitemap.xml and your RSS feed
1919
url: http://ianglen.me
2020

21-
permalink: /posts/:title/
21+
permalink: /:slug/
22+
23+
collections:
24+
posts:
25+
permalink: /projects/:categories/:slug/
26+
projects:
27+
output: true
28+
permalink: /projects/:slug/
2229

2330
defaults:
2431
-

_includes/project_posts.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% assign slug = page.title | slugify:default %}
2-
{% assign project_posts = site.posts | where:"category","project-post" | where:"project",slug %}
1+
{% assign slug = page.title | slugify %}
2+
{% assign project_posts = site.posts | where:"category",slug %}
33
{% for project_post in project_posts %}
44
<h1><a href="{{ project_post.url }}">{{ project_post.title }}</a></h1>
55
<time>{{ project_post.date | date: "%F" }}</time>

_posts/2013-05-19-Building a Quadcopter.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: Building a Quadcopter
3-
permalink: /projects/400mm-x-quadcopter/building-a-quadcopter/
4-
category: project-post
5-
project: 400mm-x-quadcopter
3+
category: 400mm-x-quadcopter
64
image: building-a-quadcopter.jpg
75
---
86

_posts/2014-01-02-Flashing Turnigy Multistar ESCs with Simonk.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: Flashing Turnigy Multistar ESCs with Simonk
3-
permalink: /projects/400mm-x-quadcopter/flashing-escs/
4-
category: project-post
5-
project: 400mm-x-quadcopter
3+
category: 400mm-x-quadcopter
64
image: flashing-escs.jpg
75
---
86

_posts/2015-08-21-Quadcopter Status Update.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: Quadcopter Status Update
3-
permalink: /projects/400mm-x-quadcopter/quadcopter-status-update/
4-
category: project-post
5-
project: 400mm-x-quadcopter
3+
category: 400mm-x-quadcopter
64
image: quadcopter-status-update.jpg
75
---
86

_posts/2016-01-05-Custom 350 H-Quad Frame.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: Custom 350 H-Quad Frame
3-
permalink: /projects/350mm-h-quadcopter/custom-350-h-quad-frame/
4-
category: project-post
5-
project: 350mm-h-quadcopter
3+
category: 350mm-h-quadcopter
64
image: custom-350-h-quad-frame.jpg
75
---
86

_posts/2017-02-27-Updated Frame Design.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: Updated Frame Design
3-
permalink: /projects/350mm-h-quadcopter/updated-frame-design/
4-
category: project-post
5-
project: 350mm-h-quadcopter
3+
category: 350mm-h-quadcopter
64
image: updated-frame-design.jpg
75
---
86

_posts/2013-05-19-400mm X Quadcopter.md _projects/2013-05-19-400mm X Quadcopter.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 400mm X Quadcopter
3-
permalink: /projects/400mm-x-quadcopter/
4-
category: project
53
image: 400mm-x-quadcopter.jpg
64
---
75

_posts/2015-04-23-Project Car - 3000GT VR-4.md _projects/2015-04-23-Project Car - 3000GT VR-4.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 1993 Mitsubishi 3000GT VR-4
3-
permalink: /projects/3000gt/
4-
category: project
53
image: 3000gt.jpg
64
---
75

_posts/2015-05-12-HHS Makerspace Sign.md _projects/2015-05-12-HHS Makerspace Sign.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: HHS Makerspace Sign
3-
permalink: /projects/hhs-makerspace-sign/
4-
category: project
53
image: hhs-makerspace-sign.jpg
64
---
75

_posts/2015-12-24-350mm-H-Quadcopter.md _projects/2015-12-24-350mm-H-Quadcopter.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 350mm H Quadcopter
3-
permalink: /projects/350mm-h-quadcopter/
4-
category: project
53
image: 350mm-h-quadcopter.jpg
64
---
75

_posts/2016-11-21-Spur.md _projects/2016-11-21-Spur.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: Spur
3-
permalink: /projects/spur/
4-
category: project
53
image: spur.jpg
64
---
75

_posts/2017-04-23-Bubble Tank.md _projects/2017-04-23-Bubble Tank.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: Bubble Tank
3-
permalink: /projects/bubble-tank/
4-
category: project
53
image: bubble-tank.jpg
64
---
75

_posts/2017-09-25-Litbit.md _projects/2017-09-25-Litbit.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: LitBit
3-
permalink: /projects/litbit/
4-
category: project
53
image: litbit.jpg
64
---
75

_posts/2018-02-17-Plane Bot.md _projects/2018-02-17-Plane Bot.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: Plane Bot
3-
permalink: /projects/plane-bot/
4-
category: project
53
image: plane-bot.jpg
64
---
75

_posts/2018-03-03-SecureDrawer.md _projects/2018-03-03-SecureDrawer.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: SecureDrawer
3-
permalink: /projects/securedrawer/
4-
category: project
53
image: securedrawer.jpg
64
---
75

_posts/2018-05-19-120mm-Micro Quad.md _projects/2018-05-19-120mm-Micro Quad.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 120mm Micro Quad
3-
permalink: /projects/120mm-micro-quad/
4-
category: project
53
image: 120mm-micro-quad.jpg
64
---
75

posts.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
2-
title: All Posts
3-
permalink: /posts/
2+
title: Posts
43
---
54

65
{% for post in site.posts %}

projects.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
---
22
title: Projects
3-
permalink: /projects/
43
---
54

6-
{% capture sorted_projects %}{% assign projects = site.posts | where:"category","project" %}{% for project in projects %}{% assign project_slug = project.title | slugify:default %}{% assign project_posts = site.posts | where:"category","project-post" | where:"project",project_slug %}{% assign total_project_posts = project_posts | size %}{% assign latest_date = project.date %}{% if total_project_posts > 0 %}{% assign latest_date = project_posts.first.date %}{% for project_post in project_posts %}{% if project_post.date > latest_date %}{% assign latest_date = project_post.date %}{% endif %}{% endfor %}{% endif %}{{ latest_date }}|{{ project.date }}|{{ project.title }}|{{ project.url }}|{{ project.excerpt }}{% if forloop.last != true %}^{% endif %}{% endfor %}{% endcapture %}{% assign sorted_projects = sorted_projects | split:"^" | sort | reverse %}
5+
{% capture sorted_projects %}
6+
{% for project in site.projects %}
7+
{% assign project_slug = project.title | slugify %}
8+
{% assign project_posts = site.posts | where:"category",project_slug %}
9+
{% assign total_project_posts = project_posts | size %}
10+
{% assign latest_date = project.date %}
11+
{% for project_post in project_posts %}
12+
{% if project_post.date > latest_date %}
13+
{% assign latest_date = project_post.date %}
14+
{% endif %}
15+
{% endfor %}
16+
{{ latest_date }}|{{ project.url }}|{{ project.title }}
17+
{% if forloop.last != true %}^{% endif %}
18+
{% endfor %}
19+
{% endcapture %}
20+
{% assign sorted_projects = sorted_projects | split:"^" | sort | reverse %}
721

822
{% for project in sorted_projects %}
923
{% assign project_items = project | split:"|" %}
1024
<article>
11-
<time>{{ project_items[0] | date: "%F" }}</time>
12-
<span><a href="{{ project_items[3] }}">{{ project_items[2] }}</a></span>
25+
<span><a href="{{ project_items[1] }}">{{ project_items[2] }}</a></span>
1326
</article>
1427
{% endfor %}

0 commit comments

Comments
 (0)