Compare commits
17 commits
Author | SHA1 | Date | |
---|---|---|---|
|
9185b10a81 | ||
|
d583017080 | ||
|
f6e05f4e65 | ||
|
cd671fc193 | ||
|
e2c7a20ae2 | ||
|
b72248919e | ||
|
3da2668a61 | ||
|
a9d9441c4a | ||
|
8c4c185ac5 | ||
|
e686fbc89b | ||
|
4565fba03e | ||
|
3cc3905552 | ||
|
3359f859f7 | ||
|
d4ff89ef02 | ||
|
33def459cc | ||
|
9f1cc6cace | ||
|
bb6b6e0022 |
8 changed files with 99 additions and 12 deletions
54
README.md
54
README.md
|
@ -8,13 +8,14 @@
|
||||||
- [Options](#options)
|
- [Options](#options)
|
||||||
- [Top menu](#top-menu)
|
- [Top menu](#top-menu)
|
||||||
- [Title](#title)
|
- [Title](#title)
|
||||||
|
- [Author](#author)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
First download this theme to your `themes` directory:
|
First download this theme to your `themes` directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ cd themes
|
cd themes
|
||||||
$ git clone https://github.com/getzola/after-dark.git
|
git clone https://github.com/getzola/after-dark.git
|
||||||
```
|
```
|
||||||
and then enable it in your `config.toml`:
|
and then enable it in your `config.toml`:
|
||||||
|
|
||||||
|
@ -35,8 +36,8 @@ The theme requires tags and categories taxonomies to be enabled in your `config.
|
||||||
```toml
|
```toml
|
||||||
taxonomies = [
|
taxonomies = [
|
||||||
# You can enable/disable RSS
|
# You can enable/disable RSS
|
||||||
{name = "categories", rss = true},
|
{name = "categories", feed = true},
|
||||||
{name = "tags", rss = true},
|
{name = "tags", feed = true},
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
If you want to paginate taxonomies pages, you will need to overwrite the templates
|
If you want to paginate taxonomies pages, you will need to overwrite the templates
|
||||||
|
@ -65,5 +66,50 @@ The site title is shown on the homepage. As it might be different from the `<tit
|
||||||
element that the `title` field in the config represents, you can set the `after_dark_title`
|
element that the `title` field in the config represents, you can set the `after_dark_title`
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
|
### Author
|
||||||
|
You can set this on a per page basis or in the config file.
|
||||||
|
|
||||||
|
`config.toml`:
|
||||||
|
```toml
|
||||||
|
[extra]
|
||||||
|
author = "John Smith"
|
||||||
|
```
|
||||||
|
In a page (wrap this in +++):
|
||||||
|
```toml
|
||||||
|
title = "..."
|
||||||
|
date = 1970-01-01
|
||||||
|
|
||||||
|
[extra]
|
||||||
|
author = "John Smith"
|
||||||
|
```
|
||||||
|
|
||||||
|
### KaTeX math formula support
|
||||||
|
|
||||||
|
This theme contains math formula support using [KaTeX](https://katex.org/),
|
||||||
|
which can be enabled by setting `katex_enable = true` in the `extra` section
|
||||||
|
of `config.toml`:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[extra]
|
||||||
|
katex_enable = true
|
||||||
|
```
|
||||||
|
|
||||||
|
After enabling this extension, the `katex` short code can be used in documents:
|
||||||
|
* `{{ katex(body="\KaTeX") }}` to typeset a math formula inlined into a text,
|
||||||
|
similar to `$...$` in LaTeX
|
||||||
|
* `{% katex(block=true) %}\KaTeX{% end %}` to typeset a block of math formulas,
|
||||||
|
similar to `$$...$$` in LaTeX
|
||||||
|
|
||||||
|
#### Automatic rendering without short codes
|
||||||
|
|
||||||
|
Optionally, `\\( \KaTeX \\)` inline and `\\[ \KaTeX \\]` / `$$ \KaTeX $$`
|
||||||
|
block-style automatic rendering is also supported, if enabled in the config:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[extra]
|
||||||
|
katex_enable = true
|
||||||
|
katex_auto_render = true
|
||||||
|
```
|
||||||
|
|
||||||
## Original
|
## Original
|
||||||
This template is based on the Hugo template https://git.habd.as/comfusion/after-dark
|
This template is based on the Hugo template https://git.habd.as/comfusion/after-dark
|
||||||
|
|
|
@ -5,8 +5,8 @@ description = ""
|
||||||
generate_feed = true
|
generate_feed = true
|
||||||
|
|
||||||
taxonomies = [
|
taxonomies = [
|
||||||
{name = "categories", rss = true},
|
{name = "categories", feed = true},
|
||||||
{name = "tags", rss = true},
|
{name = "tags", feed = true},
|
||||||
]
|
]
|
||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
|
|
8
netlify.toml
Normal file
8
netlify.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[build]
|
||||||
|
command = "zola build"
|
||||||
|
|
||||||
|
[build.environment]
|
||||||
|
ZOLA_VERSION = "0.16.0"
|
||||||
|
|
||||||
|
[context.deploy-preview]
|
||||||
|
command = "zola build --base-url $DEPLOY_PRIME_URL"
|
|
@ -19,6 +19,11 @@ h1, h2, h3, h4, h5, h6 {
|
||||||
line-height: 1.3em
|
line-height: 1.3em
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
fieldset {
|
fieldset {
|
||||||
border: none;
|
border: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -298,7 +303,7 @@ a:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.hack pre code:after, .hack pre code:before {
|
.hack pre code:after, .hack pre code:before {
|
||||||
content: ''
|
content: none
|
||||||
}
|
}
|
||||||
|
|
||||||
.hack code {
|
.hack code {
|
||||||
|
|
|
@ -17,8 +17,23 @@
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
<link rel="stylesheet" href="{{ get_url(path="site.css", trailing_slash=false) | safe }}">
|
<link rel="stylesheet" href="{{ get_url(path="site.css", trailing_slash=false) | safe }}">
|
||||||
|
{% if config.extra.katex_enable %}
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.css" integrity="sha384-9eLZqc9ds8eNjO3TmqPeYcDj8n+Qfa4nuSiGYa6DjLNcv9BtN69ZIulL9+8CqC9Y" crossorigin="anonymous">
|
||||||
|
{% endif %}
|
||||||
{% endblock css %}
|
{% endblock css %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{% if config.extra.katex_enable %}
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.js" integrity="sha384-K3vbOmF2BtaVai+Qk37uypf7VrgBubhQreNQe9aGsz9lB63dIFiQVlJbr92dw2Lx" crossorigin="anonymous"></script>
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/contrib/mathtex-script-type.min.js" integrity="sha384-zWYbd0NBwgTsgIdFKVprSfTh1mbMPe5Hz1X3yY4Sd1h/K1cQoUe36OGwAGz/PcDy" crossorigin="anonymous"></script>
|
||||||
|
{% if config.extra.katex_auto_render %}
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/contrib/auto-render.min.js" integrity="sha384-kmZOZB5ObwgQnS/DuDg6TScgOiWWBiVt0plIRkZCmE6rDZGrEOQeHM5PcHi+nyqe" crossorigin="anonymous"
|
||||||
|
onload="renderMathInElement(document.body);"></script>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock js %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
{% endblock extra_head %}
|
{% endblock extra_head %}
|
||||||
</head>
|
</head>
|
||||||
|
@ -33,8 +48,7 @@
|
||||||
<a itemprop="url"
|
<a itemprop="url"
|
||||||
class="{% if item.url | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}"
|
class="{% if item.url | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}"
|
||||||
href="{{ item.url | safe | replace(from="$BASE_URL", to=config.base_url) }}">
|
href="{{ item.url | safe | replace(from="$BASE_URL", to=config.base_url) }}">
|
||||||
<span itemprop="name">{{ item.name }}
|
<span itemprop="name">{{ item.name }}</span></a>
|
||||||
</span></a>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
@ -47,6 +61,11 @@
|
||||||
<h1>{{ config.extra.after_dark_title }}</h1>
|
<h1>{{ config.extra.after_dark_title }}</h1>
|
||||||
</header>
|
</header>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if section.content %}
|
||||||
|
<div>
|
||||||
|
{{ section.content | safe }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% for page in paginator.pages %}
|
{% for page in paginator.pages %}
|
||||||
{{ post_macros::page_in_list(page=page) }}
|
{{ post_macros::page_in_list(page=page) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
<footer>
|
<footer>
|
||||||
<hr>
|
<hr>
|
||||||
<p>
|
<p>
|
||||||
{% if config.extra.author %}
|
{% if page.extra.author %}
|
||||||
|
Published by {{ page.extra.author }}
|
||||||
|
{% elif config.extra.author %}
|
||||||
Published by {{ config.extra.author }}
|
Published by {{ config.extra.author }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page.taxonomies.categories %}
|
{% if page.taxonomies.categories %}
|
||||||
|
@ -27,7 +29,8 @@
|
||||||
in <a href="{{ get_taxonomy_url(kind="categories", name=category) | safe }}">{{ category }}</a>
|
in <a href="{{ get_taxonomy_url(kind="categories", name=category) | safe }}">{{ category }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page.taxonomies.tags %}
|
{% if page.taxonomies.tags %}
|
||||||
and tagged
|
{% if page.taxonomies.categories %}and{% endif %}
|
||||||
|
tagged
|
||||||
{% for tag in page.taxonomies.tags %}
|
{% for tag in page.taxonomies.tags %}
|
||||||
<a href="{{ get_taxonomy_url(kind="tags", name=tag) | safe }}">{{ tag }}</a>
|
<a href="{{ get_taxonomy_url(kind="tags", name=tag) | safe }}">{{ tag }}</a>
|
||||||
{% if page.taxonomies.tags | length > 1 %}
|
{% if page.taxonomies.tags | length > 1 %}
|
||||||
|
@ -49,4 +52,3 @@
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,12 @@
|
||||||
{{ page.summary | safe }}
|
{{ page.summary | safe }}
|
||||||
<nav class="readmore"><a itemprop="url" href="{{ page.permalink | safe }}">Read More »</a></nav>
|
<nav class="readmore"><a itemprop="url" href="{{ page.permalink | safe }}">Read More »</a></nav>
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div itemprop="summary">
|
||||||
|
{{ page.content | striptags | truncate | safe }}
|
||||||
|
<nav class="readmore"><a itemprop="url" href="{{ page.permalink | safe }}">Read More »</a></nav>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
{% endmacro page_in_list %}
|
{% endmacro page_in_list %}
|
||||||
|
|
1
templates/shortcodes/katex.html
Normal file
1
templates/shortcodes/katex.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<script type="math/tex{% if block %};mode=display{% endif %}">{{body}}</script>
|
Loading…
Reference in a new issue