From fd6448c6f2004314eb7b96f16baeabc9e21a4652 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sun, 17 Mar 2024 09:47:58 +1100 Subject: [PATCH 01/10] Updated version number and description. --- plugin.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin.json b/plugin.json index 54090ac..d0d19ce 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { - "version": "0.1.0", - "title": "Sidebar for Tiny theme", - "description": "Adds a sidebar to blogs using the Tiny theme", + "version": "1.0.0", + "title": "Sidebar for Tiny Theme", + "description": "Adds a sidebar to a blog using Tiny Theme", "includes": [ "/sidebar.css" ] From 6ff83f67420c075e8b448b22b0741a66fd553e4d Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sun, 17 Mar 2024 10:14:39 +1100 Subject: [PATCH 02/10] Update to the README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fafebb4..3c4e560 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Sidebar For Tiny Theme -## Description - Sidebar for Tiny Theme is a Micro.blog plugin that adds a sidebar to a blog using [Tiny Theme](https://tiny.micro.blog/), by Matt Langford. This can be used to show your [blog-roll](https://www.manton.org/2024/03/11/recommendations-and-blogrolls.html), links, and pretty much anything you can imagine going into a sidebar. For an example of how this looks on a blog, visit [the example site](https://sidebar-for-tiny-theme.lmika.dev/) or [my own blog](https://lmika.org/). +Questions? Bugs? Ideas? Please raise them as Github issue or [contact me directly](https://leonmika.com). + ## Credit Tiny Theme is created and maintained by [Matt Langfield](http://micro.blog/mtt?remote_follow=1). From bb07ca780e7916d1f68cd79a979fd885db8d882f Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sun, 17 Mar 2024 10:21:25 +1100 Subject: [PATCH 03/10] Slight fix to deal with blogs with no recommendations. --- .../recommendations.html | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/layouts/partials/sidebar-for-tiny-theme/recommendations.html b/layouts/partials/sidebar-for-tiny-theme/recommendations.html index 40794a5..f475f08 100644 --- a/layouts/partials/sidebar-for-tiny-theme/recommendations.html +++ b/layouts/partials/sidebar-for-tiny-theme/recommendations.html @@ -2,15 +2,17 @@

Recommendations

- - + {{ if .Site.Data.blogrolls.recommendations }} + + + {{ else }} +

No recommendations yet.

+ {{ end }} \ No newline at end of file From a9f0437fc79fab6d9003463e830f533a178bb488 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sun, 17 Mar 2024 10:28:43 +1100 Subject: [PATCH 04/10] Added some defensive programming if the site doesn't have recommendations. --- layouts/partials/sidebar-for-tiny-theme/recommendations.html | 2 +- plugin.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/sidebar-for-tiny-theme/recommendations.html b/layouts/partials/sidebar-for-tiny-theme/recommendations.html index f475f08..a395319 100644 --- a/layouts/partials/sidebar-for-tiny-theme/recommendations.html +++ b/layouts/partials/sidebar-for-tiny-theme/recommendations.html @@ -2,7 +2,7 @@

Recommendations

- {{ if .Site.Data.blogrolls.recommendations }} + {{ if and (.Site.Data.blogrolls) (.Site.Data.blogrolls.recommendations) }}
    {{ range .Site.Data.blogrolls.recommendations }}
  • {{ .name }}: {{ (urls.Parse .url).Hostname }}
  • diff --git a/plugin.json b/plugin.json index d0d19ce..db322a1 100644 --- a/plugin.json +++ b/plugin.json @@ -1,5 +1,5 @@ { - "version": "1.0.0", + "version": "1.0.1", "title": "Sidebar for Tiny Theme", "description": "Adds a sidebar to a blog using Tiny Theme", "includes": [ From 7a3eb89fd8d0138adf2f7fc69e1cf8f262b74459 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sun, 24 Mar 2024 12:06:08 +1100 Subject: [PATCH 05/10] Moved sidebar out of microhook Moved the sidebar out of the after-post-list microhook and into the base theme template. This should resolve the styling issue which will break sites using the before-post-list microhook. This does tie the plugin to Tiny-theme baseof theme, which is not great. Will need to resolve this in some way, but should work for now. --- layouts/_default/baseof.html | 26 +++++++++++++++++++ .../partials/microhook-after-post-list.html | 1 - .../sidebar-for-tiny-theme/sidebar.html | 4 ++- plugin.json | 2 +- static/sidebar.css | 2 +- 5 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 layouts/_default/baseof.html delete mode 100644 layouts/partials/microhook-after-post-list.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..20c2b3f --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,26 @@ + + + +{{ partial "head.html" . }} + + + {{ partial "header.html" . }} + +
    +
    + {{ block "main" . }}{{ end }} +
    + {{ partial "sidebar-for-tiny-theme/sidebar.html" . }} +
    + {{ partial "footer.html" . }} + + {{ range .Site.Params.plugins_js }} + + {{ end }} + + {{ if templates.Exists "partials/microhook-before-closing-body.html" }} + {{ partial "microhook-before-closing-body.html" . }} + {{ end }} + + + \ No newline at end of file diff --git a/layouts/partials/microhook-after-post-list.html b/layouts/partials/microhook-after-post-list.html deleted file mode 100644 index ddeaa04..0000000 --- a/layouts/partials/microhook-after-post-list.html +++ /dev/null @@ -1 +0,0 @@ -{{ partial "sidebar-for-tiny-theme/sidebar.html" . }} \ No newline at end of file diff --git a/layouts/partials/sidebar-for-tiny-theme/sidebar.html b/layouts/partials/sidebar-for-tiny-theme/sidebar.html index b7892b5..70ac4e8 100644 --- a/layouts/partials/sidebar-for-tiny-theme/sidebar.html +++ b/layouts/partials/sidebar-for-tiny-theme/sidebar.html @@ -1,7 +1,9 @@ +{{ if .IsHome -}} \ No newline at end of file + +{{ end -}} \ No newline at end of file diff --git a/plugin.json b/plugin.json index db322a1..8b58661 100644 --- a/plugin.json +++ b/plugin.json @@ -1,5 +1,5 @@ { - "version": "1.0.1", + "version": "1.0.2", "title": "Sidebar for Tiny Theme", "description": "Adds a sidebar to a blog using Tiny Theme", "includes": [ diff --git a/static/sidebar.css b/static/sidebar.css index 24147a2..10115fd 100644 --- a/static/sidebar.css +++ b/static/sidebar.css @@ -3,7 +3,7 @@ max-width: 50em; } - div.wrapper:has(div.sidebar) { + div.page-content:has(div.sidebar) { display: grid; grid-template-columns: minmax(20em,35em) 15em; column-gap: 60px; From d68db94b3b40e3077d5c1262194782b4a682f90b Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Tue, 2 Apr 2024 21:14:39 +1100 Subject: [PATCH 06/10] Replaced overridden baseof template with before-closing-body micro-hook --- layouts/_default/baseof.html | 26 ------------------- .../microhook-before-closing-body.html | 1 + plugin.json | 2 +- 3 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 layouts/_default/baseof.html create mode 100644 layouts/partials/partials/microhook-before-closing-body.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html deleted file mode 100644 index 20c2b3f..0000000 --- a/layouts/_default/baseof.html +++ /dev/null @@ -1,26 +0,0 @@ - - - -{{ partial "head.html" . }} - - - {{ partial "header.html" . }} - -
    -
    - {{ block "main" . }}{{ end }} -
    - {{ partial "sidebar-for-tiny-theme/sidebar.html" . }} -
    - {{ partial "footer.html" . }} - - {{ range .Site.Params.plugins_js }} - - {{ end }} - - {{ if templates.Exists "partials/microhook-before-closing-body.html" }} - {{ partial "microhook-before-closing-body.html" . }} - {{ end }} - - - \ No newline at end of file diff --git a/layouts/partials/partials/microhook-before-closing-body.html b/layouts/partials/partials/microhook-before-closing-body.html new file mode 100644 index 0000000..ddeaa04 --- /dev/null +++ b/layouts/partials/partials/microhook-before-closing-body.html @@ -0,0 +1 @@ +{{ partial "sidebar-for-tiny-theme/sidebar.html" . }} \ No newline at end of file diff --git a/plugin.json b/plugin.json index 8b58661..7e82329 100644 --- a/plugin.json +++ b/plugin.json @@ -1,5 +1,5 @@ { - "version": "1.0.2", + "version": "1.1.0", "title": "Sidebar for Tiny Theme", "description": "Adds a sidebar to a blog using Tiny Theme", "includes": [ From 0209f1069676a31645e4473099510c6ca2560b02 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Wed, 3 Apr 2024 21:29:59 +1100 Subject: [PATCH 07/10] Moved partial to correct location. --- ...hook-before-closing-body.html => microhook-below-wrapper.html} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename layouts/partials/{partials/microhook-before-closing-body.html => microhook-below-wrapper.html} (100%) diff --git a/layouts/partials/partials/microhook-before-closing-body.html b/layouts/partials/microhook-below-wrapper.html similarity index 100% rename from layouts/partials/partials/microhook-before-closing-body.html rename to layouts/partials/microhook-below-wrapper.html From d70e270ed06f79397ac8477a3b14cd26e07b661b Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Wed, 3 Apr 2024 21:31:15 +1100 Subject: [PATCH 08/10] Bumped plugin version to 1.1.1 --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index 7e82329..77fff34 100644 --- a/plugin.json +++ b/plugin.json @@ -1,5 +1,5 @@ { - "version": "1.1.0", + "version": "1.1.1", "title": "Sidebar for Tiny Theme", "description": "Adds a sidebar to a blog using Tiny Theme", "includes": [ From 8a80ab665d6977f71c1ae090cdf85272ed943833 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Thu, 26 Dec 2024 14:32:20 +1100 Subject: [PATCH 09/10] Added the option to show the sidebar on other pages (#2) Added settings to show the sidebar on posts and other pages, in addition to the home page. --- .../partials/sidebar-for-tiny-theme/sidebar.html | 6 +++++- plugin.json | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/layouts/partials/sidebar-for-tiny-theme/sidebar.html b/layouts/partials/sidebar-for-tiny-theme/sidebar.html index 70ac4e8..69c1d8d 100644 --- a/layouts/partials/sidebar-for-tiny-theme/sidebar.html +++ b/layouts/partials/sidebar-for-tiny-theme/sidebar.html @@ -1,4 +1,8 @@ -{{ if .IsHome -}} +{{ $isPost := eq .Page.Type "post" -}} +{{ $showOnPosts := $.Site.Params.sidebar_show_on_posts -}} +{{ $showOnPages := $.Site.Params.sidebar_show_on_pages -}} +{{ $shouldShowSidebar := or .IsHome (and $showOnPosts $isPost) (and $showOnPages (not $isPost)) -}} +{{ if $shouldShowSidebar -}}