Initial AD port

This commit is contained in:
2021-04-26 18:26:42 +01:00
parent 6911ce346b
commit 7e7773258a
408 changed files with 17799 additions and 172 deletions

View File

@@ -0,0 +1,22 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<div class="alert {{ with .type }}alert-{{ . }}{{ end }}{{ with .class }} {{ . }}{{ end }}">
{{ .body }}
</div>

View File

@@ -0,0 +1,34 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<button
{{ with .id }}id="{{ . | urlize }}" {{ end }}
{{ with .name }}name="{{ . | safeURL }}" {{ end }}
{{ with .action }}formaction="{{ . | safeURL }}" {{ end }}
{{ with .form }}form="{{ . }}" {{ end }}
{{ with .value }}value="{{ . | safeHTMLAttr }}" {{ end }}
{{ with .target }}formtarget="{{ . }}" {{ end }}
{{ with .tabindex }}tabindex="{{ . }}" {{ end }}
{{ with .onclick }}onclick={{ . | safeJS }} {{ end }}
{{ if in (slice "true" "disabled") .disabled }}disabled {{ end }}
{{ if in (slice "get" "post") .method }}formmethod="{{ .method }}" {{ end }}
class="btn btn-{{ .type | default "default" }}{{ if eq .isghost "true" }} btn-ghost{{ end }}
{{- if eq .isblock "true" }} btn-block{{ end }}
{{- with .class }} {{ . }}{{ end }}"
>{{ .body }}</button>

View File

@@ -0,0 +1,22 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<div class="btn-group{{ if eq .formactions "true" }} form-actions{{ end }}{{ with .class }} {{ . }}{{ end }}">
{{ .body }}
</div>

View File

@@ -0,0 +1,25 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<div class="card">
<header class="card-header">{{ .header }}</header>
<div class="card-content">
<div class="inner">{{ .body }}</div>
</div>
</div>

View File

@@ -0,0 +1,20 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<div class="cell{{ with .class }} {{ . }}{{ end }}">{{ .body }}</div>

View File

@@ -0,0 +1,22 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{- /**/ -}}
<a {{ with .itemtype }} itemprop itemtype="https://schema.org/{{ . }}"{{ end }} target="{{ .target | default "_blank" }}"{{ with .type }} type="{{ . }}"{{ end }}{{ with .title }} title="{{ . }}"{{ end }}{{ with .rel }} rel="{{ . }}"{{ else }} rel="{{ if ne .supress_external true }}external{{ end }} noopener"{{ end }}{{ if eq .trusted "true" }} href="{{ .href | safeURL }}"{{ else }} href="{{ .href }}"{{ end }}{{ with .referrerpolicy }} referrerpolicy="{{ . }}"{{ end }}{{ with .class }} class="{{ . }}"{{ end }}>{{ .body | default (replaceRE "^https?://(.*)" "$1" .href) }}</a>
{{- /**/ -}}

View File

@@ -0,0 +1,53 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<figure{{ with .class }} class="{{ . }}"{{ end }}>
{{ if .link }}
<a href="{{ .link }}"{{ if .linktarget }} target="{{ .linktarget }}"{{ end }}{{ if eq .linktarget "_blank" }} rel="external noopener noreferrer"{{ end }} itemprop="url">
{{- if .lqipsrc -}}
<img class="lazyload blur-up" src="{{ .lqipsrc }}" data-src="{{ .src }}" {{ if or .alt .caption }}alt="{{ with .alt }}{{ . }}{{ else }}{{ .caption }}{{ end }}"{{ end }} itemprop="image">
{{- else -}}
<img class="lazyload" data-src="{{ .src }}" {{ if or .alt .caption }}alt="{{ if .alt }}{{ .alt }}{{ else }}{{ .caption }}{{ end }}"{{ end }} itemprop="image">
{{- end -}}
</a>
{{ else }}
{{- if .lqipsrc -}}
<img class="lazyload blur-up" src="{{ .lqipsrc }}" data-src="{{ .src }}" {{ if or .alt .caption }}alt="{{ with .alt }}{{ . }}{{ else }}{{ .caption }}{{ end }}"{{ end }} itemprop="image">
{{- else -}}
<img class="lazyload" data-src="{{ .src }}" {{ if or .alt .caption }}alt="{{ if .alt }}{{ .alt }}{{ else }}{{ .caption }}{{ end }}"{{ end }} itemprop="image">
{{- end -}}
{{ end }}
{{ if or (or .title .caption) .attr }}
<figcaption>
{{ with .title }}
<header itemprop="name"><b>{{ . }}</b></header>
{{ end }}
{{ if or .caption .attr }}
<small>
<span itemprop="description">{{ .caption }}</span>
{{ if .attrlink }}
<a href="{{ .attrlink }}">
{{ .attr }}
</a>
{{ end }}
</small>
{{ end }}
</figcaption>
{{ end }}
</figure>

View File

@@ -0,0 +1,32 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<form
{{ with .id }}id="{{ . }}" {{ end }}
{{ with .name }}name="{{ . }}" {{ end }}
{{ with .action }}action="{{ . | safeURL }}" {{ end }}
{{ with .enctype }}enctype="{{ . }}" {{ end }}
{{ with .target }}target="{{ . }}" {{ end }}
{{ with .accept_charset }}accept-charset="{{ . }}" {{ end }}
{{ if eq .novalidate "true" }}novalidate {{ end }}
{{ if in (slice "on" "off") .autocomplete }}autocomplete="{{ .autocomplete }}" {{ end }}
{{ if in (slice "get" "post") .method }}method="{{ .method }}" {{ end }}
class="form{{ with .class }} {{ . }}{{ end }}">
{{- .body -}}
</form>

View File

@@ -0,0 +1,20 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<div class="form-actions">{{ .body }}</div>

View File

@@ -0,0 +1,27 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<fieldset
{{ with .form }}form="{{ . }}" {{ end }}
{{ with .name }}name="{{ . }}" {{ end }}
{{ if eq .disabled "true" }}disabled {{ end }}
class="form-group{{ if eq .hastextarea "true" }} form-textarea{{ end }}{{ if in (slice "success" "error" "warning") .state }} form-{{ .state }}{{ end }}{{ with .class }} {{ . }}{{ end }}">
{{ with .legend }}<legend>{{ . }}</legend>{{ end }}
{{ .body }}
</fieldset>

View File

@@ -0,0 +1,20 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<div class="grid{{ with .class }} {{ . }}{{ end }}">{{ .body }}</div>

View File

@@ -0,0 +1,20 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<div class="help-block{{ with .class }} {{ . }}{{ end }}">{{ .body }}</div>

View File

@@ -0,0 +1,20 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<label{{ with .for }} for="{{ . }}"{{ end }}{{ with .form }} form="{{ . }}"{{ end }}>{{ .body }}</label>

View File

@@ -0,0 +1,30 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ if not (eq .settings.hidden true) }}
<nav itemscope itemtype="https://schema.org/SiteNavigationElement">
<meta itemprop="name" content="{{ .name | humanize }} Menu">
{{ range .entries }}
{{ $is_active := or ($.page.IsMenuCurrent $.name .) ($.page.HasMenuCurrent $.name .) }}
{{ if (not (in $.settings.exclude .Identifier)) }}
<a itemprop="url"{{ if $is_active }} class="active"{{ end }}{{ if eq .Identifier "search" }} rel="search"{{ end }} href="{{ .URL }}">{{ if .Pre }}{{ .Pre | safeHTML }} {{ end }}{{ .Name }}{{ if .Post }} {{ .Post | safeHTML }}{{ end }}</a>
{{ end }}
{{ end }}
</nav>
{{ end }}

View File

@@ -0,0 +1,30 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ if eq .show_percent "true" }}
<div class="progress-bar progress-bar-show-percent">
{{ with .value }}
<div class="progress-bar-filled" style="width:{{ . }}%" data-filled="{{ $.fill_text }} {{ . }}%"></div>
{{ end }}
</div>
{{ else }}
<div class="progress-bar">
<div class="progress-bar-filled" style="width: {{ .value }}%"></div>
</div>
{{ end }}

View File

@@ -0,0 +1,22 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<select{{ with .id }} id="{{ . | urlize }}"{{ end }}{{ with .name }} name="{{ . }}"{{ end }} {{ with .disabled }} disabled{{ end }}{{ with .form }} form="{{ . }}"{{ end }} class="form-control{{ with .class }} {{ . }}{{ end }}">
{{ with .body }}{{ . }}{{ end }}
</select>

View File

@@ -0,0 +1,42 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $permitted_attrs := .permitted_attrs }}
{{ $boolean_attrs := .boolean_attrs }}
{{ $validations := .validations }}
{{ range $name, $value := .attrs }}
{{ if and (ne $value nil) (in $permitted_attrs $name) }}
{{ if ne "class" $name }}
{{ if in $boolean_attrs $name }}
{{ if eq $value "true" }}{{ $name }}{{ end }}
{{ else if index $validations $name }}
{{ if in (index $validations $name) $value }}
{{ $name }}="{{ $value }}"
{{ end }}
{{ else }}
{{ if eq $name "id" }}
{{ $name }}="{{- $value | urlize -}}"
{{ else }}
{{ $name }}="{{ $value }}"
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
class="form-control{{ with .attrs.class }} {{ . }}{{ end }}"

View File

@@ -0,0 +1,25 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $permitted_attrs := .permitted_attrs | default (slice "id" "name" "class" "autocomplete" "autofocus" "cols" "disabled" "form" "maxlength" "minlength" "name" "placeholder" "readonly" "required" "rows" "spellcheck" "wrap" "tabindex") }}
{{ $boolean_attrs := .boolean_attrs | default (slice "autofocus" "disabled" "readonly" "required") }}
{{ $validations := .validations | default (dict "spellcheck" (slice "true" "default" "false") "autocomplete" (slice "on" "off") "wrap" (slice "hard" "soft" "off")) }}
<textarea {{ partial "components/snippets/textattrs.html" (dict "attrs" .attrs "permitted_attrs" $permitted_attrs "boolean_attrs" $boolean_attrs "validations" $validations) | safeHTMLAttr }}>
{{- with .body }}{{ . }}{{ end -}}
</textarea>

View File

@@ -0,0 +1,23 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $permitted_attrs := .permitted_attrs | default (slice "id" "name" "class" "autocomplete" "autofocus" "disabled" "form" "formaction" "formmethod" "formnovalidate" "formtarget" "height" "max" "maxlength" "min" "minlength" "multiple" "pattern" "placeholder" "readonly" "required" "size" "spellcheck" "step" "tabindex" "type" "value" "width") }}
{{ $boolean_attrs := .boolean_attrs | default (slice "autofocus" "disabled" "readonly" "required") }}
{{ $validations := .validations | default (dict "type" (slice "email" "hidden" "number" "password" "search" "tel" "text" "url") "spellcheck" (slice "true" "default" "false") "autocomplete" (slice "off" "on" "name" "honorific-prefix" "given-name" "additional-name" "family-name" "honorific-suffix" "nickname" "email" "username" "new-password" "current-password" "organization-title" "organization" "street-address" "address-line1" "address-line2" "address-line3" "address-level4" "address-level3" "address-level2" "address-level1" "country" "country-name" "postal-code" "cc-name" "cc-given-name" "cc-additional-name" "cc-family-name" "cc-number" "cc-exp" "cc-exp-month" "cc-exp-year" "cc-csc" "cc-type" "transaction-currency" "transaction-amount" "language" "bday" "bday-day" "bday-month" "bday-year" "sex" "tel" "tel-country-code" "tel-national" "tel-area-code" "tel-local" "tel-extension" "email" "impp" "url" "photo")) }}
<input {{ partial "components/snippets/textattrs.html" (dict "attrs" .attrs "permitted_attrs" $permitted_attrs "boolean_attrs" $boolean_attrs "validations" $validations) | safeHTMLAttr }}>

View File

@@ -0,0 +1,20 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<span class="loading"></span>

View File

@@ -0,0 +1,52 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $path := (path.Base .node.RelPermalink) }}
{{ $is_src_relative := not (urls.Parse .src).Host }}
{{ $has_poster := ne .poster nil }}
{{ $is_poster_relative := not (urls.Parse .poster).Host }}
<video
class="lazyload{{ with .class }} {{ . }}{{ end }}"
{{ with .autoplay }} autoplay{{ end }}
{{ with .controls }} controls{{ end }}
{{ with .crossorigin }}crossorigin="{{ . }}"{{ end }}
{{ with .height }} height="{{ . }}"{{ end }}
{{ with .loop }} loop{{ end }}
{{ with .muted }} muted{{ end }}
{{ with .playsinline }} {{ . }}{{ end }}
{{ with .preload }} preload="{{ . }}"{{ end }}
{{ with .intrinsicsize }} intrinsicsize="{{ . }}"{{ end }}
{{ if $has_poster }}
{{ if $is_poster_relative -}}
poster="{{ relref .node $path }}{{ .poster }}"
{{- else }}
poster="{{ .poster }}"
{{ end }}
{{ end }}
{{ with .poster }} poster="{{ . }}"{{ end }}
{{ if $is_src_relative -}}
src="{{ relref .node $path }}{{ .src }}"
{{- else -}}
src="{{ .src }}"
{{- end }}
{{ with .width }} width="{{ . }}"{{ end }}
>
Your browser doesn't support HTML5 video. <a href="{{ if .is_src_relative }}{{ relref .node $path }}{{ .src }}{{ else }}{{ .src }}{{ end }}">Download video</a> instead.
</video>

View File

@@ -0,0 +1,33 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ if .Site.Copyright }}
{{ with (index .Params "copyright") }}
{{ range . }}
Copyright &copy; {{ .date }} {{ .owner }}.
{{ with (index $.Site.Data.licenses .license) }}
Licensed under {{ partial "components/external.html" (dict "href" .link "body" .shorthand "rel" "external noopener license") }}.
{{ else }}
Copyright &copy; {{ .date }} {{ .owner }}.
{{ end }}
{{ end }}
{{ else }}
{{ .Site.Copyright | safeHTML }}
{{ end }}
{{ end }}

View File

@@ -0,0 +1,72 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $custom := resources.Get "css/custom.css" }}
{{ if eq .Site.Params.hackcss.disabled true }}
{{ with (slice $custom | resources.Concat "styles.css").Content }}
{{ if gt (len .) 0 }}
<style>{{ . | safeCSS }}</style>
{{ partial "meta/theme-color.html" . }}
{{ end }}
{{ end }}
{{ else }}
{{ $hack := resources.Get "css/vendor/hack/hack.css" }}
{{ $standard := resources.Get "css/vendor/hack/standard.css" }}
{{ $dark := resources.Get "css/vendor/hack/dark.css" }}
{{ $darkgrey := resources.Get "css/vendor/hack/dark-grey.css" }}
{{ $solarizeddark := resources.Get "css/vendor/hack/solarized-dark.css" }}
{{ $theme := resources.Get "css/theme.css" | minify }}
{{ if eq .Site.Params.hackcss.palette "dark-grey" }}
{{ if eq .Site.Params.hackcss.mode "standard" }}
{{ with (slice $hack $standard $darkgrey $theme $custom | resources.Concat "styles.css").Content }}
<style>{{ . | safeCSS }}</style>
{{ partial "meta/theme-color.html" . }}
{{ end }}
{{ else }}
{{ with (slice $hack $darkgrey $theme $custom | resources.Concat "styles.css").Content }}
<style>{{ . | safeCSS }}</style>
{{ partial "meta/theme-color.html" . }}
{{ end }}
{{ end }}
{{ else if eq .Site.Params.hackcss.palette "solarized-dark" }}
{{ if eq .Site.Params.hackcss.mode "standard" }}
{{ with (slice $hack $standard $solarizeddark $theme $custom | resources.Concat "styles.css").Content }}
<style>{{ . | safeCSS }}</style>
{{ partial "meta/theme-color.html" . }}
{{ end }}
{{ else }}
{{ with (slice $hack $solarizeddark $theme $custom | resources.Concat "styles.css").Content }}
<style>{{ . | safeCSS }}</style>
{{ partial "meta/theme-color.html" . }}
{{ end }}
{{ end }}
{{ else }}
{{ if eq .Site.Params.hackcss.mode "standard" }}
{{ with (slice $hack $standard $dark $theme $custom | resources.Concat "styles.css").Content }}
<style>{{ . | safeCSS }}</style>
{{ partial "meta/theme-color.html" . }}
{{ end }}
{{ else }}
{{ with (slice $hack $dark $theme $custom | resources.Concat "styles.css").Content }}
<style>{{ . | safeCSS }}</style>
{{ partial "meta/theme-color.html" . }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}

View File

@@ -0,0 +1,20 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<link rel="icon" sizes="any" href="data:image/svg+xml,%3Csvg%20viewBox='0%200%2046%2045'%20xmlns='http://www.w3.org/2000/svg'%3E%3Ctitle%3EAfter%20Dark%3C/title%3E%3Cpath%20d='M.708%2045L23%20.416%2045.292%2045H.708zM35%2038L23%2019%2011%2038h24z'%20fill='%23000'/%3E%3C/svg%3E">

View File

@@ -0,0 +1,35 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $defaults := .Site.Params.defaults.modules }}
{{ $modules := .Site.Params.modules }}
{{ if (or $modules $defaults) }}
{{ with $modules.fractal_forest }}
{{ partial "modules/fractal-forest/index.html" . }}
{{ end }}
{{ with $modules.hall_of_mirrors }}
{{ partial "modules/hall-of-mirrors/index.html" (dict "settings" . "page" $.Page) }}
{{ end }}
{{ with (default $defaults.toxic_swamp $modules.toxic_swamp) }}
{{ partial "modules/toxic-swamp/index.html" (dict "settings" . "data" $.Site.Data) }}
{{ end }}
{{ with $modules.voyeur }}
{{ partial "modules/voyeur/index.html" . }}
{{ end }}
{{ end }}

View File

@@ -0,0 +1,81 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/}}
{{ with $.Resources.GetMatch "*header*" }}
{{ $meta_sameas := .Params.meta.sameas }}
{{ $meta_license := .Params.meta.license }}
{{ $meta_creator := .Params.meta.creator }}
{{ $meta_description := .Params.meta.description }}
{{ $meta_keywords := .Params.meta.keywords }}
{{ $meta_contentlocation := .Params.meta.contentlocation }}
{{ $image300 := .Fill "300x169 q20 Center" }}
{{ $image600 := .Fill "600x338 q60 Center" }}
{{ $image900 := .Fill "900x506 q70 Center" }}
{{ $image1200 := .Fill "1200x675 q80 Center" }}
{{ $image1600 := .Fill "1600x900 q90 Center" }}
<figure class="ratio-container" aria-hidden="true" itemscope itemtype="https://schema.org/ImageObject">
<link itemprop="contentUrl" href="{{ .RelPermalink }}">
<meta itemprop="encodingFormat" content="{{ .MediaType }}">
<meta itemprop="name" content="{{ .Name | plainify }}">
{{ if (urls.Parse $meta_sameas).Host }}
<link itemprop="sameAs" href="{{ $meta_sameas }}">
{{ end }}
{{ if (urls.Parse $meta_license).Host }}
<link itemprop="license" href="{{ $meta_license }}">
{{ end }}
{{ with $meta_keywords }}
<meta itemprop="keywords" content="{{ delimit . ", " }}">
{{ end }}
{{ with $meta_contentlocation }}
<meta itemprop="contentLocation" content="{{ . | plainify }}">
{{ end }}
{{ with $meta_description }}
<meta itemprop="description" content="{{ . | plainify }}">
{{ end }}
<img
itemprop="thumbnailUrl"
alt="{{ with $meta_description }}{{ . }}{{ else }}{{ .Name | plainify }}{{ end }}"
class="lazyload blur-up"
src="{{ $image600.RelPermalink }}"
srcset="{{ $image300.RelPermalink }}"
data-srcset="{{ $image300.RelPermalink }} 300w, {{ $image600.RelPermalink }} 600w, {{ $image900.RelPermalink }} 900w, {{ $image1200.RelPermalink }} 1200w, {{ $image1600.RelPermalink }} 1600w"
data-sizes="auto"
>
{{ if or (not (path.Ext .Title)) (or $meta_creator $meta_sameas) }}
<figcaption itemprop="caption">
{{ if not (path.Ext .Title) }}
<span itemprop="headline">{{ .Title | plainify }}</span>.
{{ end }}
{{ if or $meta_creator $meta_sameas }}
Photo
{{ if $meta_creator }}
by
<span itemprop="creator">
{{ $meta_creator | plainify -}}
</span>
{{- end }}
{{- with (urls.Parse $meta_sameas).Host }}
on
{{ (strings.TrimSuffix (path.Ext .) .) | title }}
{{- end }}.
{{ end }}
</figcaption>
{{ end }}
</figure>
{{ end }}

View File

@@ -0,0 +1,79 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/}}
{{ $valid_processing_methods := (slice "resize" "fit" "fill") }}
{{ $options := .options | default slice }}
{{ $image_processing_method := default "fill" (index $options 0) }}
{{ $image_processing_options := index $options 1 }}
{{ if not (in $valid_processing_methods $image_processing_method) }}
{{ errorf "Invalid thumbnail processing method: Must be one of 'fit', 'fill' or 'resize'." }}
{{ else }}
{{ $scratch := newScratch }}
{{ with .node.Resources.GetMatch "*thumbnail*" }}
{{ $meta_sameas := .Params.meta.sameas }}
{{ $meta_license := .Params.meta.license }}
{{ $meta_creator := .Params.meta.creator }}
{{ $meta_description := .Params.meta.description }}
{{ $meta_keywords := .Params.meta.keywords }}
{{ $meta_contentlocation := .Params.meta.contentlocation }}
{{ if (eq $image_processing_method "resize") }}
{{ $scratch.Set "lodpi" (.Resize (default "400x300 q60 Gaussian" $image_processing_options)) }}
{{ $scratch.Set "hidpi" (.Resize (printf "%dx%d q90 Gaussian" (mul ($scratch.Get "lodpi").Width 2) (mul ($scratch.Get "lodpi").Height 2))) }}
{{ else if (eq $image_processing_method "fit") }}
{{ $scratch.Set "lodpi" (.Fit (default "400x300" $image_processing_options)) }}
{{ $scratch.Set "hidpi" (.Fit (printf "%dx%d" (mul ($scratch.Get "lodpi").Width 2) (mul ($scratch.Get "lodpi").Height 2))) }}
{{ else }}
{{ $scratch.Set "lodpi" (.Fill (default "400x300 Center" $image_processing_options)) }}
{{ $scratch.Set "hidpi" (.Fill (printf "%dx%d Center" (mul ($scratch.Get "lodpi").Width 2) (mul ($scratch.Get "lodpi").Height 2))) }}
{{ end }}
<figure aria-hidden="true" itemscope itemtype="https://schema.org/ImageObject">
<link itemprop="contentUrl" href="{{ .RelPermalink }}">
<meta itemprop="encodingFormat" content="{{ .MediaType }}">
<meta itemprop="name" content="{{ .Name | plainify }}">
{{ with .Title }}
<meta itemprop="headline" content="{{ . }}">
{{ end }}
{{ with $meta_creator }}
<meta itemprop="creator" content="{{ . | plainify -}}">
{{ end }}
{{ if (urls.Parse $meta_sameas).Host }}
<link itemprop="sameAs" href="{{ $meta_sameas }}">
{{ end }}
{{ if (urls.Parse $meta_license).Host }}
<link itemprop="license" href="{{ $meta_license }}">
{{ end }}
{{ with $meta_keywords }}
<meta itemprop="keywords" content="{{ delimit . ", " }}">
{{ end }}
{{ with $meta_contentlocation }}
<meta itemprop="contentLocation" content="{{ . | plainify }}">
{{ end }}
{{ with $meta_description }}
<meta itemprop="description" content="{{ . | plainify }}">
{{ end }}
<img
itemprop="thumbnailUrl"
alt="{{ with $meta_description }}{{ . }}{{ else }}{{ .Name | plainify }}{{ end }}"
class="lazyload blur-up"
src="{{ ($scratch.Get "lodpi").RelPermalink }}"
data-src="{{ ($scratch.Get "hidpi").RelPermalink }}"
>
</figure>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,30 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $is_section_menu_enabled := ne .Site.Params.show_menu false }}
{{ range $name, $entries := .Site.Menus }}
{{ if or (ne $name "main") (and (eq $name "main") $is_section_menu_enabled) }}
{{ with $.Site.Params.layout.menu }}
{{ $settings := (index . $name) | default dict }}
{{ partial "components/navmenu.html" (dict "name" $name "entries" $entries "settings" $settings "page" $)}}
{{ else }}
{{ partial "components/navmenu.html" (dict "name" $name "entries" $entries "settings" dict "page" $)}}
{{ end }}
{{ end }}
{{ end }}

View File

@@ -0,0 +1,60 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $is_disabled := .Param "disable_csp" }}
{{ $site_directives := .Site.Params.security.csp.directives }}
{{ if and $site_directives (ne $is_disabled true) }}
{{ if ge (len $site_directives) 1 }}
<meta
http-equiv="Content-Security-Policy"
content="default-src{{ if $site_directives.defaultsrc }}
{{- range $site_directives.defaultsrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.defaultsrc }} {{ . | safeHTML }}{{ end -}}
{{ else }} 'none'{{ end }};connect-src{{ if $site_directives.connectsrc }}
{{- range $site_directives.connectsrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.connectsrc }} {{ . | safeHTML }}{{ end -}}
{{ else }} 'self'{{ end }};worker-src{{ if $site_directives.workersrc }}
{{- range $site_directives.workersrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.workersrc }} {{ . | safeHTML }}{{ end -}}
{{ else }} 'self'{{ end }};font-src{{ if $site_directives.fontsrc }}
{{- range $site_directives.fontsrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.fontsrc }} {{ . | safeHTML }}{{ end -}}
{{ else }} 'self'{{ end }};media-src{{ if $site_directives.mediasrc }}
{{- range $site_directives.mediasrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.mediasrc }} {{ . | safeHTML }}{{ end -}}
{{ else }} 'self'{{ end }};img-src{{ if $site_directives.imgsrc }}
{{- range $site_directives.imgsrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.imgsrc }} {{ . | safeHTML }}{{ end -}}
{{ else }} 'self' data:{{ end }};script-src{{ if $site_directives.scriptsrc }}
{{- range $site_directives.scriptsrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.scriptsrc }} {{ . | safeHTML }} {{ end -}}
{{ else }} 'none'{{ end }};style-src{{ if $site_directives.stylesrc }}
{{- range $site_directives.stylesrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.stylesrc }} {{ . | safeHTML }} {{ end -}}
{{ else }} 'self' 'unsafe-inline'{{ end }};frame-src{{ if $site_directives.framesrc }}
{{- range $site_directives.framesrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.framesrc }} {{ . | safeHTML }} {{ end -}}
{{ else }} 'self'{{ end }};object-src{{ if $site_directives.objectsrc }}
{{- range $site_directives.objectsrc }} {{ . | safeHTML }}{{ end -}}
{{- range .Params.security.csp.directives.objectsrc }} {{ . | safeHTML }} {{ end -}}
{{ else }} 'none'{{ end }};">
{{ end }}
{{ else if not $is_disabled }}
<meta http-equiv="Content-Security-Policy" content="default-src 'self' https: 'unsafe-inline' 'unsafe-eval'; worker-src 'self' blob:; connect-src 'self' wss: data:; font-src 'self' https: data:; img-src 'self' https: data:; object-src 'none'">
{{ end }}

View File

@@ -0,0 +1,24 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ with .Site.Params.seo.referrer }}
<meta name="referrer" content="{{ . }}">
{{ else }}
<meta name="referrer" content="same-origin">
{{ end }}

View File

@@ -0,0 +1,32 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{/*
Hack to allow generic site image for Nodes until supported
by the Hugo internal opengraph template.
*/}}
{{ if and (.IsNode) (.Site.Params.images) }}
<meta property="og:image" content="{{ index .Site.Params.images 0 }}">
{{ end }}
{{/*
If specified, fallback to site image if not overriden at Page level
*/}}
{{ if and (.IsPage) (not .Params.images) (.Site.Params.images) }}
<meta property="og:image" content="{{ index .Site.Params.images 0 }}">
{{ end }}

View File

@@ -0,0 +1,22 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ with .Site.Params.seo.telegram_channel }}
<meta name="telegram:channel" content="@{{ . }}">
{{ end }}

View File

@@ -0,0 +1,28 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $cssvar := "--trim-color:\\s*([^!;}]*).*" }}
{{ $hackbg := "pre{background-color:([^!;}]*).*" }}
{{ with index (findRE $cssvar . 1) 0 }}
<meta name="theme-color" content={{ strings.TrimRight " " (. | replaceRE $cssvar "$1") }}>
{{ else }}
{{ with index (findRE $hackbg . 1) 0 }}
<meta name="theme-color" content={{ . | replaceRE $hackbg "$1" }}>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,31 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ with .Site.Params.seo.webmaster_verifications.google }}
<meta name="google-site-verification" content="{{ . }}">
{{ end }}
{{ with .Site.Params.seo.webmaster_verifications.bing }}
<meta name="msvalidate.01" content="{{ . }}">
{{ end }}
{{ with .Site.Params.seo.webmaster_verifications.alexa }}
<meta name="alexaVerifyID" content="{{ . }}">
{{ end }}
{{ with .Site.Params.seo.webmaster_verifications.yandex }}
<meta name="yandex-verification" content="{{ . }}">
{{ end }}

View File

@@ -0,0 +1,51 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $page_schema := .Params.schema }}
{{ $section_schema := (.Site.GetPage "section" .Page.Type).Params.schema }}
{{ $schema_type := (default $section_schema.type $page_schema.type) | default "Thing" }}
{{ $article_types := .Site.Data.schema.article_types }}
{{ $is_typeof_article := in $article_types $schema_type }}
<article itemprop="citation{{ if eq $schema_type "BlogPosting" }} blogPost{{ end }}" itemscope itemtype="https://schema.org/{{ $schema_type }}" id="{{ .Title | anchorize }}">
<header>
<h1 itemprop="{{ if $is_typeof_article }}headline{{ else }}name{{ end }}">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h1>
{{ if eq .Type "post" }}
<p class="muted">{{ partial "post/meta.html" . }}</p>
{{ end }}
{{ if .Description }}
<blockquote itemprop="headline">{{ .Description }}</blockquote>
{{ end }}
</header>
<div itemprop="{{ if $is_typeof_article }}articleBody mainEntityOfPage{{ end }}">
{{- .Summary -}}
</div>
<meta itemprop="inLanguage" content="{{ .Site.LanguageCode }}">
<meta itemprop="datePublished" content="{{ dateFormat "2006-01-02T15:04:05-07:00" (default .Date (.PublishDate)) }}">
<meta itemprop="dateModified" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}">
{{ with .Params.images }}
<meta itemprop="image" content="{{ index . 0 }}">
{{ end }}
</article>
{{ if .Truncated }}
<nav class="readmore">
<a itemprop="url" href="{{ .RelPermalink }}">Read More&nbsp;&raquo;</a>
</nav>
{{ end }}

View File

@@ -0,0 +1,43 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<ul class="thumbnail grid" itemscope itemtype="https://schema.org/ItemList">
<meta itemprop="itemListOrder" content="Unordered">
<meta itemprop="name" content="{{ .index.Title }}">
<meta itemprop="numberOfItems" content="{{ (default .page_count .limit) }}">
{{ $thumbnail_options := .thumbnail_options }}
{{ $show_readingtime := .show_readingtime }}
{{ range first (default .page_count .limit) .pages }}
{{ $page_schema := .Params.schema }}
{{ $section_schema := (.Site.GetPage "section" .Page.Type).Params.schema }}
{{ $schema_type := (default $section_schema.type $page_schema.type) | default "Thing" }}
<li class="cell" itemprop="itemListElement" itemscope itemtype="https://schema.org/{{ $schema_type }}">
<a itemprop="url" href="{{ .RelPermalink }}">
{{ partial "image/thumbnail.html" (dict "node" . "options" $thumbnail_options) }}
<h2 itemprop="name">{{ .Title }}</h2>
</a>
<small itemprop="description">
{{ .Description }}
{{ if $show_readingtime }}
<time class="muted" datetime="{{ .ReadingTime }}M">{{ .ReadingTime }} minutes</time>
{{ end }}
</small>
</li>
{{ end }}
</ul>

View File

@@ -0,0 +1,32 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<nav>
{{ if .Paginator.HasPrev }}
<a href="{{ .Paginator.Prev.URL }}">&laquo;&nbsp;Previous</a> |
{{ end }}
{{ if eq .Paginator.TotalPages 0 }}
<span>OMG the nostalgia! Runs so smoothly too. If only there were published content.</span>
{{ else }}
<span>Page {{ .Paginator.PageNumber }} of {{ .Paginator.TotalPages }}</span>
{{ end }}
{{ if .Paginator.HasNext }}
| <a href="{{ .Paginator.Next.URL }}">Next&nbsp;&raquo;</a>
{{ end }}
</nav>

View File

@@ -0,0 +1,39 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<p>
Published
{{ if ne .Site.Params.hide_author true }}
{{ with .Params.author }}
by <span itemprop="author">{{ index . }}</span>
{{ else }}
by <span itemprop="author">{{ .Site.Params.author }}</span>
{{ end }}
{{ end }}
<time itemprop="datePublished" datetime="{{ dateFormat "2006-01-02T15:04:05-07:00" (default .Date (.PublishDate)) }}">
{{ dateFormat "2 Jan, 2006" (default .Date (.PublishDate)) }}
</time>
{{ with .Params.categories }}
in <span itemprop="articleSection">{{ delimit (apply (apply (sort .) "partial" "post/category-link.html" ".") "chomp" ".") ", " " and " }}</span>
{{ end }}
{{ with .Params.tags }}
and tagged {{ delimit (apply (apply (sort .) "partial" "post/tag-link.html" ".") "chomp" ".") ", " " and " }}
{{ end }}
using <span itemprop="wordCount">{{ .WordCount }}</span> words.
</p>

View File

@@ -0,0 +1,20 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<a href="{{ "/" | relURL }}categories/{{ . | urlize }}/">{{ . }}</a>

View File

@@ -0,0 +1,34 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<svg style="margin-bottom:-3px" class="i-clock" viewBox="0 0 32 32" width="16" height="16" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="6.25%">
<circle cx="16" cy="16" r="14" />
<path d="M16 8 L16 16 20 20" />
</svg>
<span>{{ .ReadingTime }} minute read</span>
<svg style="margin-bottom: -3px" class="i-edit" viewBox="0 0 32 32" width="16" height="16" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="6.25%">
<path d="M30 7 L25 2 5 22 3 29 10 27 Z M21 6 L26 11 Z M5 22 L10 27 Z" />
</svg>
{{ if .PublishDate.IsZero }}
Published: <time datetime="{{ .Date.Format "2006-01-02T15:04:05-07:00" }}">{{ .Date.Format "2 Jan, 2006" }}</time>
{{ else if lt .PublishDate .Lastmod }}
Modified: <time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}">{{ .Lastmod.Format "2 Jan, 2006" }}</time>
{{ else }}
Published: <time datetime="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }}">{{ .PublishDate.Format "2 Jan, 2006" }}</time>
{{ end }}

View File

@@ -0,0 +1,44 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $limit := (index .Site.Params.layout .Type).related.limit | default .Site.Params.related_content_limit }}
{{ $pages := .Site.RegularPages.Related . | first (default 7 $limit) }}
{{ $page_count := len $pages }}
{{ if and (gt $page_count 1) (ne $limit 0) }}
{{ with $pages }}
<aside>
<header>Related Content</header>
{{ with (index $.Site.Params.layout $.Type).related }}
{{ if ne $.Site.Params.hackcss.disabled true }}
{{ with resources.Get "css/conditional/layouts/partials/page-thumbs.css" | minify }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
{{ end }}
{{ partial "page-thumbs.html" (dict "thumbnail_options" .thumbs "page_count" $page_count "limit" $limit "pages" $pages "show_readingtime" true) }}
{{ else }}
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a>
<time class="muted" datetime="{{ .ReadingTime }}M">{{ .ReadingTime }} minutes</time>
{{ end }}
</ul>
{{ end }}
</aside>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,20 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<a rel="tag" href="{{ "/" | relURL }}tags/{{ . | urlize }}/">{{ . }}</a>

View File

@@ -0,0 +1,25 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ if and (isset .Params "toc") .Params.toc }}
<details>
<summary>Table of Contents</summary>
{{ .TableOfContents }}
</details>
{{ end }}