From 6385a5f78ce2ad7409811927b10fc2b62e427643 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Nov 2020 13:14:37 +0100 Subject: Extract theme from templates --- themes/xmin/static/css/style.css | 75 ++++++++++++++++++++++++++++ themes/xmin/templates/base.html | 25 ++++++++++ themes/xmin/templates/categories/list.html | 1 + themes/xmin/templates/categories/single.html | 1 + themes/xmin/templates/index.html | 36 +++++++++++++ themes/xmin/templates/page.html | 28 +++++++++++ themes/xmin/templates/section.html | 18 +++++++ themes/xmin/templates/tags/list.html | 18 +++++++ themes/xmin/templates/tags/single.html | 25 ++++++++++ themes/xmin/theme.toml | 12 +++++ 10 files changed, 239 insertions(+) create mode 100644 themes/xmin/static/css/style.css create mode 100644 themes/xmin/templates/base.html create mode 120000 themes/xmin/templates/categories/list.html create mode 120000 themes/xmin/templates/categories/single.html create mode 100644 themes/xmin/templates/index.html create mode 100644 themes/xmin/templates/page.html create mode 100644 themes/xmin/templates/section.html create mode 100644 themes/xmin/templates/tags/list.html create mode 100644 themes/xmin/templates/tags/single.html create mode 100644 themes/xmin/theme.toml (limited to 'themes') diff --git a/themes/xmin/static/css/style.css b/themes/xmin/static/css/style.css new file mode 100644 index 0000000..e605297 --- /dev/null +++ b/themes/xmin/static/css/style.css @@ -0,0 +1,75 @@ +body { + font-family: sans-serif; + line-height: 1.5em; + margin: auto; + max-width: 800px; + padding: 1em; +} + +/* header and footer areas */ +nav > ul { padding: 0; } +nav > ul > li { display: inline-block; } +article > header, nav > ul a { + background: #eee; + border-radius: 5px; + padding: 5px; + text-decoration: none; +} +.terms { font-size: .9em; } +nav > ul, article > header, footer { text-align: center; } +.title { font-size: 1.1em; } +footer a { text-decoration: none; } +hr { + border-style: dashed; + color: #ddd; +} +body > nav { + border-bottom: 1px solid #ddd; +} +body > footer { + border-top: 1px solid #ddd; +} + +/* code */ +pre { + border: 1px solid #ddd; + overflow-x: auto; + padding: 1em; +} +code { background: #f9f9f9; } +pre code { background: none; } + +/* misc elements */ +img, iframe, video { max-width: 100%; } +main { hyphens: auto; } +blockquote { + background: #f9f9f9; + border-left: 5px solid #ccc; + padding: 3px 1em 3px; +} + +table thead th { border-bottom: 1px solid #ddd; } +th, td { padding: 5px; } +thead, tfoot, tr:nth-child(even) { background: #eee; } +.hl { background-color: #ffc; } + +@media (prefers-color-scheme: dark) { + body { + background-color: #111; + color: white; + } + article > header, nav > ul a { + background: #222; + } + a { + color: #C4D4EE; + } + a:visited { + color: #CEDEE0; + } + code { background-color: #444; } + thead, tfoot, tr:nth-child(even) { background: #222; } + .hl { + background-color: #555; + } +} diff --git a/themes/xmin/templates/base.html b/themes/xmin/templates/base.html new file mode 100644 index 0000000..6b99609 --- /dev/null +++ b/themes/xmin/templates/base.html @@ -0,0 +1,25 @@ + + + + + + {% block title %}{{ section.title }} | {{ config.title }}{% endblock %} + + {%- if config.generate_feed %} + {%- block rss %} + + {%- endblock %} + {%- endif %} + + + + {% block main %}{% endblock %} + + + diff --git a/themes/xmin/templates/categories/list.html b/themes/xmin/templates/categories/list.html new file mode 120000 index 0000000..e0e4e08 --- /dev/null +++ b/themes/xmin/templates/categories/list.html @@ -0,0 +1 @@ +../tags/list.html \ No newline at end of file diff --git a/themes/xmin/templates/categories/single.html b/themes/xmin/templates/categories/single.html new file mode 120000 index 0000000..86f5e80 --- /dev/null +++ b/themes/xmin/templates/categories/single.html @@ -0,0 +1 @@ +../tags/single.html \ No newline at end of file diff --git a/themes/xmin/templates/index.html b/themes/xmin/templates/index.html new file mode 100644 index 0000000..23ec4cd --- /dev/null +++ b/themes/xmin/templates/index.html @@ -0,0 +1,36 @@ +{% extends "base.html" %} + +{% block main %} +
+

{{ config.title }}

+ {{ section.content | safe }} +
+

Latest Posts

+ +
+
+

Elsewhere on the Internet

+ +
+ +
+{% endblock %} diff --git a/themes/xmin/templates/page.html b/themes/xmin/templates/page.html new file mode 100644 index 0000000..f32a6fc --- /dev/null +++ b/themes/xmin/templates/page.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} + +{% block title %} +{{- page.title -}} +{% endblock %} + +{% block main %} +
+
+

{{ page.title }}

+ +

+ {%- if page.taxonomies %} + {%- for name, taxon in page.taxonomies %} + {{ name | capitalize }}: + {%- for item in taxon %} + {{ item }} + {%- endfor %} + {%- endfor %} + {%- endif %} +

+
+ +
+ {{ page.content | safe }} +
+
+{% endblock %} diff --git a/themes/xmin/templates/section.html b/themes/xmin/templates/section.html new file mode 100644 index 0000000..e61566f --- /dev/null +++ b/themes/xmin/templates/section.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} + +{% block main %} +
+

{{ section.title }}

+ {{ section.content }} +
+ +
+
+{% endblock %} diff --git a/themes/xmin/templates/tags/list.html b/themes/xmin/templates/tags/list.html new file mode 100644 index 0000000..ee60c39 --- /dev/null +++ b/themes/xmin/templates/tags/list.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} + +{% block title %}{{ taxonomy.name | capitalize }}{% endblock %} + +{% block main %} +
+

{{ taxonomy.name | capitalize }}

+
+ +
+
+{% endblock %} diff --git a/themes/xmin/templates/tags/single.html b/themes/xmin/templates/tags/single.html new file mode 100644 index 0000000..25dde54 --- /dev/null +++ b/themes/xmin/templates/tags/single.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} + +{% block rss %} + {% set rss_path = "tags/" ~ term.name ~ "/atom.xml" %} + + +{% endblock %} + +{% block title %}{{ taxonomy.name | capitalize }}: {{ term.name }} | {{ config.title }}{% endblock %} + +{% block main %} +
+

{{ taxonomy.name | capitalize }}: {{ term.name }}

+
+ +
+
+{% endblock %} diff --git a/themes/xmin/theme.toml b/themes/xmin/theme.toml new file mode 100644 index 0000000..99884b9 --- /dev/null +++ b/themes/xmin/theme.toml @@ -0,0 +1,12 @@ +name = "xmin" +description = "XMin is a Hugo theme written by Yihui Xie in about four hours" +license = "MIT" + +[author] +name = "Alan Pearce" +homepage = "https://www.alanpearce.eu" + +[original] +author = "yihui" +homepage = "https://yihui.org" +repo = "https://github.com/yihui/hugo-xmin" \ No newline at end of file -- cgit 1.4.1