Create the base layout

This commit is contained in:
foo-dogsquared 2019-09-21 00:11:12 +08:00
parent a9e07c814d
commit e538aa8474
19 changed files with 414 additions and 0 deletions

16
archetypes/default.adoc Normal file
View File

@ -0,0 +1,16 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
categories:
- "category1"
tags:
- "tag1"
- "tag2"
---
= {{ replace .Name "-" " " | title }}
{{ .Site.Author.name }} {{ with .Site.Author.email }}<{{ . }}>{{ end }}
{{ dateFormat "2006-01-02" .Date }}
:stem: latexmath

11
archetypes/default.md Normal file
View File

@ -0,0 +1,11 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
categories:
- "category1"
tags:
- "tag1"
- "tag2"
---

19
i18n/en.toml Normal file
View File

@ -0,0 +1,19 @@
# Pagination
[first_page]
other = "First page"
[prev_page]
other = "Previous page"
[next_page]
other = "Next page"
[last_page]
other = "Last page"
# General
[back_to_home]
other = "Back to home"
[available_translations]
other = "Available translations"

19
i18n/tl.toml Normal file
View File

@ -0,0 +1,19 @@
# Pagination
[first_page]
other = "Unang pahina"
[prev_page]
other = "Balik"
[next_page]
other = "Sunod"
[last_page]
other = "Huling pahina"
# General
[back_to_home]
other = "Balik sa homepage"
[available_translations]
other = "Mga pagsasalin"

3
layouts/404.html Normal file
View File

@ -0,0 +1,3 @@
{{ define "main" }}
<h1>404</h1>
{{ end }}

View File

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

View File

@ -0,0 +1,29 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>{{ with .Site.Params.Subtitle }}
<subtitle type="html">{{ . | safeHTML }}</subtitle>{{ end }}
<link rel="alternate" type="text/html" href="{{ .Site.BaseURL }}"/>
<link rel="self" type="application/atom+xml" href="{{ with .OutputFormats.Get "ATOM" }}{{ .Permalink }}{{ end }}"/>
<rights>{{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} {{ $.Site.Author.name }}{{ end }}</rights>
<generator>Hugo -- gohugo.io</generator>
<updated>{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</updated>
<author>
<name>{{ .Site.Author.name }}</name>{{ with .Site.Author.email }}
<email>{{ . }}</email>{{ end }}
</author>
<id>{{ .Permalink }}</id>
{{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }}
{{ range first $limit (where .RegularPages "File.Dir" "!=" "/") }}
<entry>
<id>{{ .Permalink }}</id>
<title type="text">{{ .Title }}</title>
<link rel="alternate" href="{{ .Permalink }}" hreflang="{{ .Site.Language.Lang }}" title="{{ .Title | safeHTML }}"/>{{ with .Params.author }}
<author><name>{{ . }}<name></author>{{ end }}{{ range .Params.tags }}
<category term="{{ . }}"/>{{ end }}
<published>{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</published>
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</updated>{{ with .Params.license }}
<rights type="html">{{ . | safeHTML }}<rights>{{ end }}
<content type="html">{{ .Content | html }}</content>
</entry>
{{ end }}
</feed>

View File

@ -0,0 +1,33 @@
{{ define "main" }}
{{ .Content }}
<hr>
{{ $pages := .Pages }}
{{ if .IsHome }}
{{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }}
{{ end }}
{{ range (.Paginate $pages).Pages }}
<article class="post">
<a href="{{ .Permalink }}"><h1>{{ .Title }}</h1></a>
<date datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</date>
</article>
{{ end }}
<div class="pagination">
{{ if .Paginator.HasPrev }}
{{ if ne .Paginator.First .Paginator.Prev }}
<a rel="first" href="{{ .Paginator.First.URL }}">{{ i18n "first_page" }}</a>
{{ end }}
<a rel="prev" href="{{ .Paginator.Prev.URL }}">{{ i18n "prev_page" }}</a>
{{ end }}
{{ if .Paginator.HasNext }}
<a rel="next" href="{{ .Paginator.Next.URL }}">{{ i18n "next_page" }}</a>
{{ if ne .Paginator.Last .Paginator.Next }}
<a rel="last" href="{{ .Paginator.Last.URL }}">{{ i18n "last_page" }}</a>
{{ end }}
{{ end }}
</div>
{{ end }}

View File

@ -0,0 +1,20 @@
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}",
"home_page_url": "{{ .Site.BaseURL }}",
"feed_url": "{{ with .OutputFormats.Get "json" }}{{ .Permalink }}{{ end }}",
"description": "Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}",
"favicon": "{{ "assets/icon.png" | absURL }}",
"icon": "{{ "assets/icon.png" | absURL }}",
"author": {
"name": "{{ with .Site.Author.name }}{{ . }}{{ end }}"
},
"items":
{{- $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 -}}
{{- $pages := first $limit (where .RegularPages "File.Dir" "!=" "/") -}}
{{- $.Scratch.Add "index" slice -}}
{{- range $pages -}}
{{- $.Scratch.Add "index" (dict "id" .Permalink "url" .Permalink "title" .Title "summary" .Summary "content_html" .Content "tags" .Params.tags "date_published" (.Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML) "date_modified" ( .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML ) ) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}
}

30
layouts/_default/list.rss Normal file
View File

@ -0,0 +1,30 @@
{{ 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 -- 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}}
<copyright>{{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} {{ $.Site.Author.name }}{{ end }}</copyright>{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
<docs>https://cyber.harvard.edu/rss/rss.html</docs>
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }}
{{ range first $limit (where .RegularPages "File.Dir" "!=" "/") }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>{{ range .Params.tags }}
<category>{{ . }}</category>{{ 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}}
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description>
</item>
{{ end }}
</channel>
</rss>

View File

@ -0,0 +1,20 @@
{{ define "main" }}
<main>
<h1 class="post-title">{{ .Title }}</h1>
{{ with .Params.author }}<p>{{ . }}</p>{{ end }}
<date datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</date>
{{ if .IsTranslated }}
<div>
{{ i18n "available_translations" }}:
{{ range .Translations }}
<a href="{{ .Permalink }}">{{ .Lang }}</a>
{{ end }}
</div>
{{ end }}
<hr>
<article>
{{ .Content }}
</article>
</main>
{{ end }}

View File

@ -0,0 +1,13 @@
{{ define "main" }}
{{ .Content }}
<h1>{{ .Title }}</h1>
<ul>
{{ range .Data.Terms }}
<li>
<a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a> ({{ .Count }})
</li>
{{ end }}
</ul>
{{ end }}

29
layouts/index.atom Normal file
View File

@ -0,0 +1,29 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>{{ with .Site.Params.Subtitle }}
<subtitle type="html">{{ . | safeHTML }}</subtitle>{{ end }}
<link rel="alternate" type="text/html" href="{{ .Site.BaseURL }}"/>
<link rel="self" type="application/atom+xml" href="{{ with .OutputFormats.Get "ATOM" }}{{ .Permalink }}{{ end }}"/>
<rights>{{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} {{ $.Site.Author.name }}{{ end }}</rights>
<generator>Hugo -- gohugo.io</generator>
<updated>{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</updated>
<author>
<name>{{ .Site.Author.name }}</name>{{ with .Site.Author.email }}
<email>{{ . }}</email>{{ end }}
</author>
<id>{{ .Permalink }}</id>
{{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }}
{{ range first $limit (where .Site.RegularPages "File.Dir" "!=" "/") }}
<entry>
<id>{{ .Permalink }}</id>
<title type="text">{{ .Title }}</title>
<link rel="alternate" href="{{ .Permalink }}" hreflang="{{ .Site.Language.Lang }}" title="{{ .Title | safeHTML }}"/>{{ with .Params.author }}
<author><name>{{ . }}<name></author>{{ end }}{{ range .Params.tags }}
<category term="{{ . }}"/>{{ end }}
<published>{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</published>
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</updated>{{ with .Params.license }}
<rights type="html">{{ . | safeHTML }}<rights>{{ end }}
<content type="html">{{ .Content | html }}</content>
</entry>
{{ end }}
</feed>

20
layouts/index.json Normal file
View File

@ -0,0 +1,20 @@
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}",
"home_page_url": "{{ .Site.BaseURL }}",
"feed_url": "{{ with .OutputFormats.Get "json" }}{{ .Permalink }}{{ end }}",
"description": "Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}",
"favicon": "{{ "assets/icon.png" | absURL }}",
"icon": "{{ "assets/icon.png" | absURL }}",
"author": {
"name": "{{ with .Site.Author.name }}{{ . }}{{ end }}"
},
"items":
{{- $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 -}}
{{- $pages := first $limit (where .Site.RegularPages "File.Dir" "!=" "/") -}}
{{- $.Scratch.Add "index" slice -}}
{{- range $pages -}}
{{- $.Scratch.Add "index" (dict "id" .Permalink "url" .Permalink "title" .Title "summary" .Summary "content_html" .Content "tags" .Params.tags "date_published" (.Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML) "date_modified" ( .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML ) ) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}
}

30
layouts/index.rss Normal file
View File

@ -0,0 +1,30 @@
{{ 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 -- 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}}
<copyright>{{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} {{ $.Site.Author.name }}{{ end }}</copyright>{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
<docs>https://cyber.harvard.edu/rss/rss.html</docs>
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }}
{{ range first $limit (where .Site.RegularPages "File.Dir" "!=" "/") }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>{{ range .Params.tags }}
<category>{{ . }}</category>{{ 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}}
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description>
</item>
{{ end }}
</channel>
</rss>

View File

@ -0,0 +1,5 @@
<hr>
<footer>
<p><a href="{{ $.Site.BaseURL }}">{{ i18n "back_to_home" }}</a></p>
</footer>
<p>{{ with $.Site.Copyright }}{{ . | markdownify }}{{ else }}© {{ now.Year }} {{ with $.Site.Author.name }}{{ . }}{{ else }}{{ $.Site.Title }}{{ end }}{{ end }}</p>

View File

@ -0,0 +1,4 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ if .IsHome }}{{ $.Site.Title }}{{ else }}{{ .Title }}{{ end }}</title>
<link rel="stylesheet" href="{{"css/main.css" | absURL }}" />

View File

@ -0,0 +1,10 @@
{{ if not .IsPage }}
<header>
<h1>{{ $.Site.Title }}</h1>
<nav>
{{ range $.Site.Menus.main -}}
<a href="{{ .URL | absURL }}">{{ .Name }}</a>
{{ end }}
</nav>
</header>
{{ end }}

94
static/css/main.css Normal file
View File

@ -0,0 +1,94 @@
:root {
--background: #000000;
--background-light: #cecccc;
--foreground: #ffffff;
--fontSize: 1.25rem;
--verticalRhythm: 2rem;
--contentWidth: 900px;
}
html {
margin: 0;
padding: 0;
}
*, *::before, *::after { box-sizing: border-box; }
body {
line-height: var(--verticalRhythm);
margin: 0 auto;
max-width: var(--contentWidth);
padding: 1rem;
font-family: sans-serif;
}
@media screen and (min-width: 900px) {
body {
font-size: var(--fontSize);
}
}
nav {
margin: var(--verticalRhythm) auto;
}
nav > * {
background: var(--background-light);
padding: 0.5rem;
}
table, thead, tbody {
border: var(--background) solid 1px;
margin: 0 auto;
border-collapse: collapse;
}
th, td {
border: var(--background) solid 1px;
padding: 1rem;
}
tr:nth-child(even) {
background: var(--background-light);
}
pre {
padding: 1rem;
border: var(--background) solid 1px;
overflow: auto;
}
img, video, audio, iframe {
width: 100%;
height: auto;
}
footer {
display: flex;
justify-content: space-evenly;
align-items: center;
}
.pagination {
list-style: none;
display: flex;
justify-content: space-evenly;
padding: 0;
margin: var(--verticalRhythm);
}
.page-item {
padding: 0.5rem;
border: var(--background) solid 1px;
}
.post {
display: flex;
justify-content: space-between;
align-items: center;
}
.post-title {
font-size: calc(var(--fontSize) * 2.5);
line-height: calc(var(--fontSize) * 3);
}