Compare commits

..

15 Commits
pr ... main

Author SHA1 Message Date
Evan G. b066138b0a
Remove all the links that mention github in theme.toml + Fix Documentation 2024-06-19 14:07:34 -05:00
Evan G. e6bb246cab
Fix Links that mentioned github 2024-06-19 13:54:24 -05:00
Evan G. 5038c515e5
Fix Links that mentioend github + remove .github 2024-06-19 13:53:40 -05:00
Evan G. a67a169c6b Some fixing up 2024-05-29 13:20:45 -05:00
Evan G. b507d458b0 Allow going back in the directory structure 2024-05-29 12:46:47 -05:00
Evan G. d5a64c55fa
Merge in changes 2024-05-22 16:26:14 -05:00
Evan G. 295d837618
Make Light Theme display correctly 2024-05-22 12:25:02 -05:00
fbievan 36110a0c55 Updated README
Did the Following
- Removed Necessary Documentation that can be referred to at the orginal project
- Credited the Authors of the numerous projects used
2024-05-20 14:50:59 -05:00
Evan G. a752274ba0 Update Footer Logic 2024-05-20 13:21:06 -05:00
Evan G. 8857c2682c Use License Variable & Format + Footer minimal 2024-05-20 12:08:11 -05:00
Evan G. 50be8a59ca Update logic for Back Home, and also add metadata to homepage 2024-05-20 10:20:24 -05:00
Evan G. 378d0f14d6
Update Logic 2024-05-19 13:15:23 -05:00
Evan G. 94ab910470
Align the Metadata to the middle For easier read-flow 2024-05-19 12:40:12 -05:00
Evan G. 3e45d5582c
Add Files 2024-05-18 17:44:00 -05:00
Evan G. 1891bd816c
Fork off the Project 2024-05-18 17:43:45 -05:00
13 changed files with 244 additions and 154 deletions

View File

@ -1,49 +0,0 @@
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
# Query the codeberg.org API (see
# https://codeberg.org/api/swagger#/repository/repoListReleases
# ) and use jq to get the tag name of the
# latest release (i.e. the first element of the
# array in the JSON output, that is not a
# prerelease).
# The '-r' option will give us "raw" output,
# i.e. without surrounding double-quotes.
# We use 'map' and 'select' in combination,
# because jq won't return a list otherwise.
# Only using 'select' returns just the matching
# elements, which is not a valid json that we
# can process further.
TAG_VERSION=$(curl -s \
-H 'accept: application/json' \
https://codeberg.org/api/v1/repos/Freedom-to-Write/readable.css/releases \
| jq -r '.|map(select(.prerelease==false))[0].tag_name')
echo "Latest tag: ${TAG_VERSION}"
# Get the current version.
# The '-o' option will only output the match grep found.
# We look for readable.min.css and a set of three numbers seperated by dots,
# i.e. a semantic version. readable.min.css is used to make sure that we match
# the right numbers in the file.
# We use sed to get rid of the readable.min.css prefix.
CURRENT_VERSION=$(grep -o \
'readable.min.css?v=v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+' \
layouts/partials/head.html \
| sed 's/readable.min.css?v=//')
echo "Current version: ${CURRENT_VERSION}"
if [[ $TAG_VERSION == $CURRENT_VERSION ]]
then
echo "Nothing to do. The current version is already up to date."
else
curl -s "https://codeberg.org/Freedom-to-Write/readable.css/raw/tag/${TAG_VERSION}/readable.css" > static/css/readable.css
curl -s "https://codeberg.org/Freedom-to-Write/readable.css/raw/tag/${TAG_VERSION}/readable.min.css" > static/css/readable.min.css
sed -i "s/readable.min.css?v=${CURRENT_VERSION}/readable.min.css?v=${TAG_VERSION}/" layouts/partials/head.html
fi
# Add the latest tag version to the workflow environment, so we can access
# it in later steps.
echo "READABLE_CSS_TAG=${TAG_VERSION}" >> "$GITHUB_ENV"

View File

@ -1,42 +0,0 @@
name: update-readable-css
on:
schedule:
# Every day at 3:28.
- cron: '28 3 * * *'
jobs:
update-readable-css:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download CSS files for latest tag
run: .github/scripts/update-readable-css.sh
- name: Create pull request if files have changed
# https://github.com/marketplace/actions/create-pull-request
uses: peter-evans/create-pull-request@v5
with:
# First line is the commit subject as always. The rest goes
# into the body.
commit-message: |
Update readable.css to ${{ env.READABLE_CSS_TAG }}
See the changelog here:
https://codeberg.org/Freedom-to-Write/readable.css/src/tag/${{ env.READABLE_CSS_TAG }}/CHANGELOG.md
branch: update-readable-css
delete-branch: true
# Use 'GitHub' both times.
# This is already the default for committer, but the author defaults
# to the user who triggered the workflow run, which is the owner of
# the repository.
# We use the same value for the author to indicate that the
# commit was created by a bot.
committer: GitHub <noreply@github.com>
author: GitHub <noreply@github.com>
title: Update readable.css to ${{ env.READABLE_CSS_TAG }}
body: |
See the changelog here:
https://codeberg.org/Freedom-to-Write/readable.css/src/tag/${{ env.READABLE_CSS_TAG }}/CHANGELOG.md
labels: update-readable-css

View File

@ -4,66 +4,35 @@ Readable is a theme for the static-site generator [Hugo](https://gohugo.io/) usi
Shoutout to [Benjamin Hollon](https://benjaminhollon.com/) for his amazing work building this CSS framework and making it so simple to use.
Want to check out a demo? (coming soon)
**This is a fork of the project [hugo-theme-readable](https://codeberg.org/Freedom-to-Write/hugo-theme-readable)**
https://codeberg.org/Freedom-to-Write/hugo-theme-readable
![demo image](/docs/demo_image.png)
## Installation
To add this theme to an existing Hugo site, start by adding this repo as a submodule in the site's themes folder.
`git submodule add https://codeberg.org/Freedom-to-Write/hugo-theme-readable themes/readable`
`git submodule add https://git.fbievan.live/fbievan/hugo-theme-readable themes/readable`
Then, update your config file to be using the new theme. For example, if you are using config.toml, the line should become:
`theme = 'readable'`
If you don't have an existing site, feel free to use the provided [starter template](https://codeberg.org/Freedom-to-Write/hugo-starter-readable) to quickly get your website online.
For more information on starting a Hugo website and using custom themes, refer to the [Hugo documentation](https://gohugo.io/documentation/).
## Usage
Freedom to Write has provided some awesome guides on writing HTML that works automatically with the formatting of Readable. For a complete HTML page guide on writing custom pages, see [Overall Structure](https://codeberg.org/Freedom-to-Write/readable.css/wiki/Overall-Structure). For some neat tips that may make life easier working with this style sheet, read [Quick Tips](https://codeberg.org/Freedom-to-Write/readable.css/wiki/Quick-Tips).
## Shortcodes
### aside
## The rest
As mentioned, This is a fork of [hugo-theme-readable](https://codeberg.org/Freedom-to-Write/hugo-theme-readable), and will continue to cherry-pick commits from the upstream. I also commit to pushing certain things I think work with the upstream project, to the upstream.
You can use the `aside` shortcode to signify content that is slightly off-topic in regard to the rest of the post.
This is very much a opinonized theme for my site, and you can use it for yours, I however ask that you credit me as I credit Benjamin, and CJ for the work done on this project.
Here's how it compares to a blockquote:
Without Benjamin Hollon or C.J this theme wouldn't exist.
```text
> This is a blockquote.
>
> This is a default **markdown** element and supports formatting inside it.
{{< aside >}}
This is an aside element.
You can use **markdown** formatting inside it.
{{</ aside >}}
```
The above code generates the following output:
![Comparing a blockquote to an aside. The blockquote has a thin bar on it's left, while the aside element is inside a nice box with rounded corners.](/docs/blockquote_vs_aside.png)
### video
You can use the `video` shortcode to embed a video player in your post.
```text
{{< video source="https://test-videos.co.uk/vids/bigbuckbunny/mp4/av1/1080/Big_Buck_Bunny_1080_10s_5MB.mp4" type="video/mp4" caption="Of course it's Big Buck Bunny!" >}}
```
![A still from an embedded video with controls in a post.](/docs/video.png)
Sources can be remote or static content from your website. You can find the supported file types [here](https://www.w3schools.com/html/html5_video.asp#table1).
## Notes
- Benjamin loves when new sites and projects pop up using the readable.css framework!
- If you've built a complete site using this theme, submit an issue to the [original repo](https://codeberg.org/Freedom-to-Write/readable.css) with the URL of your site to be featured in the project's README.
- Projects like this and other non-website uses of the framework, such as adapting it to other static site generators, can be featured on the page [Unofficial Related Projects (that are awesome)](https://codeberg.org/Freedom-to-Write/readable.css/wiki/Unofficial-Related-Projects-%28that-are-awesome%29). Go mention [@freedomtowrite@fosstodon.org](https://fosstodon.org/@freedomtowrite) to be featured there!
Projects used:
- [hugo](https://gohugo.io/) created by [Bep](https://bep.is/en/)
- [Readable.css](https://codeberg.org/Freedom-to-Write/readable.css) created by [Benjamin Hollon](https://benjaminhollon.com/)
- [Hugo Readable Theme](https://codeberg.org/Freedom-to-Write/hugo-theme-readable) created by [C.J](https://github.com/cjtheham)

View File

@ -1,4 +1,5 @@
{{ define "main" }}
{{ partial "head.html" }}
<h1>{{ .Title }}</h1>
{{ range .Pages.ByLastmod.Reverse }}
<p>

72
layouts/_default/rss.xml Normal file
View File

@ -0,0 +1,72 @@
{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
{{- $authorEmail := "" }}
{{- with site.Params.author }}
{{- if reflect.IsMap . }}
{{- with .email }}
{{- $authorEmail = . }}
{{- end }}
{{- end }}
{{- else }}
{{- with site.Author.email }}
{{- $authorEmail = . }}
{{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
{{- end }}
{{- end }}
{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
{{- $authorName := "" }}
{{- with site.Params.author }}
{{- if reflect.IsMap . }}
{{- with .name }}
{{- $authorName = . }}
{{- end }}
{{- else }}
{{- $authorName = . }}
{{- end }}
{{- else }}
{{- with site.Author.name }}
{{- $authorName = . }}
{{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
{{- end }}
{{- end }}
{{- $pctx := . }}
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
{{- $pages := slice }}
{{- if or $.IsHome $.IsSection }}
{{- $pages = $pctx.RegularPages }}
{{- else }}
{{- $pages = $pctx.Pages }}
{{- end }}
{{- $limit := .Site.Config.Services.RSS.Limit }}
{{- if ge $limit 1 }}
{{- $pages = $pages | first $limit }}
{{- end }}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
{{- printf "<?xml-stylesheet href=\"/rss.xsl\" type=\"text/xsl\"?>" | safeHTML -}}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo</generator>
<language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
<managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }}
{{- range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid>
<description>{{ printf "<![CDATA[" | safeHTML }}{{ .Content | safeHTML }}{{ printf "]]>" | safeHTML }}</description>
</item>
{{- end }}
</channel>
</rss>

View File

@ -1,7 +1,17 @@
{{ define "main" }}
{{ partial "metadata.html" . }}
<!-- <br><br> -->
<article>
{{ .Content }}
</article>
<div>
{{ range where .Site.RegularPages "Section" "in" .Site.MainSections }}
<section class="articles">
<h3><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h3>
{{ partial "metadata.html" . }}
<p class="summary">{{ .Summary }}</p>
</section>
{{ end }}
</div>
{{ end }}

View File

@ -10,4 +10,10 @@
{{ if .IsHome }}{{ $title = .Site.Title }}{{ end }}
<title>{{ $title }}</title>
{{ partial "hook_head_end.html" . }}
{{ if .IsHome }}
<link rel="stylesheet" type="text/css" href="{{relURL "css/homepage.css"}}">
{{ end }}
{{ if .IsPage }}
<link rel="stylesheet" type="text/css" href="{{relURL "css/page.css"}}">
{{ end }}
</head>

View File

@ -1,15 +1,27 @@
<h1>{{ $.Site.Title }}</h1>
<p>{{ $.Site.Params.subtitle }}</p>
<!-- readable.css v1.1.0 introduced different navbar styles and defaults to a
navbar without animations. We default to "classy" to keep the animations and be
backwards compatible to earlier versions of this theme without requiring a
config change. -->
{{ $navbar_style := (default "classy" $.Site.Params.navbar_style) }}
<nav data-style={{ $navbar_style }}>
{{ range .Site.Menus.main -}}
{{ if eq $navbar_style "classy" }}<span>{{ end }}
<a href="{{ .URL | absLangURL }}">{{ .Name }}</a>
{{ if eq $navbar_style "classy" }}</span>{{ end }}
{{- end }}
{{ if .IsHome }}
{{ range .Site.Menus.main -}}
{{ if eq $navbar_style "classy" }}<span>{{ end }}
<a href="{{ .URL | absLangURL }}">{{ .Name }}</a>
{{ if eq $navbar_style "classy" }}</span>{{ end }}
{{- end }}
</nav>
<h1>{{ $.Site.Title }}</h1>
<p>{{ $.Site.Params.subtitle }}</p>
{{ else }}
<a href="/">Go Home</a>
{{ $path := .Path }}
{{ $bpath := path.Dir $path }}
{{ if eq $bpath "/" }}
{{ else }}
<a href="{{ $bpath }}">Back to {{ $bpath }}</a>
{{ end }}
</nav>
{{ end }}

View File

@ -0,0 +1 @@
{{ partial "header.html" }}

View File

@ -1,19 +1,25 @@
{{ $dateTime := .PublishDate.Format "2006-01-02" }}
{{ $lastmodTime := .Lastmod.Format "2006-01-02" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }}
<section class="metadata">
<i data-feather="calendar"></i>
{{ if .PublishDate }}
{{ if and (ne $lastmodTime $dateTime) (gt .Lastmod .Date) }}
<time datetime="{{ $lastmodTime }}">{{ .Lastmod.Format $dateFormat }}</time>
(first posted <time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>)
{{ else }}
<time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>
{{ end }}
{{ end }}
{{ with .Params.tags }}
<i data-feather="tag"></i>
{{ range . }}
{{ $href := print "/tags/" (urlize .) }}
<a class="btn btn-sm btn-outline-dark tag-btn" href="{{ $href }}">{{ . }}</a>
{{ if and (ne $lastmodTime $dateTime) (gt .Lastmod .Date) }}
<time datetime="{{ $lastmodTime }}">{{ .Lastmod.Format $dateFormat }}</time>
(first posted <time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>)
{{ else }}
Date Published: <time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>
{{ end }}
{{ end }}
{{ with .Params.tags }}
<br>
Tags: <i data-feather="tag"></i>
{{ range . }}
{{ $href := print "/tags/" (urlize .) }}
<a class="btn btn-sm btn-outline-dark tag-btn" href="{{ $href }}">{{ . }}</a>
{{ end }}
</section>
{{ else }}
</section>
{{ end }}

55
static/css/homepage.css Normal file
View File

@ -0,0 +1,55 @@
html, html[data-theme="light"] {
--background-color: snow;
--color: #000;
}
html[data-theme="dark"] {
--background-color: #1f272d;
--color: #fff;
--tcolor: pink;
}
@media (prefers-color-scheme: dark) {
html {
--background-color: #222830;
--color: #fff;
--hcolor: #e976d9;
--tcolor: pink;
}
}
.articles {
padding: 5px;
border: var(--line-width) solid;
border-top-style: dashed;
border-bottom-style: dashed;
border-right-style: none;
border-left-style: none;
}
section {
border: var(--line-width) solid;
border-left-style: none;
border-right-style: none;
border-top-style: none;
text-align: left;
padding-bottom: 20px;
padding-top: 0px;
}
h3 {
text-align: left;
margin-top: 10px;
padding-top: 0px;
color: var(--hcolor);
}
.summary {
padding-left: 1.5rem;
margin-top: 0.1rem;
}
.metadata {
padding-left: 0.5rem;
border-top-style: none;
border-bottom-style: none;
padding-bottom: 0.3rem;
}
.metadata a {
text-decoration: underline;
color: var(--tcolor);
}

3
static/css/page.css Normal file
View File

@ -0,0 +1,3 @@
.metadata {
text-align: center;
}

46
static/rss.xsl Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><xsl:value-of select="/rss/channel/title"/> Feed</title>
<link href="/css/readable.min.css" rel="stylesheet" type="text/css"></link>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
</head>
<body>
<nav>
<span><a href="/">Back Home</a></span>
</nav>
<header>
<h1><xsl:value-of select="/rss/channel/title"/></h1>
<p>RSS Feed preview</p>
</header>
<main>
<xsl:for-each select="/rss/channel/item">
<article>
<h3 style="text-align: center">
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</h3>
<p style="text-align: center">
Published:
<time>
<xsl:value-of select="pubDate" />
</time>
</p>
</article>
</xsl:for-each>
</main>
</body>
</html>
</xsl:template>
</xsl:stylesheet>