diff options
author | Alan Pearce | 2020-11-15 13:14:37 +0100 |
---|---|---|
committer | Alan Pearce | 2020-11-15 13:15:31 +0100 |
commit | 6385a5f78ce2ad7409811927b10fc2b62e427643 (patch) | |
tree | 557406eaea728d84f82e852ada8fd97199d1a709 /themes | |
parent | 78096da0f478a0b11b77f365cedc855e7c680e14 (diff) | |
download | website-6385a5f78ce2ad7409811927b10fc2b62e427643.tar.lz website-6385a5f78ce2ad7409811927b10fc2b62e427643.tar.zst website-6385a5f78ce2ad7409811927b10fc2b62e427643.zip |
Extract theme from templates
Diffstat (limited to 'themes')
-rw-r--r-- | themes/xmin/static/css/style.css | 75 | ||||
-rw-r--r-- | themes/xmin/templates/base.html | 25 | ||||
l--------- | themes/xmin/templates/categories/list.html | 1 | ||||
l--------- | themes/xmin/templates/categories/single.html | 1 | ||||
-rw-r--r-- | themes/xmin/templates/index.html | 36 | ||||
-rw-r--r-- | themes/xmin/templates/page.html | 28 | ||||
-rw-r--r-- | themes/xmin/templates/section.html | 18 | ||||
-rw-r--r-- | themes/xmin/templates/tags/list.html | 18 | ||||
-rw-r--r-- | themes/xmin/templates/tags/single.html | 25 | ||||
-rw-r--r-- | themes/xmin/theme.toml | 12 |
10 files changed, 239 insertions, 0 deletions
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 @@ | |||
1 | body { | ||
2 | font-family: sans-serif; | ||
3 | line-height: 1.5em; | ||
4 | margin: auto; | ||
5 | max-width: 800px; | ||
6 | padding: 1em; | ||
7 | } | ||
8 | |||
9 | /* header and footer areas */ | ||
10 | nav > ul { padding: 0; } | ||
11 | nav > ul > li { display: inline-block; } | ||
12 | article > header, nav > ul a { | ||
13 | background: #eee; | ||
14 | border-radius: 5px; | ||
15 | padding: 5px; | ||
16 | text-decoration: none; | ||
17 | } | ||
18 | .terms { font-size: .9em; } | ||
19 | nav > ul, article > header, footer { text-align: center; } | ||
20 | .title { font-size: 1.1em; } | ||
21 | footer a { text-decoration: none; } | ||
22 | hr { | ||
23 | border-style: dashed; | ||
24 | color: #ddd; | ||
25 | } | ||
26 | body > nav { | ||
27 | border-bottom: 1px solid #ddd; | ||
28 | } | ||
29 | body > footer { | ||
30 | border-top: 1px solid #ddd; | ||
31 | } | ||
32 | |||
33 | /* code */ | ||
34 | pre { | ||
35 | border: 1px solid #ddd; | ||
36 | overflow-x: auto; | ||
37 | padding: 1em; | ||
38 | } | ||
39 | code { background: #f9f9f9; } | ||
40 | pre code { background: none; } | ||
41 | |||
42 | /* misc elements */ | ||
43 | img, iframe, video { max-width: 100%; } | ||
44 | main { hyphens: auto; } | ||
45 | blockquote { | ||
46 | background: #f9f9f9; | ||
47 | border-left: 5px solid #ccc; | ||
48 | padding: 3px 1em 3px; | ||
49 | } | ||
50 | |||
51 | table thead th { border-bottom: 1px solid #ddd; } | ||
52 | th, td { padding: 5px; } | ||
53 | thead, tfoot, tr:nth-child(even) { background: #eee; } | ||
54 | .hl { background-color: #ffc; } | ||
55 | |||
56 | @media (prefers-color-scheme: dark) { | ||
57 | body { | ||
58 | background-color: #111; | ||
59 | color: white; | ||
60 | } | ||
61 | article > header, nav > ul a { | ||
62 | background: #222; | ||
63 | } | ||
64 | a { | ||
65 | color: #C4D4EE; | ||
66 | } | ||
67 | a:visited { | ||
68 | color: #CEDEE0; | ||
69 | } | ||
70 | code { background-color: #444; } | ||
71 | thead, tfoot, tr:nth-child(even) { background: #222; } | ||
72 | .hl { | ||
73 | background-color: #555; | ||
74 | } | ||
75 | } | ||
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 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html lang="{{ config.default_language }}"> | ||
3 | <head> | ||
4 | <meta charset="utf-8"> | ||
5 | <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
6 | <title {%- if current_path == '/' %} class="p-name"{% endif %}>{% block title %}{{ section.title }} | {{ config.title }}{% endblock %}</title> | ||
7 | <link rel="stylesheet" href="/css/style.css" /> | ||
8 | {%- if config.generate_feed %} | ||
9 | {%- block rss %} | ||
10 | <link rel="alternate" type={% if config.feed_filename == "atom.xml" %}"application/atom+xml"{% else %}"application/rss+xml"{% endif %} title="RSS" href="{{ get_url(path=config.feed_filename) | safe }}"> | ||
11 | {%- endblock %} | ||
12 | {%- endif %} | ||
13 | </head> | ||
14 | <body> | ||
15 | <nav> | ||
16 | <ul> | ||
17 | {%- for item in config.extra.menu.main %} | ||
18 | <li><a {%- if item.url == "/" %} class="author"{% endif %} href="{{ item.url | safe }}">{{ item.name }}</a></li> | ||
19 | {%- endfor %} | ||
20 | </ul> | ||
21 | </nav> | ||
22 | {% block main %}{% endblock %} | ||
23 | <footer>{{ config.extra.footer | safe }}</footer> | ||
24 | </body> | ||
25 | </html> | ||
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 @@ | |||
1 | {% extends "base.html" %} | ||
2 | |||
3 | {% block main %} | ||
4 | <main class="h-card"> | ||
5 | <h1 class="p-name">{{ config.title }}</h1> | ||
6 | {{ section.content | safe }} | ||
7 | <section> | ||
8 | <h2>Latest Posts</h2> | ||
9 | <ul class="h-feed"> | ||
10 | {%- for page in section.pages | slice(end=3) %} | ||
11 | <li class="h-entry"> | ||
12 | <time class="dt-published" datetime="{{ page.date | date(format="%+") }}">{{ page.date | date(format="%F") }}</time> | ||
13 | <a class="u-url p-name" href="{{ page.path | safe }}">{{ page.title }}</a> | ||
14 | </li> | ||
15 | {%- endfor %} | ||
16 | </ul> | ||
17 | </section> | ||
18 | <section> | ||
19 | <h2>Elsewhere on the Internet</h2> | ||
20 | <ul> | ||
21 | {%- for item in config.extra.menu.contact %} | ||
22 | <li> | ||
23 | {%- if item.url is starting_with("mailto:") %} | ||
24 | <a href="{{ item.url | safe }}" class="u-email email" rel="me">{{ item.name }}</a> | ||
25 | {%- else %} | ||
26 | <a href="{{ item.url | safe }}" class="u-url url" rel="me">{{ item.name }}</a> | ||
27 | {%- endif %} | ||
28 | </li> | ||
29 | {%- endfor %} | ||
30 | </ul> | ||
31 | </section> | ||
32 | <footer> | ||
33 | GPG Key: <a href="{{ config.extra.gpg_url | safe }}" rel="u-key pgpkey">{{ config.extra.gpg_fingerprint }}</a> | ||
34 | </footer> | ||
35 | </main> | ||
36 | {% 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 @@ | |||
1 | {% extends "base.html" %} | ||
2 | |||
3 | {% block title %} | ||
4 | {{- page.title -}} | ||
5 | {% endblock %} | ||
6 | |||
7 | {% block main %} | ||
8 | <article class="h-entry"> | ||
9 | <header> | ||
10 | <h1><span class="title p-name">{{ page.title }}</span></h1> | ||
11 | <time class="dt-published" datetime="{{ page.date | date(format='%+') }}">{{ page.date | date(format="%F") }}</time> | ||
12 | <p class="terms"> | ||
13 | {%- if page.taxonomies %} | ||
14 | {%- for name, taxon in page.taxonomies %} | ||
15 | {{ name | capitalize }}: | ||
16 | {%- for item in taxon %} | ||
17 | <a class="p-category" href="{{ get_taxonomy_url(kind=name, name=item) }}">{{ item }}</a> | ||
18 | {%- endfor %} | ||
19 | {%- endfor %} | ||
20 | {%- endif %} | ||
21 | </p> | ||
22 | </header> | ||
23 | |||
24 | <main class="e-content"> | ||
25 | {{ page.content | safe }} | ||
26 | </main> | ||
27 | </article> | ||
28 | {% 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 @@ | |||
1 | {% extends "base.html" %} | ||
2 | |||
3 | {% block main %} | ||
4 | <main> | ||
5 | <h1>{{ section.title }}</h1> | ||
6 | {{ section.content }} | ||
7 | <section> | ||
8 | <ul> | ||
9 | {% for page in section.pages %} | ||
10 | <li class="h-entry"> | ||
11 | <time class="dt-published" datetime="{{ page.date | date(format="%+") }}">{{ page.date | date(format="%F") }}</time> | ||
12 | <a class="u-url p-name" href="{{ page.path | safe }}">{{ page.title }}</a> | ||
13 | </li> | ||
14 | {% endfor %} | ||
15 | </ul> | ||
16 | </section> | ||
17 | </main> | ||
18 | {% 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 @@ | |||
1 | {% extends "base.html" %} | ||
2 | |||
3 | {% block title %}{{ taxonomy.name | capitalize }}{% endblock %} | ||
4 | |||
5 | {% block main %} | ||
6 | <main> | ||
7 | <h1>{{ taxonomy.name | capitalize }}</h1> | ||
8 | <section> | ||
9 | <ul> | ||
10 | {%- for term in terms %} | ||
11 | <li> | ||
12 | <a href="{{ term.permalink }}">{{ term.name }}</a> | ||
13 | </li> | ||
14 | {%- endfor %} | ||
15 | </ul> | ||
16 | </section> | ||
17 | </main> | ||
18 | {% 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 @@ | |||
1 | {% extends "base.html" %} | ||
2 | |||
3 | {% block rss %} | ||
4 | {% set rss_path = "tags/" ~ term.name ~ "/atom.xml" %} | ||
5 | <link rel="alternate" type="application/atom+xml" title="RSS" href="{{ get_url(path=rss_path, trailing_slash=false) | safe }}"> | ||
6 | |||
7 | {% endblock %} | ||
8 | |||
9 | {% block title %}{{ taxonomy.name | capitalize }}: {{ term.name }} | {{ config.title }}{% endblock %} | ||
10 | |||
11 | {% block main %} | ||
12 | <main> | ||
13 | <h1>{{ taxonomy.name | capitalize }}: {{ term.name }}</h1> | ||
14 | <section> | ||
15 | <ul class="h-feed"> | ||
16 | {%- for page in term.pages %} | ||
17 | <li class="h-entry"> | ||
18 | <time class="dt-published" datetime="{{ page.date | date(format="%+") }}">{{ page.date | date(format="%F") }}</time> | ||
19 | <a class="u-url p-name" href="{{ page.permalink | safe }}">{{ page.title }}</a> | ||
20 | </li> | ||
21 | {%- endfor %} | ||
22 | </ul> | ||
23 | </section> | ||
24 | </main> | ||
25 | {% 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 @@ | |||
1 | name = "xmin" | ||
2 | description = "XMin is a Hugo theme written by Yihui Xie in about four hours" | ||
3 | license = "MIT" | ||
4 | |||
5 | [author] | ||
6 | name = "Alan Pearce" | ||
7 | homepage = "https://www.alanpearce.eu" | ||
8 | |||
9 | [original] | ||
10 | author = "yihui" | ||
11 | homepage = "https://yihui.org" | ||
12 | repo = "https://github.com/yihui/hugo-xmin" \ No newline at end of file | ||