From c69ead8f97083d440fd6fd0e905576456df35021 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Mon, 22 May 2023 17:42:01 -0500 Subject: feat: implement project listing and taxonomies --- config.toml | 3 ++ content/posts/bees.md | 8 ++--- content/posts/yubikey.md | 1 + content/projects/_index.md | 8 +++++ content/projects/projectr.md | 15 +++++++++ sass/style.scss | 35 ++++++++++---------- templates/index.html | 29 ++++++++++------- templates/macros.html | 74 ++++++++++++++++++++++++++++-------------- templates/post.html | 3 +- templates/section.html | 4 +-- templates/taxonomy_list.html | 16 +++++++++ templates/taxonomy_single.html | 15 +++++++++ 12 files changed, 150 insertions(+), 61 deletions(-) create mode 100644 content/projects/_index.md create mode 100644 content/projects/projectr.md create mode 100644 templates/taxonomy_list.html create mode 100644 templates/taxonomy_single.html diff --git a/config.toml b/config.toml index 966ef9e..eefc5f3 100644 --- a/config.toml +++ b/config.toml @@ -4,6 +4,9 @@ compile_sass = true minify_html = true generate_feed = true +[[taxonomies]] +name = "tags" + [markdown] highlight_code = true highlight_theme = "css" diff --git a/content/posts/bees.md b/content/posts/bees.md index 329318d..7e320dd 100644 --- a/content/posts/bees.md +++ b/content/posts/bees.md @@ -1,10 +1,10 @@ +++ title = "Bees" date = 2023-05-17 +description = "Bees, what are they even about" +authors = ["Toby Vincent"] +++ -## Bees, what are they even about - -What makes a bee a bee. Is it the yellow parts? Are there any non yellow bees? I +What makes a bee a bee? Is it the yellow parts? Are there any non yellow bees? I bet there are, we just probably don't recognize them because they are not -yellow. +yellow. diff --git a/content/posts/yubikey.md b/content/posts/yubikey.md index b06adc2..0ba41d8 100644 --- a/content/posts/yubikey.md +++ b/content/posts/yubikey.md @@ -2,6 +2,7 @@ title = "WSL2, Yubikey, and You! 🫵" description = "A WSL2 YubiKey setup guide." date = 2022-08-04T18:57:50Z +authors = ["Toby Vincent"] +++ ## UPDATE 2022-8-24 diff --git a/content/projects/_index.md b/content/projects/_index.md new file mode 100644 index 0000000..29776f9 --- /dev/null +++ b/content/projects/_index.md @@ -0,0 +1,8 @@ ++++ +title = "Code" +sort_by = "weight" ++++ + +An exhastive list of my projects can be found on +[SourceHut](https://git.sr.ht/~tobyvin/) and +[GitHub](https://github.com/tobyvin) diff --git a/content/projects/projectr.md b/content/projects/projectr.md new file mode 100644 index 0000000..dbf6bf3 --- /dev/null +++ b/content/projects/projectr.md @@ -0,0 +1,15 @@ ++++ +title = "projectr" +description = "A contextual, MRU sorted, project finder." +weight = 0 + +[taxonomies] +tags = ["rust"] + +[extra] +external = "https://sr.ht/~tobyvin/projectr/" ++++ + + + + diff --git a/sass/style.scss b/sass/style.scss index 58c8e05..db0d60c 100644 --- a/sass/style.scss +++ b/sass/style.scss @@ -118,32 +118,31 @@ body { } } - & > footer { - & > * { - display: inline; - } - - & > time { - text-decoration: underline; - } - } - & > nav { text-align: left; - font-size: 0.9rem; } } - & > ul > li > article > header > hgroup > :first-child a { - color: var(--blue); - text-decoration: none; + & > footer { + & > * { + display: inline; + } - &:hover { + & > time { text-decoration: underline; } - &:visited { - color: var(--blue-dim); - } + } + } + + li > article > header > hgroup > :first-child a { + color: var(--blue); + text-decoration: none; + + &:hover { + text-decoration: underline; + } + &:visited { + color: var(--blue-dim); } } diff --git a/templates/index.html b/templates/index.html index 40646eb..912787d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,15 +6,23 @@ - - {% set this = page | default(value=section) %} - {% set len = this.components | length %} - {%- if len > 0 -%} - {{ this.title }} - {{ config.title }} - {%- else -%} - {{ config.title }} - {%- endif -%} - + {% block title %} + + {%- if term -%} + {{ term.name }} - {{ config.title }} + {%- elif taxonomy -%} + {{ taxonomy.name }} - {{ config.title }} + {%- else -%} + {% set this = page | default(value=section) %} + {% set len = this.components | length %} + {%- if len > 0 -%} + {{ this.title }} - {{ config.title }} + {%- else -%} + {{ config.title }} + {%- endif -%} + {%- endif -%} + + {% endblock title %} {{ macros::nav_item(name=config.title, url=config.base_url) }} diff --git a/templates/macros.html b/templates/macros.html index 75425a2..23b5dbf 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -1,4 +1,4 @@ -{# vim: set ft=htmldjango: #} +{# misc macros #} {% macro nav_item(name, url) %} {% if page %} {% set curr_url = get_url(path=page.path) %} @@ -6,7 +6,9 @@ {% set curr_url = get_url(path=section.path) %} {% endif %} {% set url = url | trim_end_matches(pat="/") %} - {{ name }} + {% if curr_url %} + {{ name }} + {% endif %} {% endmacro nav %} {% macro toc_item(item, depth=0) %}
  • @@ -23,39 +25,63 @@ {% if len > 1 %} {% endif %} {% endmacro %} -{% if page.summary %} -

    {{ page.summary | safe }}

    - ... -{% endif %} -{% macro post_header(page_ref=false) %} - {% set page = page_ref | default(value=page) %} +{% macro header(item, full=false) %}

    - {%- if page_ref -%} - {{ page.title | safe }} + {% if full or not item.permalink %} + {{ item.title }} + {% elif item.extra.external %} + {{ item.title }} {% else %} - {{ page.title | safe }} - {%- endif -%} + {{ item.title }} + {% endif %}

    -

    {{ page.description | default(value="") | markdown(inline=true) | safe }}

    +

    {{ item.description }}

    + {% if item.taxonomies["tags"] %} + + {% endif %} +
    + {% if item.date or item.authors %}
    - Posted on - - by -
    +

    + Posted + {% if item.date %} + on + + {% endif %} + {% if item.authors %} +

    + by + {% for author in item.authors -%} + {% if author == config.extra.author %} + , + {% elif item.extra[author] %} + , + {% else %} + {{ author }} + {% endif %} + {% endfor %} +
    + {% endif %} +

    - - {% if not page_ref %} - {{ self::toc(toc=page.toc) }} - {% elif page.summary %} -

    {{ page.summary | safe }}

    - ... + {% endif %} + {% if full and item.toc %} + {{ macros::toc(toc=item.toc) }} + {% elif item.summary %} +

    {{ item.summary | safe }} ...

    {% endif %} {% endmacro %} diff --git a/templates/post.html b/templates/post.html index bda1e03..4381722 100644 --- a/templates/post.html +++ b/templates/post.html @@ -1,6 +1,5 @@ -{% import "macros.html" as macros %} {% extends "index.html" %} {% block content %} - {{ macros::post_header() }} + {{ macros::header(item=page, full=true) }} {{ page.content | safe }} {% endblock content %} diff --git a/templates/section.html b/templates/section.html index f83d0fd..aa120aa 100644 --- a/templates/section.html +++ b/templates/section.html @@ -2,9 +2,9 @@ {% block content %} {{ super() }} diff --git a/templates/taxonomy_list.html b/templates/taxonomy_list.html new file mode 100644 index 0000000..d3b611d --- /dev/null +++ b/templates/taxonomy_list.html @@ -0,0 +1,16 @@ +{% extends "index.html" %} +{% block content %} +
    +
    +

    {{ taxonomy.name }}

    +
    +
    + +{% endblock content %} diff --git a/templates/taxonomy_single.html b/templates/taxonomy_single.html new file mode 100644 index 0000000..09b20c4 --- /dev/null +++ b/templates/taxonomy_single.html @@ -0,0 +1,15 @@ +{% extends "index.html" %} +{% block content %} +
    +
    +

    {{ taxonomy.name }}::{{ term.name }}

    +
    +
    + +{% endblock content %} -- cgit v1.2.3-70-g09d2