Add generated tag pages

Whenever new tags are added, the generate-tags script must be run and new tag
page stubs committed

Fixes #44
This commit is contained in:
R Tyler Croy 2020-03-21 13:02:18 -07:00
parent b6c7b874d6
commit 1841dfc232
No known key found for this signature in database
GPG Key ID: E5C92681BEF6CEA2
48 changed files with 319 additions and 3 deletions

View File

@ -4,7 +4,7 @@
<ul class="post-sidebar__tag-list">
<li class="post-sidebar__tag-label fw-bold">Tag {%- if page.tags.size > 1 -%}s{%- endif -%}: </li>
{% for tag in page.tags %}
<li class="post-sidebar__tags">{{ tag }}</li>
<li class="post-sidebar__tags"><a href="/tag/{{ tag }}/">{{ tag }}</a></li>
{% endfor %}
</ul>
{%- endif -%}

View File

@ -2,8 +2,10 @@
layout: default
---
<!-- Featured post hero -->
{% include featured-post-hero.html %}
{% unless page.url contains 'tag' %}
<!-- Featured post hero -->
{% include featured-post-hero.html %}
{% endunless %}
<div class="post-index" id="{{ site.post-id | remove: "#" }}">

10
_layouts/tag_page.html Normal file
View File

@ -0,0 +1,10 @@
---
layout: post-index
title: page.tag
---
<ul class="post-list text-length-lg">
{% for post in site.tags[page.tag] %}
{% include post-list-item.html %}
{% endfor %}
</ul>

40
generate-tags Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env python
import glob
import os
import re
post_dir = '_posts/'
tag_dir = 'tag/'
total_tags = []
for filename in glob.glob(post_dir + '*.md'):
matcher = r'^tags:$'
with open(filename, 'r') as fd:
tagged_line = False
for line in fd.xreadlines():
if tagged_line:
if line.startswith('---'):
tagged_line = False
elif not line.startswith('-'):
tagged_line = False
else:
total_tags.append(line[1:].strip())
if re.match(matcher, line):
tagged_line = True
total_tags = set(total_tags)
for tag in glob.glob(tag_dir + '*.md'):
os.remove(tag)
if not os.path.exists(tag_dir):
os.makedirs(tag_dir)
for tag in total_tags:
td = os.path.sep.join([tag_dir, tag])
if not os.path.exists(td):
os.makedirs(td)
with open(os.path.sep.join([td, 'index.md']), 'w+') as fd:
fd.write('---\nlayout: tag_page\ntitle: \"Tag: ' + tag + '\"\ntag: ' + tag + '\nrobots: noindex\n---\n')
print("Tags generated, count", total_tags.__len__())

6
tag/2020/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: 2020"
tag: 2020
robots: noindex
---

6
tag/abstraction/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: abstraction"
tag: abstraction
robots: noindex
---

View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: accessibility"
tag: accessibility
robots: noindex
---

View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: airflow-series"
tag: airflow-series
robots: noindex
---

6
tag/airflow/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: airflow"
tag: airflow
robots: noindex
---

6
tag/aws/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: aws"
tag: aws
robots: noindex
---

6
tag/data/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: data"
tag: data
robots: noindex
---

6
tag/dataeng/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: dataeng"
tag: dataeng
robots: noindex
---

6
tag/datapipe/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: datapipe"
tag: datapipe
robots: noindex
---

View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: dependency injection"
tag: dependency injection
robots: noindex
---

6
tag/design/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: design"
tag: design
robots: noindex
---

6
tag/di-series/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: di-series"
tag: di-series
robots: noindex
---

6
tag/docker/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: docker"
tag: docker
robots: noindex
---

6
tag/ecr/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: ecr"
tag: ecr
robots: noindex
---

6
tag/featured/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: featured"
tag: featured
robots: noindex
---

6
tag/frontend/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: frontend"
tag: frontend
robots: noindex
---

6
tag/iam/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: iam"
tag: iam
robots: noindex
---

View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: incident response"
tag: incident response
robots: noindex
---

6
tag/kafka/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: kafka"
tag: kafka
robots: noindex
---

6
tag/lc-series/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: lc-series"
tag: lc-series
robots: noindex
---

View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: live-collections"
tag: live-collections
robots: noindex
---

6
tag/ltr/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: ltr"
tag: ltr
robots: noindex
---

View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: machinelearning"
tag: machinelearning
robots: noindex
---

6
tag/meetup/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: meetup"
tag: meetup
robots: noindex
---

View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: ml-platform-series"
tag: ml-platform-series
robots: noindex
---

6
tag/mlflow/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: mlflow"
tag: mlflow
robots: noindex
---

6
tag/msk-series/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: msk-series"
tag: msk-series
robots: noindex
---

6
tag/msk/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: msk"
tag: msk
robots: noindex
---

6
tag/oncall/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: oncall"
tag: oncall
robots: noindex
---

6
tag/pagerduty/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: pagerduty"
tag: pagerduty
robots: noindex
---

6
tag/pytorch/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: pytorch"
tag: pytorch
robots: noindex
---

6
tag/react/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: react"
tag: react
robots: noindex
---

6
tag/remote/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: remote"
tag: remote
robots: noindex
---

6
tag/scribd/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: scribd"
tag: scribd
robots: noindex
---

6
tag/search/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: search"
tag: search
robots: noindex
---

6
tag/security/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: security"
tag: security
robots: noindex
---

6
tag/seo/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: seo"
tag: seo
robots: noindex
---

6
tag/seq2seq/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: seq2seq"
tag: seq2seq
robots: noindex
---

6
tag/spark/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: spark"
tag: spark
robots: noindex
---

6
tag/swift/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: swift"
tag: swift
robots: noindex
---

6
tag/testing/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: testing"
tag: testing
robots: noindex
---

6
tag/toronto/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: toronto"
tag: toronto
robots: noindex
---

6
tag/weaver/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: weaver"
tag: weaver
robots: noindex
---

6
tag/webpack/index.md Normal file
View File

@ -0,0 +1,6 @@
---
layout: tag_page
title: "Tag: webpack"
tag: webpack
robots: noindex
---