From e538aa847473102670654da350076d958483902c Mon Sep 17 00:00:00 2001 From: foo-dogsquared Date: Sat, 21 Sep 2019 00:11:12 +0800 Subject: [PATCH] Create the base layout --- archetypes/default.adoc | 16 ++++++ archetypes/default.md | 11 +++++ i18n/en.toml | 19 ++++++++ i18n/tl.toml | 19 ++++++++ layouts/404.html | 3 ++ layouts/_default/baseof.html | 9 ++++ layouts/_default/list.atom | 29 +++++++++++ layouts/_default/list.html | 33 +++++++++++++ layouts/_default/list.json | 20 ++++++++ layouts/_default/list.rss | 30 ++++++++++++ layouts/_default/single.html | 20 ++++++++ layouts/_default/terms.html | 13 +++++ layouts/index.atom | 29 +++++++++++ layouts/index.json | 20 ++++++++ layouts/index.rss | 30 ++++++++++++ layouts/partials/footer.html | 5 ++ layouts/partials/head.html | 4 ++ layouts/partials/header.html | 10 ++++ static/css/main.css | 94 ++++++++++++++++++++++++++++++++++++ 19 files changed, 414 insertions(+) create mode 100644 archetypes/default.adoc create mode 100644 archetypes/default.md create mode 100644 i18n/en.toml create mode 100644 i18n/tl.toml create mode 100644 layouts/404.html create mode 100644 layouts/_default/baseof.html create mode 100644 layouts/_default/list.atom create mode 100644 layouts/_default/list.html create mode 100644 layouts/_default/list.json create mode 100644 layouts/_default/list.rss create mode 100644 layouts/_default/single.html create mode 100644 layouts/_default/terms.html create mode 100644 layouts/index.atom create mode 100644 layouts/index.json create mode 100644 layouts/index.rss create mode 100644 layouts/partials/footer.html create mode 100644 layouts/partials/head.html create mode 100644 layouts/partials/header.html create mode 100644 static/css/main.css diff --git a/archetypes/default.adoc b/archetypes/default.adoc new file mode 100644 index 0000000..423f66a --- /dev/null +++ b/archetypes/default.adoc @@ -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 diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..0ef7bf9 --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,11 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +draft: true + +categories: + - "category1" +tags: + - "tag1" + - "tag2" +--- diff --git a/i18n/en.toml b/i18n/en.toml new file mode 100644 index 0000000..3778605 --- /dev/null +++ b/i18n/en.toml @@ -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" \ No newline at end of file diff --git a/i18n/tl.toml b/i18n/tl.toml new file mode 100644 index 0000000..2e14e57 --- /dev/null +++ b/i18n/tl.toml @@ -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" \ No newline at end of file diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..2cec83f --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,3 @@ +{{ define "main" }} +

404

+{{ end }} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..ab3dc99 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,9 @@ + + + {{- partial "head.html" . -}} + + {{- partial "header.html" . -}} + {{- block "main" . }}{{- end }} + {{- partial "footer.html" . -}} + + diff --git a/layouts/_default/list.atom b/layouts/_default/list.atom new file mode 100644 index 0000000..2de4e17 --- /dev/null +++ b/layouts/_default/list.atom @@ -0,0 +1,29 @@ +{{ printf "" | safeHTML }} + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}{{ with .Site.Params.Subtitle }} + {{ . | safeHTML }}{{ end }} + + + {{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} {{ $.Site.Author.name }}{{ end }} + Hugo -- gohugo.io + {{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} + + {{ .Site.Author.name }}{{ with .Site.Author.email }} + {{ . }}{{ end }} + + {{ .Permalink }} + {{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }} + {{ range first $limit (where .RegularPages "File.Dir" "!=" "/") }} + + {{ .Permalink }} + {{ .Title }} + {{ with .Params.author }} + {{ . }}{{ end }}{{ range .Params.tags }} + {{ end }} + {{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} + {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}{{ with .Params.license }} + {{ . | safeHTML }}{{ end }} + {{ .Content | html }} + + {{ end }} + \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..bf15396 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,33 @@ +{{ define "main" }} +{{ .Content }} +
+ +{{ $pages := .Pages }} +{{ if .IsHome }} +{{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }} +{{ end }} +{{ range (.Paginate $pages).Pages }} +
+

{{ .Title }}

+ {{ .Date.Format "2006-01-02" }} +
+{{ end }} + +{{ end }} \ No newline at end of file diff --git a/layouts/_default/list.json b/layouts/_default/list.json new file mode 100644 index 0000000..c1921b8 --- /dev/null +++ b/layouts/_default/list.json @@ -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 -}} +} \ No newline at end of file diff --git a/layouts/_default/list.rss b/layouts/_default/list.rss new file mode 100644 index 0000000..a2e0440 --- /dev/null +++ b/layouts/_default/list.rss @@ -0,0 +1,30 @@ +{{ printf "" | safeHTML }} + + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} {{ $.Site.Author.name }}{{ end }}{{ if not .Date.IsZero }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + https://cyber.harvard.edu/rss/rss.html + {{ with .OutputFormats.Get "RSS" }} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{ end }} + {{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }} + {{ range first $limit (where .RegularPages "File.Dir" "!=" "/") }} + + {{ .Title }} + {{ .Permalink }}{{ range .Params.tags }} + {{ . }}{{ end }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ .Permalink }} + {{ .Content | html }} + + {{ end }} + + \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..dd3bc13 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,20 @@ +{{ define "main" }} +
+

{{ .Title }}

+{{ with .Params.author }}

{{ . }}

{{ end }} +{{ .Date.Format "2006-01-02" }} +{{ if .IsTranslated }} +
+{{ i18n "available_translations" }}: +{{ range .Translations }} +{{ .Lang }} +{{ end }} +
+{{ end }} +
+ +
+{{ .Content }} +
+
+{{ end }} \ No newline at end of file diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..dfb2fd4 --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,13 @@ +{{ define "main" }} +{{ .Content }} + +

{{ .Title }}

+ + +{{ end }} \ No newline at end of file diff --git a/layouts/index.atom b/layouts/index.atom new file mode 100644 index 0000000..bb50e4c --- /dev/null +++ b/layouts/index.atom @@ -0,0 +1,29 @@ +{{ printf "" | safeHTML }} + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}{{ with .Site.Params.Subtitle }} + {{ . | safeHTML }}{{ end }} + + + {{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} {{ $.Site.Author.name }}{{ end }} + Hugo -- gohugo.io + {{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} + + {{ .Site.Author.name }}{{ with .Site.Author.email }} + {{ . }}{{ end }} + + {{ .Permalink }} + {{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }} + {{ range first $limit (where .Site.RegularPages "File.Dir" "!=" "/") }} + + {{ .Permalink }} + {{ .Title }} + {{ with .Params.author }} + {{ . }}{{ end }}{{ range .Params.tags }} + {{ end }} + {{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} + {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}{{ with .Params.license }} + {{ . | safeHTML }}{{ end }} + {{ .Content | html }} + + {{ end }} + \ No newline at end of file diff --git a/layouts/index.json b/layouts/index.json new file mode 100644 index 0000000..6e4c75b --- /dev/null +++ b/layouts/index.json @@ -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 -}} +} \ No newline at end of file diff --git a/layouts/index.rss b/layouts/index.rss new file mode 100644 index 0000000..d093962 --- /dev/null +++ b/layouts/index.rss @@ -0,0 +1,30 @@ +{{ printf "" | safeHTML }} + + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} {{ $.Site.Author.name }}{{ end }}{{ if not .Date.IsZero }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + https://cyber.harvard.edu/rss/rss.html + {{ with .OutputFormats.Get "RSS" }} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{ end }} + {{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }} + {{ range first $limit (where .Site.RegularPages "File.Dir" "!=" "/") }} + + {{ .Title }} + {{ .Permalink }}{{ range .Params.tags }} + {{ . }}{{ end }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ .Permalink }} + {{ .Content | html }} + + {{ end }} + + \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..2c05bcc --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,5 @@ +
+ +

{{ with $.Site.Copyright }}{{ . | markdownify }}{{ else }}© {{ now.Year }} {{ with $.Site.Author.name }}{{ . }}{{ else }}{{ $.Site.Title }}{{ end }}{{ end }}

\ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..10e58e2 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,4 @@ + + +{{ if .IsHome }}{{ $.Site.Title }}{{ else }}{{ .Title }}{{ end }} + \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..f33491b --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,10 @@ +{{ if not .IsPage }} +
+

{{ $.Site.Title }}

+ +
+{{ end }} \ No newline at end of file diff --git a/static/css/main.css b/static/css/main.css new file mode 100644 index 0000000..2dc398b --- /dev/null +++ b/static/css/main.css @@ -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); +} \ No newline at end of file