From 19a8590fa1f955f00a277ff508c7f9db8d40d70d Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Mon, 19 Apr 2021 00:20:14 -0700 Subject: [PATCH] bunch of little changes... make the font a bit smaller, but larger on the sidebar... move styling for sidebar into css from style attribute.. make sure my custom css can override the tufte css (to allow setting the font size).. convert the slug into a macro so it can be used else where make the title link to a slug, but use -title since the bare slug is the body which doesn't make it go to the title of the blog post... make a few of the side bar elements bold (the year and the month).. --- content/media/css/custom.css | 16 ++++++++++++++++ layout/base.j2 | 12 ++++++------ layout/blog.j2 | 4 ++-- layout/macros.j2 | 7 ++++++- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/content/media/css/custom.css b/content/media/css/custom.css index 70ce993..209148d 100644 --- a/content/media/css/custom.css +++ b/content/media/css/custom.css @@ -1,3 +1,9 @@ +/* + * override some tufte options + */ +html { + font-size: 13px; +} /* * override some w3.css options @@ -7,6 +13,16 @@ width: 80%; } +.w3-sidebar { + font-size: 1.2rem; + width: 350px; + right: 0; + display: block; + top: 0; + bottom: 0; + overflow-y: scroll; +} + ul.posts > li { padding-left: 1.5em; text-indent: -1em; diff --git a/layout/base.j2 b/layout/base.j2 index 2ce82b6..f612556 100644 --- a/layout/base.j2 +++ b/layout/base.j2 @@ -49,28 +49,28 @@ {% block css %} - + {% endblock css %} {% block endhead %}{% endblock endhead %} - +
-
- +
+ {% set hierarchy = node.rwalk()|list %} {% for yeargrp in hierarchy[-1].walk_resources_sorted_by_time()|groupby("meta.created.year")|reverse %}
- +
{% for monthgrp in yeargrp.list|groupby("meta.created.month")|reverse %} - + {% for item in monthgrp.list %}
{{ item.meta.title }} diff --git a/layout/blog.j2 b/layout/blog.j2 index abb6b13..c16931c 100644 --- a/layout/blog.j2 +++ b/layout/blog.j2 @@ -1,4 +1,4 @@ -{% from "macros.j2" import render with context %} +{% from "macros.j2" import slug %} {% extends "base.j2" %} {% block main -%} @@ -6,7 +6,7 @@ {% mark post -%}
-

{{ resource.meta.title }}

+

{{ resource.meta.title }}

Posted: {{ resource.meta.created.strftime('%B %e, %Y') }} at {{ resource.meta.time }}

diff --git a/layout/macros.j2 b/layout/macros.j2 index 50f27e0..579fda4 100644 --- a/layout/macros.j2 +++ b/layout/macros.j2 @@ -1,3 +1,8 @@ +{% macro slug(res) %} +{{ res.meta.id if res.meta.id else res.slug }}{% endmacro %} + +{# endmacro not on new line to prevent white space at end of macro #} + {% macro render_excerpt(res, class=None) %} {% refer to res.relative_path as post %}