From 910c22d071e0f2c0748f172b7318147e8a45201f Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Sat, 23 Jan 2021 17:55:19 -0600 Subject: tags --- build.py | 20 ++++++++++++++++++++ posts/bluesky-for-the-rest-of-us.md | 2 ++ posts/daq.md | 1 + posts/gui.md | 1 + posts/meta.md | 1 + posts/open-hardware.md | 1 + posts/plotting.md | 1 + posts/releasing-pypi-gitlab.md | 1 + templates/index.html | 6 ++++-- templates/tags.html | 30 ++++++++++++++++++++++++++++++ 10 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 templates/tags.html diff --git a/build.py b/build.py index 6505dbb..3b53963 100755 --- a/build.py +++ b/build.py @@ -28,9 +28,11 @@ class Post: date: str content: str path: str + tags: list posts = [] +tags = [] for post in os.listdir(__here__ / "posts"): if len(post) < 3: continue @@ -43,10 +45,15 @@ for post in os.listdir(__here__ / "posts"): kwargs["date"] = md.Meta["date"][0] kwargs["content"] = content kwargs["path"] = post[:-3] + kwargs["tags"] = md.Meta.get("tags", [""])[0].split() + tags += kwargs["tags"] posts.append(Post(**kwargs)) posts.sort(key=lambda p: p.date, reverse=True) +tags = list(set(tags)) +tags.sort() + # index ------------------------------------------------------------------------------------------- @@ -75,6 +82,19 @@ for post in posts: f.write(template.render(post=post, title=post.title, date=date)) +# tags -------------------------------------------------------------------------------------------- + + + +template = env.get_template("tags.html") +if not os.path.isdir(__here__ / "public" / "tags"): + os.mkdir(__here__ / "public" / "tags") +with open(__here__ / "public" / "tags" / "index.html", "w") as f: + f.write(template.render(posts=posts, tags=tags, title="tags", date=date)) + + + + # css --------------------------------------------------------------------------------------------- diff --git a/posts/bluesky-for-the-rest-of-us.md b/posts/bluesky-for-the-rest-of-us.md index 02d347a..8a666ab 100644 --- a/posts/bluesky-for-the-rest-of-us.md +++ b/posts/bluesky-for-the-rest-of-us.md @@ -1,6 +1,8 @@ title: bluesky-for-the-rest-of-us date: 2020-11-06 +This is a work-in-progress post. + [Bluesky](https://blueskyproject.io/) is an awesome Python package for hardware orchestration. Really, it's amazing. It's an abstraction layer allowing scientists to easily define and carry out almost any experiment. diff --git a/posts/daq.md b/posts/daq.md index fe05e8c..faa1f31 100644 --- a/posts/daq.md +++ b/posts/daq.md @@ -1,5 +1,6 @@ title: data acquisition hardware date: 2020-04-12 +tags: instrumental This post is a roundup of data acquisition hardware that I want to keep track of. This includes both analog-to-digital, digital-to-analog, and multifunction. diff --git a/posts/gui.md b/posts/gui.md index 8d08568..e8015bf 100644 --- a/posts/gui.md +++ b/posts/gui.md @@ -1,5 +1,6 @@ title: graphical user interface date: 2020-05-23 +tags: instrumental python This is a roundup post of links to graphical user interface projects that I find relevant. diff --git a/posts/meta.md b/posts/meta.md index 0e5bcb8..65534ca 100644 --- a/posts/meta.md +++ b/posts/meta.md @@ -1,5 +1,6 @@ title: meta date: 2020-04-11 +tags: meta What is a "blog" to me, and why have I decided to create one? What technologies enable this blog? diff --git a/posts/open-hardware.md b/posts/open-hardware.md index 7fcbc14..0331636 100644 --- a/posts/open-hardware.md +++ b/posts/open-hardware.md @@ -1,5 +1,6 @@ title: open hardware date: 2020-05-23 +tags: instrumental This post is a roundup of open source hardware projects that I find relevant. diff --git a/posts/plotting.md b/posts/plotting.md index 0e5d870..5acdc19 100644 --- a/posts/plotting.md +++ b/posts/plotting.md @@ -1,5 +1,6 @@ title: plotting scientific data date: 2020-05-23 +tags: instrumental python This post is a roundup of interesting ideas about plotting scientific data. diff --git a/posts/releasing-pypi-gitlab.md b/posts/releasing-pypi-gitlab.md index db0cc70..c40372b 100644 --- a/posts/releasing-pypi-gitlab.md +++ b/posts/releasing-pypi-gitlab.md @@ -1,5 +1,6 @@ title: releasing: gitlab to pypi date: 2020-05-17 +tags: python This post contains my notes for how I release a Python project from GitLab to PyPI. I love hosting projects on GitLab since I can use the built-in runners to release automatically. diff --git a/templates/index.html b/templates/index.html index 7a74e3c..554d418 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,16 +9,18 @@

Welcome to my personal blog!
This page lists my blog entries in reverse chronological order.
-You may also browse by tag (coming soon).
+You may also browse by tag.
You may be interested in my meta post.
Thanks for stopping by! —Blaise

-

{% for post in posts %} {{ post.date }} {{ post.title }} + {% for tag in post.tags %} + #{{ tag }} + {% endfor %}
{% endfor %}

diff --git a/templates/tags.html b/templates/tags.html new file mode 100644 index 0000000..e788ce5 --- /dev/null +++ b/templates/tags.html @@ -0,0 +1,30 @@ +{% include "header.html" %} + +

+blaise-blog/tags +

+ +
+ +{% for tag in tags %} + +

{{ tag }}

+ +

+{% for post in posts %} + {% if tag in post.tags %} + {{ post.date }} + {{ post.title }} + {% for tag_ in post.tags %} + {% if tag_ != tag %} + #{{ tag_ }} + {% endif %} + {% endfor %} +
+ {% endif %} +{% endfor %} +

+ +{% endfor %} + +{% include "footer.html" %} -- cgit v1.2.3