Merge branch 'zenn-v0.2.1' into 'master'

Zenn v0.2.1

See merge request timvisee/timvisee.com!4
This commit is contained in:
Tim Visée 2021-03-01 16:59:02 +00:00
commit 7fcf35bca0
12 changed files with 73 additions and 37 deletions

View File

@ -46,4 +46,4 @@ zenn_source = "https://gitlab.com/timvisee/timvisee.com/"
# Random string, used in URLs to force update resources
# Change this value when stylesheets or scripts are updated
random = "2021-02-27"
random = "2021-02-28"

View File

@ -7,6 +7,7 @@ categories = ["guide", "blog"]
tags = ["windows", "terminal", "linux"]
[extra]
toc = true
zenn_applause = true
comments = [
{url = "https://news.ycombinator.com/item?id=20383725", name = "Hacker News"},

View File

@ -7,6 +7,7 @@ categories = ["guide", "blog"]
tags = ["web", "css", "javascript", "theme", "website"]
[extra]
toc = true
zenn_applause = true
+++

View File

@ -7,6 +7,7 @@ categories = ["blog"]
tags = ["hack", "web", "xss", "javascript"]
[extra]
toc = true
zenn_applause = true
comments = [
{url = "https://news.ycombinator.com/item?id=21371201", name = "Hacker News"},

View File

@ -10,6 +10,7 @@ categories = ["blog"]
tags = ["bash", "shell"]
[extra]
toc = true
zenn_applause = true
+++

View File

@ -7,6 +7,7 @@ categories = ["blog"]
tags = ["rust", "performance", "aoc"]
[extra]
toc = true
zenn_applause = true
comments = [
{url = "https://news.ycombinator.com/item?id=26286781", name = "Hacker News"},

View File

@ -62,7 +62,6 @@ content {
background-color: $color-code-bg !important;
border-radius: 4px;
transition: background-color 0.2s ease,
box-shadow 0.2s ease,
border 0.2s ease;
// Hack to keep code blocks dark, also in light mode
@ -112,6 +111,32 @@ content {
padding-left: 1em;
transition: border 0.2s ease;
}
#toc-container {
margin-top: 1em;
padding: 1em;
box-sizing: border-box;
background-color: $color-main-bg-alt;
border-radius: 4px;
transition: background-color 0.2s ease,
border 0.2s ease;
h4 {
margin: 0 0 0.5em 0;
}
select#toc-select {
width: 100%;
padding: 0.5em;
color: $color-text;
background: $color-main-bg;
border: 1px solid $color-main-border;
border-radius: 4px;
transition: background-color 0.2s ease,
border-color 0.2s ease,
color 0.2s ease;
}
}
}
/**
@ -144,8 +169,7 @@ content {
padding: 0.2em 0.4em;
line-height: 1;
margin: 0 0.2em 0.2em 0;
transition: box-shadow 0.2s ease,
background-color 0.2s ease;
transition: background-color 0.2s ease;
}
a.tag {

View File

@ -8,8 +8,6 @@ $color-text-muted: darken($color-text, 25%);
$color-main-bg: #141516;
$color-main-bg-alt: darken($color-main-bg, 2%);
$color-main-border: darken($color-main-bg, 5%);
$color-main-shadow: rgba($color-main-border, 0.4);
// $color-header: #fb4625;
$color-header: #FF6F33;
$color-link: #6699cc;
$color-link-hover: lighten($color-link, 15%);

View File

@ -8,7 +8,6 @@ $color-text-muted: lighten($color-text, 35%);
$color-main-bg: #fcfbf7;
$color-main-bg-alt: darken($color-main-bg, 5%);
$color-main-border: darken($color-main-bg, 15%);
$color-main-shadow: rgba(darken(#20201d, 8%), 0.1);
$color-header: #1d4761; // 1d4761
$color-link: #77660b; // 336ef5
$color-link-hover: darken($color-link, 10%);

View File

@ -13,6 +13,45 @@
</header>
#}
{# Table of contents #}
{% if page.extra.toc -%}
<div id="toc-container">
<h4>Table of contents</h4>
<select id="toc-select">
{# Post title #}
<option value="{{ current_url }}#">{{ page.title }}</option>
<option disabled>──────────</option>
{# Post headers, with children #}
{% for h1 in page.toc %}
<option value="{{ h1.permalink | safe }}">{{ loop.index }}. {{ h1.title }}</option>
{% if h1.children %}
{% for h2 in h1.children %}
<option value="{{h2.permalink |
safe}}">&nbsp;&nbsp;&nbsp;&nbsp;{{ loop.index }}. {{ h2.title }}</option>
{% endfor %}
{% endif %}
{% endfor %}
{# Comments link #}
{% if page.extra.comments %}
<option disabled>──────────</option>
<option value="{{ current_url }}#comments">Comments</option>
{% endif %}
</select>
<script>
let select = document.getElementById("toc-select");
select.addEventListener('change', function(event) {
let target = event.target.value;
if(target != null && target != undefined && target != '') {
window.location.href = target;
}
});
</script>
</div>
{%- endif %}
<div itemprop="articleBody">
{{ page.content | safe }}
</div>

View File

@ -170,35 +170,6 @@
{% block page_footer %}{% endblock page_footer %}
</content>
<sidebar>
{# Table of contents #}
{% if page.toc -%}
<section>
<h1>On this page</h1>
<ul>
<li><a href="{{ current_url }}#" title="{{ page.title }}">{{ page.title }}</a></li>
{% for h1 in page.toc %}
<li>
<a href="{{ h1.permalink | safe }}" title="{{ h1.title }}">{{ loop.index }}. {{ h1.title }}</a>
{% if h1.children %}
{# <ul> #}
{% for h2 in h1.children %}
<li class="sub">
<a href="{{h2.permalink | safe}}" title="{{ h1.title }}">{{ loop.index }}. {{ h2.title }}</a>
</li>
{% endfor %}
{# </ul> #}
{% endif %}
</li>
{% endfor %}
{# Comments link #}
{% if page.extra.comments %}
<li><a href="#comments" title="Comments">Comments</a></li>
{% endif %}
</ul>
</section>
{%- endif %}
{# Categories #}
{% set categories = get_taxonomy(kind="categories") %}
{% if categories.items | length > 0 -%}

View File

@ -4,7 +4,7 @@ license = "AGPL-3.0"
homepage = "https://gitlab.com/timvisee/timvisee.com"
min_version = "0.12.0"
demo = "https://timvisee.com/"
version = "0.1.0"
version = "0.2.1"
[extra]