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,88 @@
{{/*
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/>.
*/ -}}
<!doctype html>
<html lang="{{ .Site.LanguageCode }}">
<head>
{{ partial "meta/content-security-policy.html" . }}
<meta name="generator" content="After Dark Hugo">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ block "title" . }}{{ .Title }} | {{ .Site.Title }}{{ end }}</title>
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
<meta name="keywords" content="{{ if .Keywords }}{{ delimit .Keywords ", " }}{{ else if and .IsPage .Params.tags }}{{ delimit .Params.tags ", " }}{{ else }}{{ range $term, $val := .Site.Taxonomies.categories }}{{ lower (humanize $term) }}, {{ end }}{{ end }}">
{{ $default_noindex_kinds := slice "section" "taxonomy" "taxonomyTerm" }}
{{ $noindex_kinds := .Site.Params.noindex_kinds | default $default_noindex_kinds }}
{{ $is_noindex_true := and (isset .Params "noindex") .Params.noindex }}
{{ if or (in $noindex_kinds .Kind) ($is_noindex_true) }}
<meta name="robots" content="noindex">
{{ end }}
{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}
{{ partial "meta/ogimage-maybe.html" . }}
{{ partial "meta/telegram-channel-maybe.html" . }}
{{ if eq .Kind "home" }}
{{ partial "meta/verifications.html" . }}
{{ end }}
{{ partial "meta/http-referrer.html" . }}
{{ $import := resources.Get "/js/vendor/fetch-inject.min.js" }}
{{ $baseof := resources.Get "/js/baseof.js" | resources.ExecuteAsTemplate "baseof.js" . }}
<script integrity="{{ ($import | resources.Fingerprint "sha512").Data.Integrity }}">
{{- $import.Content | safeJS -}}
</script>
<script integrity="{{ ($baseof | resources.Fingerprint "sha512").Data.Integrity }}">
{{- $baseof.Content | safeJS -}}
</script>
{{ partial "head/modules.html" . }}
{{ with .OutputFormats.Get "rss" }}
{{ printf "<link rel=\"%s\" type=\"%s\" href=\"%s\" title=\"%s\">" .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end }}
<link rel="canonical" href="{{ .Permalink }}">
{{ if (isset .Params "prev") }}
<link rel="prev" href="{{ .Params.prev }}">
{{ end }}
{{ if (isset .Params "next") }}
<link rel="next" href="{{ .Params.next }}">
{{ end }}
{{ partial "head/favicon.html" . }}
{{ partial "global-styles.html" . }}
{{ $highlights := findRE "class\\s*?=\\s*?\".*?\\bhighlight\\b.*?\"|class\\s*?=\\s*?highlight\\b" .Content }}
{{ if ge (len $highlights) 1 }}
<script integrity="sha512-ISTAV0GadOIz/NXXHOS+eCM0ysXVVHhQTlvA6LJxz/DeA5yIxm0Vqf5IE+WH0yuuXkayAKtoZkQ326nch5f/fg==">fetchInject([{{ "/css/syntax.css" | relURL }}]);</script>
<noscript>
<link href="{{ "/css/syntax.css" | relURL }}" rel="stylesheet">
</noscript>
{{ end }}
</head>
{{ $hackcss_disabled := .Site.Params.hackcss.disabled | default false }}
{{ $hackcss_mode := .Site.Params.hackcss.mode | default "hack" }}
{{ $hackcss_palette := .Site.Params.hackcss.palette | default "dark" }}
<body class="{{ if ne $hackcss_disabled true }}{{ $hackcss_mode }} {{ $hackcss_palette }} main container{{ end }}">
<header>{{ block "header" . }}{{ end }}</header>
<main>{{ block "main" . }}{{ end }}</main>
<footer>{{ block "footer" . }}{{ end }}</footer>
{{ $defaults := .Site.Params.defaults.modules }}
{{ $modules := .Site.Params.modules }}
{{ if (or $modules $defaults) }}
{{ with (default $defaults.toxic_swamp $modules.toxic_swamp) }}
{{ partial "modules/toxic-swamp/toolbar.html" dict }}
{{ end }}
{{ end }}
</body>
</html>

View File

@@ -0,0 +1,77 @@
{{/*
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/>.
*/}}
{{ define "title" -}}
{{ .Site.Title }}
{{- end }}
{{ define "header" }}
{{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
<header>
<h1 itemprop="name">{{ .Title }}</h1>
</header>
{{ with .Site.Params.layout.home.section }}
{{ if ne $.Site.Params.hackcss.disabled true }}
{{ with resources.Get "css/conditional/layouts/partials/page-thumbs.css" | minify }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
{{ end }}
{{ range sort . "weight" "asc" }}
<section>
{{ $index := site.GetPage "section" .type }}
{{ $pages := where site.RegularPages "Type" .type }}
{{ $page_count := (default 1 (len $pages)) }}
{{ if eq $page_count 1 }}
{{ partial "page-summary.html" $index }}
{{ else if gt $page_count 1 }}
<header>
<h1 itemprop="name">
<a href="{{ $index.RelPermalink }}">Recent {{ $index.Title }}</a>
</h1>
<blockquote itemprop="description">{{ $index.Description }}</blockquote>
</header>
{{ partial "page-thumbs.html" (dict "thumbnail_options" .thumbs "page_count" $page_count "limit" .limit "pages" $pages) }}
{{ end }}
{{ if and (lt .limit $page_count) (ne 1 $page_count) }}
<nav class="readmore">
<a itemprop="url" href="{{ $index.RelPermalink }}">
View more {{ $index.Title }}
</a>
</nav>
{{ end }}
</section>
{{ end }}
{{ end }}
{{ if not .Site.Params.layout.home.hide_blog }}
<section itemscope itemtype="https://schema.org/Blog">
{{ range (.Paginate (where .Site.RegularPages "Type" "in" (site.Params.layout.homepage.sections | default (slice "post")))).Pages }}
{{ partial "page-summary.html" . }}
{{ end }}
</section>
{{ end }}
{{ end }}
{{ define "footer" }}
{{ if not .Site.Params.layout.home.hide_blog }}
<p>{{ partial "pagination.html" . }}</p>
{{ end }}
<small class="muted">
{{ partial "copyright-notice.html" . }}
</small>
{{ end }}

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/>.
*/ -}}
{{- $scratch := newScratch -}}
{{- $scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}}
{{- if ne .Params.noindex true -}}
{{- $scratch.Add "index" (dict "title" .Title "tags" .Params.tags "categories" .Params.categories "contents" .Plain "url" .RelPermalink "summary" .Summary) -}}
{{- end -}}
{{- end -}}
{{- $scratch.Get "index" | jsonify -}}

View File

@@ -0,0 +1,36 @@
{{/*
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/>.
*/}}
{{ define "header" }}
{{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
<header>
<h1>{{ .Title }}</h1>
</header>
{{ range .Paginator.Pages }}
{{ partial "page-summary.html" . }}
{{ end }}
{{ end }}
{{ define "footer" }}
<p>{{ partial "pagination.html" . }}</p>
<small class="muted">
{{ partial "copyright-notice.html" . }}
</small>
{{ end }}

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/>.
*/ -}}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<docs>https://blogs.law.harvard.edu/tech/rss</docs>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>{{ range first 1 (default slice .Site.Params.images) }}
<image>
<title>{{ if eq $.Title $.Site.Title }}{{ $.Site.Title }}{{ else }}{{ with $.Title }}{{ . }} on {{ end }}{{ $.Site.Title }}{{ end }}</title>
<link>{{ $.Permalink }}</link>
<url>{{ . }}</url>
</image>{{ end }}
<ttl>1440</ttl>
<generator>{{ with .Site.Data.npm.latest }}{{ .name | humanize | title }} {{ .version }} (Hugo {{ hugo.Version }}){{ else }}Hugo {{ hugo.Version }}{{ end }}</generator>{{ with .Site.LanguageCode }}
<language>{{ . }}</language>{{ end }}{{ with .Site.Author }}
<managingEditor>{{ .email }}{{ with .name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Author }}
<webMaster>{{ .email }}{{ with .name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
<copyright>{{ . | plainify }}</copyright>{{ end }}{{ if not now.IsZero }}
<lastBuildDate>{{ dateFormat "Mon, 02 Jan 2006 15:04:05" now.UTC | safeHTML }} UT</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "rss" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }}{{ range .Pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>{{ if not .PublishDate.IsZero }}
<pubDate>{{ dateFormat "Mon, 02 Jan 2006 15:04:05" .Date.UTC | safeHTML }} UT</pubDate>{{ end }}{{ if ne .Site.Params.hide_author true }}{{ if or (.Param "author") .Site.Author.email }}
<dc:creator>{{ default .Site.Author.email (.Param "author") }}{{ if and (not (.Param "author")) .Site.Author.name }} ({{ default (.Param "author") .Site.Author.name }}){{ end }}</dc:creator>{{ end }}{{ end }}
<guid>{{ .Permalink }}</guid>
<description>{{ .Summary | plainify }}</description>{{ range .Params.categories }}
<category domain="{{ printf "%s%s" ("/categories/" | absURL) (. | urlize ) }}">{{ . | title }}</category>{{ end }}{{ with .Resources.GetMatch "enclosure" }}{{ if .Params.length }}
<enclosure url="{{ .Permalink }}" length="{{ .Params.length }}" type="{{ .MediaType }}" />{{ end }}{{ end }}
<content:encoded>{{ "<![CDATA[" | safeHTML }}{{ .Content | plainify }}{{ "]]>" | safeHTML }}</content:encoded>
</item>{{ end }}
</channel>
</rss>

View File

@@ -0,0 +1,70 @@
{{/*
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/>.
*/}}
{{ define "title" -}}
{{ .Title }} | {{ .Site.Title }}
{{- end }}
{{ define "header" }}
{{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
<header>
<h1>{{ .Title }}</h1>
</header>
<div id="search-app" v-cloak>
{{ with resources.Get "css/conditional/layouts/search.css" | minify }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
<section>
<form v-on:submit.prevent role="search" class="form" action="{{ "search" | absURL }}">
<fieldset class="form-group">
<input v-model="query" id="query" name="s" type="search" class="form-control" maxlength="32" autocomplete="off"{{ with .Params.form.input.placeholder }} placeholder="{{ . }}"{{ end }}{{ if eq .Params.form.input.disabled true }} disabled{{ end }}>
{{ with .Params.form.helpblock }}
<div class="help-block js-cloaked">{{ . | safeHTML }}</div>
{{ end }}
<div class="help-block js-initializing">{{/* placeholder */}}</div>
</fieldset>
</form>
</section>
<noscript>
<p>Cannot initialize. Search requires JavaScript to function.</p>
</noscript>
<section v-if="results.length" class="js-cloaked">
<p><i>Showing results for “{ resultsForSearch }”.</i></p>
<div id="search-results">
<article v-for="result in results" itemscope itemtype="https://schema.org/CreativeWork">
<header itemprop="name">
<h2 itemprop="name"><a :href="result.item.url">{ result.item.title }</a></h2>
</header>
<div v-html=result.item.summary itemprop="description"></div>
<nav class="readmore"><p><a itemprop="url" :href="result.item.url">Read More&nbsp;&raquo;</a></p></nav>
</article>
</div>
</section>
</div>
{{ end }}
{{ define "footer" }}
<small class="muted">
{{ partial "copyright-notice.html" . }}
</small>
{{ $script := resources.Get "/js/search.js" | resources.ExecuteAsTemplate "search.js" . }}
<script integrity="{{ printf "%s" ($script | resources.Fingerprint "sha512").Data.Integrity | safeHTML }}">
{{- $script.Content | safeJS -}}
</script>
{{ end }}

View File

@@ -0,0 +1,36 @@
{{/*
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/>.
*/}}
{{ define "title" -}}
{{ .Title }} | {{ .Site.Title }}
{{- end }}
{{ define "header" }}
{{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
<header>
<h1>{{ .Title }}</h1>
</header>
{{ .Content }}
{{ end }}
{{ define "footer" }}
<small class="muted">
{{ partial "copyright-notice.html" . }}
</small>
{{ end }}

View File

@@ -0,0 +1,36 @@
{{/*
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/>.
*/}}
{{ define "header" }}
{{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
<header>
<h1>{{ .Title }}</h1>
</header>
{{ range .Paginator.Pages }}
{{ partial "page-summary.html" . }}
{{ end }}
{{ end }}
{{ define "footer" }}
<p>{{ partial "pagination.html" . }}</p>
<small class="muted">
{{ partial "copyright-notice.html" . }}
</small>
{{ end }}

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/>.
*/}}
{{ define "header" }}
{{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
<header>
<h1>{{ .Title }}</h1>
</header>
<ul>
{{ range $key, $value := .Data.Terms }}
<li><a href="{{ $key | urlize }}">{{ $key }}</a> ({{ len $value }})
{{ end }}
</ul>
{{ end }}
{{ define "footer" }}
{{ partial "copyright-notice.html" . }}
{{ end }}