This commit is contained in:
Hedy Li 2021-02-16 01:46:37 +00:00
commit 43dda43638
20 changed files with 322 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
public/

9
archetypes/default.md Normal file
View File

@ -0,0 +1,9 @@
---
title: "{{ slicestr (replace .Name "-" " ") 11 | title }}"
date: {{ .Date }}
draft: true
outputs:
- html
- gemtext
---

35
config.toml Normal file
View File

@ -0,0 +1,35 @@
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
uglyurls = true
[permalinks]
posts = "/:year/:month/:day/:slug"
[markup.goldmark.renderer]
# Allows HTML in Markdown
unsafe = true
[mediaTypes]
[mediaTypes."text/gemini"]
suffixes = ["gmi"]
[outputFormats]
[outputFormats.Gemini]
name = "GEMTEXT"
isPlainText = true
isHTML = false
mediaType = "text/gemini"
protocol = "gemini://"
permalinkable = true
path = "gemini/"
[outputFormats.GEMRSS]
name = "GEMRSS"
isHTML = false
mediaType = "application/rss+xml"
protocol = "gemini://"
path = "gemini/"
[outputs]
section = ["HTML", "RSS", "GEMRSS"]

View File

@ -0,0 +1,7 @@
# Hello hugo
hope it works!
*test* <- shouldnt render
=> / root link

View File

@ -0,0 +1,12 @@
---
title: "Hello"
date: 2021-02-05T01:44:15Z
draft: true
outputs:
- html
- gemtext
---
# Hello hugo
hope it works!

0
layouts/404.html Normal file
View File

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="{{- default "" .Site.LanguageCode -}}">
{{- partial "head.html" . -}}
<body>
{{- partial "header.html" . -}}
<main id="content">
{{- block "main" . }}{{- end }}
</main>
{{- partial "footer.html" . -}}
</body>
</html>

View File

@ -0,0 +1,3 @@
{{ define "main" }}
{{- partial "posts.html" . -}}
{{ end }}

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

@ -0,0 +1,42 @@
{{- $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>
<ttl>1440</ttl>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.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 .Site.Pages "Kind" "page" }}
{{ if or (eq .Section "posts") (eq .Section "post") }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>{{- .Content | html -}}</description>
</item>
{{ end }}
{{ end }}
</channel>
</rss>

View File

@ -0,0 +1,44 @@
{{- $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>Hedy's gemlog</title>
<link>gemini://</link>
<description>Hedy's Geminispace</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.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 }}
{{- if .OutputFormats.Get "GEMTEXT" -}}
<item>
<title>{{ .Title }}</title>
{{ with .OutputFormats.Get "GEMTEXT" }}
<link>{{replace .Permalink "/gemini" "" 1}}</link>
{{ end }}
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
{{ with .OutputFormats.Get "GEMTEXT" }}
<guid>{{replace .Permalink "/gemini" "" 1}}</guid>
{{ end }}
</item>
{{- end -}}
{{ end }}
</channel>
</rss>

View File

@ -0,0 +1,15 @@
{{ define "main" }}
<div itemscope itemtype="https://schema.org/BlogPosting" class="h-entry">
<article itemprop="mainEntityOfPage">
<header id="post-header">
<h1 itemprop="name headline" class="p-name">{{ .Title }}</h1>
{{ $lastmod := .Lastmod -}}
{{ if lt .Date $lastmod -}}
{{ end }}
</header>
<section class="e-content" itemprop="articlebody">
{{ partial "processed-content" . -}}
</section>
</article>
</div>
{{ end }}

12
layouts/index.gmi Normal file
View File

@ -0,0 +1,12 @@
{{readFile (replace (replace $.File.Path ".md" ".gmi") ".html" ".gmi") | safeHTML}}
## Gemlog posts
{{ range (where .Site.RegularPages "Section" "posts") }}
{{- if .OutputFormats.Get "gemtext" }}
=> {{replace .Permalink "/gemini" "" 1}} {{ .Date.Format "2006-01-02" }}: {{.Title | safeHTML}}{{ end }}{{ end }}
=> posts/index.xml RSS feed
--
{{ .Site.Params.copyright }}
=> {{ .Site.Params.src }} Website source code

4
layouts/index.html Normal file
View File

@ -0,0 +1,4 @@
{{ define "main" }}
{{ .Content }}
{{- partial "posts.html" . -}}
{{ end }}

View File

@ -0,0 +1,7 @@
<hr>
<footer id="site-footer">
<p>Copyright © {{now.Year}} Hedy Li · <a href="{{ .Site.Params.src }}">Website source code</a></p>
{{if .GitInfo -}}
<p>Site last rebuilt on {{now.Format "2006-01-02 15:04:05 -0700" }}</p>
{{- end}}
</footer>

View File

@ -0,0 +1,34 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.Description }}{{ end }}">
<meta name="author" content="{{ .Site.Author.name }}">
<link rel="alternate" type="application/rss+xml" href="{{ .Site.BaseURL }}posts/index.xml" title="{{ $.Site.Title }}">
<meta name="robots" content="noindex">
{{/* <link rel="pgpkey" type="application/pgp-keys" href="{{ .Site.BaseURL }}publickey.asc"> */}}
{{/* {{ printf `<link rel="stylesheet" href="%s" integrity="%s">` $css.RelPermalink $css.Data.Integrity | safeHTML -}} */}}
{{/* only load syntax-highlighting CSS if this page needs it */}}
{{/* {{ if .Params.highlight -}} */}}
{{/* {{ $css_syntax := resources.Get "/css/syntax.css" | minify | resources.Fingerprint "sha384" -}} */}}
{{/* {{- printf `<link rel="stylesheet" href="%s" integrity="%s">` $css_syntax.RelPermalink $css_syntax.Data.Integrity | safeHTML }} */}}
{{/* {{- end -}} */}}
<title>{{ .Title }}</title>
{{/* open graph stuff; used in the Fediverse, Signal link previe */}}
some RSS readers, and a certain large social media company -->
<meta property="og:title" content="{{ .Title }}">
<meta property="og:site_name" content="{{ $.Site.Title }}">
{{- if (eq "page" .Kind) }}
<meta property="og:type" content="article">
{{- else }}
<meta property="og:type" content="website">
{{- end -}}
{{/* ANOTHER meta image?! When will it end? */}}
{{/* {{ $og_image := resources.Get "/open_graph.png" | resources.Fingerprint "md5" -}} */}}
{{/* {{ printf `<meta property="og:image" content="%s">` $og_image.Permalink | safeHTML }} */}}
{{/* <meta property="og:image:type" content="image/png"> */}}
{{/* <meta property="og:image:height" content="630"> */}}
{{/* <meta property="og:image:width" content="1200"> */}}
{{/* <meta property="og:url" content="https://seirdy.one{{ .RelPermalink }}"> */}}
{{/* <meta property="og:description" content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.Description }}{{ end }}"> */}}
{{ hugo.Generator }}
</head>

View File

@ -0,0 +1,14 @@
<header id="banner">
<nav>
<ul class="unstyled-list">
<li class="home">
<a rel="home" href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
</li>
{{ range .Site.Menus.main.ByWeight -}}
<li>
{{ .Pre }}<a href="{{ .URL }}" title="{{ .Title }}">{{- .Name -}}</a>{{ .Post }}
</li>
{{- end }}
</ul>
</nav>
</header>

View File

@ -0,0 +1,16 @@
{{ if eq .RelPermalink "/posts.html" -}}
<h1>Posts</h1>
{{ else -}}
<h2>Posts</h2>
{{ end -}}
<ul class="unstyled-list">
{{- range where site.RegularPages "Type" "in" site.Params.mainSections }}
<li>
<time datetime="{{ .Date.Format "2006-01-02 15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
<br>
<a href="{{ .Permalink }}">
{{ .Title }}
</a>
</li>
{{- end }}
</ul>

View File

@ -0,0 +1,10 @@
{{ if .Params.footnote_heading -}}
{{ $references := `(<section class="footnotes" role="doc-endnotes">
<hr>)` -}}
{{ $heading := .Params.footnote_heading -}}
{{ $referencesWithHeading := printf `<section class="footnotes" role="doc-endnotes" aria-labelledby="note-hd">
<h2 id="note-hd">%s</h2>` ($heading) -}}
{{ .Content | replaceRE $references $referencesWithHeading | safeHTML -}}
{{ else -}}
{{ .Content -}}
{{ end -}}

16
layouts/posts/single.gmi Normal file
View File

@ -0,0 +1,16 @@
# {{$.Title | safeHTML}}
{{ $lastmod := .Lastmod -}}
{{ if lt .Date $lastmod -}}
Originally posted {{ .Date.Format "2006-01-02" }}. Last updated {{ .Lastmod.Format "2006-01-02" }}.
{{ else -}}
Posted {{ .Date.Format "2006-01-02" }}.
{{ end }}
{{ trim (readFile (replace $.File.Path ".md" ".gmi")) "\n" | safeHTML }}
---
=> / Root
=> {{ .Site.Params.src }} Gemini capsule source code
{{ .Site.Params.copyright }}

30
layouts/posts/single.html Normal file
View File

@ -0,0 +1,30 @@
{{ define "main" }}
<div itemscope itemtype="https://schema.org/BlogPosting" class="h-entry">
<article itemprop="mainEntityOfPage">
<header id="post-header">
<h1 itemprop="name headline" class="p-name">{{ .Title }}</h1>
{{ $lastmod := .Lastmod -}}
{{ if lt .Date $lastmod -}}
Posted <time class="dt-published" itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
{{- with .OutputFormats.Get "gemtext" }}
and <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>
{{- end -}}
<br>
Last updated <time itemprop="dateModified" class="dt-updated" datetime="{{ $lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>
{{ else -}}
Posted <a class="u-url" href="{{ .Site.BaseURL }}{{ .RelPermalink }}"><time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time></a>
{{- with .OutputFormats.Get "gemtext" }}
and <a href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>
{{- end -}}
{{ end }}
</header>
<section class="e-content" itemprop="articlebody">
{{ partial "processed-content" . -}}
</section>
</article>
</div>
<hr>
<footer>
<p>Thanks for reading!</p>
</footer>
{{ end }}