Compare commits

...

10 commits

Author SHA1 Message Date
Leon Mika 658f4a5874 Forked sidebar-for-tiny-theme for use with Bayou 2025-02-04 08:04:38 +11:00
Leon Mika 8a80ab665d
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.
2024-12-26 14:32:20 +11:00
Leon Mika d70e270ed0 Bumped plugin version to 1.1.1 2024-04-03 21:31:15 +11:00
Leon Mika 0209f10696 Moved partial to correct location. 2024-04-03 21:29:59 +11:00
Leon Mika d68db94b3b Replaced overridden baseof template with before-closing-body micro-hook 2024-04-02 21:14:39 +11:00
Leon Mika 7a3eb89fd8 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.
2024-03-24 12:06:08 +11:00
Leon Mika a9f0437fc7 Added some defensive programming if the site doesn't have recommendations. 2024-03-17 10:28:43 +11:00
Leon Mika bb07ca780e Slight fix to deal with blogs with no recommendations. 2024-03-17 10:21:25 +11:00
Leon Mika 6ff83f6742 Update to the README 2024-03-17 10:14:39 +11:00
Leon Mika fd6448c6f2 Updated version number and description. 2024-03-17 09:47:58 +11:00
7 changed files with 39 additions and 19 deletions

View file

@ -1,4 +1,4 @@
Copyright 2024 Leon Mika
Copyright 2025 Leon Mika
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View file

@ -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).

View file

@ -2,15 +2,17 @@
<header>
<h1>Recommendations</h1>
</header>
<ul class="blogroll">
{{ range .Site.Data.blogrolls.recommendations }}
<li><a href="{{ .url }}">{{ .name }}: <span>{{ (urls.Parse .url).Hostname }}</span></a></li>
{{ else }}
<p>No recommendations yet.</p>
{{ end }}
</ul>
<div class="blogroll-footer-links">
<a href="{{ absURL ".well-known/recommendations.opml" }}">OPML</a>
<a href="{{ absURL ".well-known/recommendations.json" }}">JSON</a>
</div>
{{ if and (.Site.Data.blogrolls) (.Site.Data.blogrolls.recommendations) }}
<ul class="blogroll">
{{ range .Site.Data.blogrolls.recommendations }}
<li><a href="{{ .url }}">{{ .name }}: <span>{{ (urls.Parse .url).Hostname }}</span></a></li>
{{ end }}
</ul>
<div class="blogroll-footer-links">
<a href="{{ absURL ".well-known/recommendations.opml" }}">OPML</a>
<a href="{{ absURL ".well-known/recommendations.json" }}">JSON</a>
</div>
{{ else }}
<p>No recommendations yet.</p>
{{ end }}
</div>

View file

@ -1,7 +1,13 @@
{{ $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 -}}
<div class="sidebar">
{{ if templates.Exists "partials/sidebar.html" }}
{{ partial "sidebar.html" . }}
{{ else }}
{{ partial "sidebar-for-tiny-theme/recommendations.html" . }}
{{ end }}
</div>
</div>
{{ end -}}

View file

@ -1,8 +1,20 @@
{
"version": "0.1.0",
"title": "Sidebar for Tiny theme",
"description": "Adds a sidebar to blogs using the Tiny theme",
"version": "0.0.1",
"title": "Sidebar for Bayou",
"description": "Adds a sidebar to a blog using the Bayou theme",
"includes": [
"/sidebar.css"
],
"fields": [
{
"field": "params.sidebar_show_on_posts",
"label": "Show sidebar on posts",
"type": "boolean"
},
{
"field": "params.sidebar_show_on_pages",
"label": "Show sidebar on other pages",
"type": "boolean"
}
]
}

View file

@ -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;