summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2023-05-22 17:42:01 -0500
committerToby Vincent <tobyv13@gmail.com>2023-05-22 17:44:21 -0500
commitc69ead8f97083d440fd6fd0e905576456df35021 (patch)
tree0700414f27b566ebb4e2498a261e4768188df001
parent2fffcb67e641688a48f5b82fea066cf52b254148 (diff)
feat: implement project listing and taxonomiesdevelop
-rw-r--r--config.toml3
-rw-r--r--content/posts/bees.md8
-rw-r--r--content/posts/yubikey.md1
-rw-r--r--content/projects/_index.md8
-rw-r--r--content/projects/projectr.md15
-rw-r--r--sass/style.scss35
-rw-r--r--templates/index.html29
-rw-r--r--templates/macros.html74
-rw-r--r--templates/post.html3
-rw-r--r--templates/section.html4
-rw-r--r--templates/taxonomy_list.html16
-rw-r--r--templates/taxonomy_single.html15
12 files changed, 150 insertions, 61 deletions
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. <!-- more -->
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/"
++++
+
+<!-- Project discovery tool that produces a MRU sorted list of project -->
+<!-- directories using provided contexts and filters. -->
+<!-- more -->
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 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex" />
- <title>
- {% set this = page | default(value=section) %}
- {% set len = this.components | length %}
- {%- if len > 0 -%}
- {{ this.title }} - {{ config.title }}
- {%- else -%}
- {{ config.title }}
- {%- endif -%}
- </title>
+ {% block title %}
+ <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 -%}
+ </title>
+ {% endblock title %}
<meta name="description" content="{{ config.description }}" />
<meta name="keywords" content="blog" />
<link rel="alternate"
@@ -29,8 +37,7 @@
<span>{{ macros::nav_item(name=config.title, url=config.base_url) }}</span>
<ul>
<li>{{ macros::nav_item(name="About",url=get_url(path="@/about.md") ) }}</li>
- <li>{{ macros::nav_item(name="Projects",url="https://sr.ht/~tobyvin") }}</li>
- <li>{{ macros::nav_item(name="Dotfiles",url="https://git.sr.ht/~tobyvin/.dotfiles") }}</li>
+ <li>{{ macros::nav_item(name="Code",url=get_url(path="@/projects/_index.md") ) }}</li>
<li>{{ macros::nav_item(name="Posts",url=get_url(path="@/posts/_index.md") ) }}</li>
</ul>
</nav>
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="/") %}
- <a {% if curr_url == url %}class="active"{% endif %} href={{ url }}>{{ name }}</a>
+ {% if curr_url %}
+ <a {% if curr_url == url %}class="active"{% endif %} href={{ url }}>{{ name }}</a>
+ {% endif %}
{% endmacro nav %}
{% macro toc_item(item, depth=0) %}
<li>
@@ -23,39 +25,63 @@
{% if len > 1 %}
<nav>
<ul>
- {% for child in page.toc %}{{ self::toc_item(item=child) }}{% endfor %}
+ {% for child in toc %}{{ self::toc_item(item=child) }}{% endfor %}
</ul>
</nav>
{% endif %}
{% endmacro %}
-{% if page.summary %}
- <p>{{ page.summary | safe }}</p>
- <a href="{{ page.permalink }}#continue-reading">...</a>
-{% endif %}
-{% macro post_header(page_ref=false) %}
- {% set page = page_ref | default(value=page) %}
+{% macro header(item, full=false) %}
<header>
<hgroup>
<h1>
- {%- if page_ref -%}
- <a href="{{ page.permalink }}">{{ page.title | safe }}</a>
+ {% if full or not item.permalink %}
+ {{ item.title }}
+ {% elif item.extra.external %}
+ <a href="{{ item.extra.external }}">{{ item.title }}</a>
{% else %}
- {{ page.title | safe }}
- {%- endif -%}
+ <a href="{{ item.permalink }}">{{ item.title }}</a>
+ {% endif %}
</h1>
- <p>{{ page.description | default(value="") | markdown(inline=true) | safe }}</p>
+ <p>{{ item.description }}</p>
</hgroup>
+ {% if item.taxonomies["tags"] %}
+ <nav>
+ {% for tag in item.taxonomies["tags"] %}
+ <a href={{ get_taxonomy_url(kind="tags", name=tag) }}>#{{ tag }}</a>
+ {% endfor %}
+ </nav>
+ {% endif %}
+ </header>
+ {% if item.date or item.authors %}
<footer>
- Posted on
- <time pubdate datetime="{{ page.date | date(format="%Y-%m-%d") }}">{{ page.date | date(format="%d %b %Y") }}</time>
- by
- <address class="author"> <a rel="author" href="{{ config.base_url }}">{{ config.extra.author }}</a></address>
+ <p>
+ Posted
+ {% if item.date %}
+ on
+ <time pubdate datetime="{{ item.date | date(format="%Y-%m-%d") }}">
+ {{ item.date | date(format="%d %b %Y") }}
+ </time>
+ {% endif %}
+ {% if item.authors %}
+ <address class="author">
+ by
+ {% for author in item.authors -%}
+ {% if author == config.extra.author %}
+ <a rel="author" href="{{ config.base_url }}">{{ author }}</a>,
+ {% elif item.extra[author] %}
+ <a rel="author" href="{{ item.extra[author] }}">{{ author }}</a>,
+ {% else %}
+ {{ author }}
+ {% endif %}
+ {% endfor %}
+ </address>
+ {% endif %}
+ </p>
</footer>
- </header>
- {% if not page_ref %}
- {{ self::toc(toc=page.toc) }}
- {% elif page.summary %}
- <p>{{ page.summary | safe }}</p>
- <a href="{{ page.permalink }}#continue-reading">...</a>
+ {% endif %}
+ {% if full and item.toc %}
+ {{ macros::toc(toc=item.toc) }}
+ {% elif item.summary %}
+ <p>{{ item.summary | safe }} ...</p>
{% 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() }}
<ul class="simple">
- {% for page in section.pages %}
+ {% for item in section.pages %}
<li>
- <article>{{ macros::post_header(page_ref=page) }}</article>
+ <article>{{ macros::header(item=item) }}</article>
</li>
{% endfor %}
</ul>
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 %}
+ <header>
+ <hgroup>
+ <h1>{{ taxonomy.name }}</h1>
+ </hgroup>
+ </header>
+ <ul class="simple">
+ {% for term in terms %}
+ <li>
+ <a href="{{ term.permalink }}">::{{ term.name }}</a>
+ ({{ term.pages | length }})
+ </li>
+ {% endfor %}
+ </ul>
+{% 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 %}
+ <header>
+ <hgroup>
+ <h1>{{ taxonomy.name }}::{{ term.name }}</h1>
+ </hgroup>
+ </header>
+ <ul class="simple">
+ {% for item in term.pages %}
+ <li>
+ <article>{{ macros::header(item=item) }}</article>
+ </li>
+ {% endfor %}
+ </ul>
+{% endblock content %}