summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Rief <riearn@proton.me>2025-09-10 22:02:25 +0200
committerArne Rief <riearn@proton.me>2025-09-10 22:02:25 +0200
commit251f989b535be2f03228f1f13c3ec87d0808e4ec (patch)
tree401c280f70b77bc018cd44aae410d937812732ad
parentec89ee00b4ffd756938db6a876c241312a4d7f57 (diff)
Newtab shortcode, improved RSS & CSS
-rw-r--r--README.md8
-rw-r--r--assets/css/main.css35
-rw-r--r--layouts/_shortcodes/newtab.html3
-rw-r--r--layouts/rss.xml59
4 files changed, 94 insertions, 11 deletions
diff --git a/README.md b/README.md
index 159085c..e12f415 100644
--- a/README.md
+++ b/README.md
@@ -42,8 +42,16 @@ Also note that the theme expects `params.author.name` to be defined, as can be s
You will need to create markdown files for the pages **"Search"** and **"All posts"** in your project's content directory.
If you want to go with the default text for both pages, these files can be empty except for title and `layout = all-posts` in the frontmatter. You can simply copy the example md files from the theme's `/content` directory.
+
In case you have a multilingual setup, you will need to create both pages in each language subdirectory, e.g. `content/de/search.md`, `content/en/all-posts.md` etc.
+The theme supports the value `excludeFromLists` in markdown frontmatter. This is inteded to be used for pages like "Contact" or "Search". If you set this value to true, the respective page:
+- will not be displayed in the "Recent posts" and "All posts" lists
+- will not include "Previous/Next post" navigation links
+- will not be included in the site's RSS feed.
+
+Argo comes with a pre-defined shortcode: including `{{< newtab href="https://some-site.com" >}}some text{{< /newtab >}}` in your markdown will render a link that opens a new tab.
+
The theme works with fallbacks and defaults a lot, e.g. if you do not set a logo, your website's title will be used instead.
## How to modify
diff --git a/assets/css/main.css b/assets/css/main.css
index cb4b89e..7550f30 100644
--- a/assets/css/main.css
+++ b/assets/css/main.css
@@ -9,6 +9,7 @@
--font-size-h1: 2rem;
--font-size-small: 0.85rem;
--gap-default: 1rem;
+ --gap-medium: 1.5rem;
--gap-large: 2rem;
--gap-small: 0.5rem;
--line-height-default: 1.5;
@@ -66,7 +67,7 @@ body {
display: grid;
grid-template-rows: auto auto 1fr auto; /* Ensure header & navmenu at top, main taking up main space, footer at bottom */
margin: 1.5rem auto;
- max-width: 80ch;
+ max-width: 75ch;
min-height: 100vh;
}
@@ -125,7 +126,7 @@ dl {
dd {
line-height: var(--line-height-body);
- padding-left: 1.5rem;
+ padding-left: var(--gap-medium);
}
}
@@ -155,7 +156,7 @@ hr {
/* Lists generated from markdown text */
ol, ul {
- padding-left: 1.5rem;
+ padding-left: var(--gap-medium);
margin-bottom: var(--gap-default);
}
@@ -186,6 +187,13 @@ time {
& > pre {
border-radius: var(--border-radius-minimal);
padding: 0.5rem;
+
+ /* Preserving code indentation with mobile horizontal scrolling */
+ @media (max-width: 768px) {
+ max-width: 330px;
+ overflow-x: auto;
+ -webkit-overflow-scrolling: touch; /* iOS Safari only */
+ }
}
}
@@ -194,7 +202,7 @@ time {
display: flex;
align-items: center;
justify-content: space-around;
- margin-bottom: 1.5rem;
+ margin-bottom: var(--gap-medium);
}
.site-selections,
@@ -202,7 +210,7 @@ time {
display: flex;
align-items: center;
justify-content: center;
- gap: var(--gap-default);
+ gap: var(--gap-medium);
}
.site-title {
@@ -243,8 +251,11 @@ time {
justify-content: space-evenly;
@media (max-width: 768px) {
- flex-direction: column;
- gap: 0.8rem;
+ /* Grid items stretch to at least 100px or take up full width */
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
+ justify-items: center;
+ gap: var(--gap-medium) var(--gap-small);
}
}
@@ -258,7 +269,7 @@ time {
display: flex;
align-items: center;
justify-content: space-around;
- margin-top: 1.5rem;
+ margin-top: var(--gap-medium);
@media (max-width: 768px) {
flex-direction: column;
@@ -268,18 +279,20 @@ time {
.follow-me-list {
display: flex;
- align-items: start;
+ align-items: center;
justify-content: center;
- gap: var(--gap-default);
+ gap: var(--gap-medium);
@media (max-width: 768px) {
- flex-direction: column;
+ flex-wrap: wrap;
}
}
/* Footer Icons */
.follow-me-item img {
+ object-fit: contain;
height: 2rem;
+ width: 2rem;
}
/* POST CARD */
diff --git a/layouts/_shortcodes/newtab.html b/layouts/_shortcodes/newtab.html
new file mode 100644
index 0000000..b06fb2d
--- /dev/null
+++ b/layouts/_shortcodes/newtab.html
@@ -0,0 +1,3 @@
+<a href="{{ .Get "href" }}" target="_blank" rel="noopener noreferrer">
+ {{ .Inner }}
+</a>
diff --git a/layouts/rss.xml b/layouts/rss.xml
new file mode 100644
index 0000000..4baaa59
--- /dev/null
+++ b/layouts/rss.xml
@@ -0,0 +1,59 @@
+{{- $authorEmail := "" }}
+{{- with site.Params.author }}
+ {{- if reflect.IsMap . }}
+ {{- with .email }}
+ {{- $authorEmail = . }}
+ {{- end }}
+ {{- end }}
+{{- end }}
+
+{{- $authorName := "" }}
+{{- with site.Params.author }}
+ {{- if reflect.IsMap . }}
+ {{- with .name }}
+ {{- $authorName = . }}
+ {{- end }}
+ {{- else }}
+ {{- $authorName = . }}
+ {{- 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 }}
+<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 where $pages "Params.excludeFromLists" "!=" "true" }}
+ <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>{{ .Summary | transform.XMLEscape | safeHTML }}</description>
+ </item>
+ {{- end }}
+ </channel>
+</rss>