script to fix anubis

master
Bel LaPointe 2021-11-29 15:25:43 -07:00
parent 7ee21a8e3f
commit 6efca3bc62
38 changed files with 80 additions and 44 deletions

5
blog/themes/anubis.sh Normal file
View File

@ -0,0 +1,5 @@
#! /bin/bash
sed -i 's/href="{{ (print /href="\/{{ (print /' ./anubis/layouts/_default/terms.html
sed -i 's/href="{{ "categories/href="{{ "\/categories/' ./anubis/layouts/partials/post-info.html
sed -i 's/href="{{ "tags/href="{{ "\/tags/' ./anubis/layouts/partials/post-info.html

View File

@ -1,7 +1,9 @@
# Anubis Theme for Hugo [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) [![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://www.paypal.com/paypalme/mitrichius/1)
# Anubis Theme for Hugo [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) [![Netlify Status](https://api.netlify.com/api/v1/badges/7d9ea909-ad7e-4e47-b7c9-eefb7522d8c6/deploy-status)](https://app.netlify.com/sites/hugo-theme-anubis/deploys) [![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://www.paypal.com/paypalme/mitrichius/1)
Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
[Demo](https://hugo-theme-anubis.netlify.app/)
![Anubis Screenshot](https://raw.githubusercontent.com/mitrichius/hugo-theme-anubis/master/images/screenshot.png)
## Features
@ -119,7 +121,7 @@ Options:
- `auto-without-switcher` - theme based on user system settings, without switcher, JS-free
- `light` - light theme by default, can be switched by user to dark theme and back. Theme settings are saved for user
- `dark` - dark theme by default, can be switched by user to light theme and back. Theme settings are saved for user
- `auto` - theme based on user system settings by default, can be switched by user to dark/light theme. Theme settings are saved for user
- `auto` - theme based on user system settings by default, can be switched by user to dark/light theme. Theme settings are saved for user (by default in example sites)
### Social icons
#### Predefined icons
@ -167,9 +169,7 @@ Icon should be "static/fa-icons/google.svg"
If you want font awesome icons, download "Font Awesome For Desktop" and open svg directory.
### Google Analytics
Only works for production environment. You either build your site with variable like
`HUGO_ENV=production hugo --minify`
or just put `env: production` to `params` section of config.
Only works for production environment.
### Multilingual mode
Check config/example usage in [exampleSiteMultilingual](https://github.com/Mitrichius/hugo-theme-anubis/tree/master/exampleSiteMultilingual) directory and documentation on [Hugo site](https://gohugo.io/content-management/multilingual/).

View File

@ -143,8 +143,6 @@ th, td {
/* Code */
pre {
color: var(--pre-color);
background-color: var(--pre-bg-color);
padding: 1em;
max-width: 100%;
overflow: auto;
@ -153,6 +151,8 @@ pre {
code,
pre,
kbd {
color: var(--pre-color);
background-color: var(--pre-bg-color);
font-family: monospace;
font-size: 0.90em;
line-height: 154%;
@ -298,6 +298,10 @@ main h1 {
color: var(--link-state-color);
}
.post-short-list .post-title {
display: inline;
}
.post-title.favorite::after {
content: "☆";
display: inline-block;

View File

@ -15,7 +15,7 @@ author = "Dmitry Kolosov"
description = "Anubis is a simple minimalist theme for Hugo blog engine."
dateFormat = "2006-01-02"
paginationSinglePost = true
style = "light-without-switcher"
style = "auto"
readMore = false
# utteranc.es support

View File

@ -23,7 +23,7 @@ Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-manageme
## Twitter Simple Shortcode
{{< twitter_simple 1085870671291310081 >}}
{{< tweet user="DesignReviewed" id="1085870671291310081" >}}
<br>

View File

@ -16,7 +16,7 @@ author = "Dmitry Kolosov"
description = "Anubis is a simple minimalist theme for Hugo blog engine."
dateFormat = "2006-01-02"
paginationSinglePost = true
style = "light-without-switcher"
style = "auto"
readMore = false
# utteranc.es support

View File

@ -23,7 +23,7 @@ Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-manageme
## Twitter Simple Shortcode
{{< twitter_simple 1085870671291310081 >}}
{{< tweet user="DesignReviewed" id="1085870671291310081" >}}
<br>

View File

@ -23,7 +23,7 @@ Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-manageme
## Twitter Simple Shortcode
{{< twitter_simple 1085870671291310081 >}}
{{< tweet user="DesignReviewed" id="1085870671291310081" >}}
<br>

View File

@ -6,7 +6,7 @@
{{ end }}
</nav>
{{ end }}
<article class="post h-entry">
<header class="post-header">
<h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}">{{ trim .Title " " }}</h1>
@ -24,11 +24,11 @@
{{ end }}
{{ if .Site.DisqusShortname }}
{{ template "_internal/disqus.html" . }}
{{ partial "disqus.html" . }}
{{ end }}
{{ if .Site.Params.UtterancesRepo }}
{{ partial "utterances.html" . }}
{{ end }}
{{ end }}
{{ end }}

View File

@ -1,7 +1,7 @@
{{ define "main" }}
<h1>{{ i18n .Data.Singular | humanize }}: {{ .Title }}</h1>
<div class="post-info">
<a href="{{ (printf "%s/%s" .Site.LanguagePrefix .Data.Plural) | absLangURL }}">{{ i18n (printf "toAll%s" (.Data.Plural | humanize )) | humanize }}</a>
<a href="{{ (print .Data.Plural "/") | relLangURL }}">{{ i18n (printf "toAll%s" (.Data.Plural | humanize )) | humanize }}</a>
</div>
{{ range .Paginator.Pages }}
{{ partial "post-summary.html" . }}

View File

@ -16,4 +16,4 @@
{{ end }}
</ul>
{{ end }}
{{ end }}

View File

@ -0,0 +1 @@
{{ template "_internal/disqus.html" . }}

View File

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 754 B

View File

Before

Width:  |  Height:  |  Size: 524 B

After

Width:  |  Height:  |  Size: 524 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 684 B

View File

Before

Width:  |  Height:  |  Size: 417 B

After

Width:  |  Height:  |  Size: 417 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 556 B

View File

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 460 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 869 B

View File

Before

Width:  |  Height:  |  Size: 730 B

After

Width:  |  Height:  |  Size: 730 B

View File

@ -0,0 +1,2 @@
<link rel="icon" type="image/x-icon" href="{{ "favicon.ico" | absURL }}">
<link rel="apple-touch-icon-precomposed" href="{{ "favicon.png" | absURL }}">

View File

@ -1,15 +1,15 @@
<span class="inline-svg" >
{{ $dict := newScratch }}
{{ if (eq .custom true) }}
{{ $dict.Set "filename" (print "static/fa-icons/" .iconName ".svg") }}
{{ if (eq .custom true) }}
{{ $dict.Set "svg" (readFile (print "static/fa-icons/" .iconName ".svg")) }}
{{ else }}
{{ $dict.Set "filename" (print "themes/anubis/static/fa-icons/" .iconName ".svg") }}
{{ $dict.Set "svg" (partial (print "fa-icons/" .iconName ".svg")) }}
{{ end }}
{{- $path:="<path" -}}
{{- $fill:="<path fill=\"currentColor\"" -}}
{{ replace (readFile ($dict.Get "filename")) $path $fill | safeHTML }}
{{ replace ($dict.Get "svg") $path $fill | safeHTML }}
</span>

View File

@ -4,16 +4,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="no-referrer-when-downgrade">
<title>{{ if and (.Title) (not .IsHome) }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
<meta name="description" content="{{ .Site.Params.Description }}">
{{ partial "title.html" . }}
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}">
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
<link rel="icon" type="image/x-icon" href="{{ "favicon.ico" | absURL }}">
<link rel="apple-touch-icon-precomposed" href="{{ "favicon.png" | absURL }}">
{{ partial "favicons.html" . }}
{{ partial "resource.html" (dict "context" . "type" "css" "filename" "css/main.css") }}
{{ range .Site.Params.customJS -}}
@ -41,7 +39,7 @@
<meta property="article:tag" content="">
<meta property="article:publisher" content="https://www.facebook.com/XXX"> -->
{{ if and (.Site.GoogleAnalytics) (or (eq (getenv "HUGO_ENV") "production") (eq .Site.Params.env "production")) }}
{{ if and (.Site.GoogleAnalytics) (hugo.IsProduction) }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}

View File

@ -1,5 +1,15 @@
<ul class="language-select">
{{ range $.Site.Home.AllTranslations }}
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
</ul>
{{ $pageLang := .Page.Lang}}
{{ $translations := .AllTranslations }}
{{ if not .IsTranslated }}
{{ $translations = $.Site.Home.AllTranslations }}
{{ end }}
{{ range $translations }}
{{ if eq .Lang $pageLang }}
<li>{{ .Language.LanguageName }}</li>
{{ else }}
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
{{ end }}
</ul>

View File

@ -1,15 +1,15 @@
{{ if or ( .Paginator.HasPrev ) ( .Paginator.HasNext ) }}
{{ $toNewPostsMessage := i18n "toNewPosts" }}
{{ $toOldPostsMessage := i18n "toOldPosts" }}
{{ $toOldPostsMessage := i18n "toOldPosts" }}
<div class="pagination">
<div class="left pagination-item {{ if not .Paginator.HasPrev }}disabled{{ end }}">
{{ if .Paginator.HasPrev }}
<a href="{{ .Paginator.Prev.URL | relLangURL }}">{{ $toNewPostsMessage }}</a>
<a href="{{ .Paginator.Prev.URL }}">{{ $toNewPostsMessage }}</a>
{{ end }}
</div>
<div class="right pagination-item {{ if not .Paginator.HasNext }}disabled{{ end }}">
{{ if .Paginator.HasNext }}
<a href="{{ .Paginator.Next.URL | relLangURL }}">{{ $toOldPostsMessage }}</a>
<a href="{{ .Paginator.Next.URL }}">{{ $toOldPostsMessage }}</a>
{{ end }}
</div>
</div>

View File

@ -7,7 +7,7 @@
{{ if .Params.date }}
<div class="post-date dt-published">{{ .Params.date.Format $dateFormat }}</div>
{{ end }}
<a class="post-hidden-url u-url" href="{{ .Permalink }}">{{ .Permalink }}</a>
<a href="{{ .Site.BaseURL }}" class="p-name p-author post-hidden-author h-card" rel="me">{{ .Params.author | default .Site.Params.author }}</a>
@ -16,7 +16,7 @@
{{ if .Params.categories }}
<ul class="post-categories">
{{ range .Params.categories }}
<li><a href="{{ "/categories/" | urlize | absLangURL }}">{{ . }}</a></li>
<li><a href="{{ "/categories/" | absLangURL }}{{ . | urlize }}">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}

View File

@ -2,12 +2,12 @@
<div class="pagination post-pagination">
<div class="left pagination-item {{ if not .NextInSection }}disabled{{ end }}">
{{ if .NextInSection }}
<a href="{{ .NextInSection.Permalink | relLangURL }}">{{ .NextInSection.Title }}</a>
<a href="{{ .NextInSection.RelPermalink }}">{{ .NextInSection.Title }}</a>
{{ end }}
</div>
<div class="right pagination-item {{ if not .PrevInSection }}disabled{{ end }}">
{{ if .PrevInSection }}
<a href="{{ .PrevInSection.Permalink | relLangURL }}">{{ .PrevInSection.Title }}</a>
<a href="{{ .PrevInSection.RelPermalink }}">{{ .PrevInSection.Title }}</a>
{{ end }}
</div>
</div>

View File

@ -9,7 +9,7 @@
{{ if $resource }}
{{ $resource := $resource | resources.ExecuteAsTemplate $targetFilename . }}
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{ if hugo.IsProduction }}
{{ $resource = $resource | resources.Minify }}
{{ end }}
{{ $resource = $resource | resources.Fingerprint "sha256" }}
@ -26,4 +26,4 @@
{{ else if eq .type "js" }}
<script src="{{ .filename | absURL }}?rnd={{ now.Unix }}" type="text/javascript" charset="utf-8"></script>
{{ end }}
{{ end }}
{{ end }}

View File

@ -0,0 +1 @@
<title>{{ if and (.Title) (not .IsHome) }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>

View File

@ -1,7 +1,7 @@
User-agent: *
# robotstxt.org - if ENV production variable is false robots will be disallowed.
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
# robotstxt.org - if environment is not `production` then robots will be disallowed.
{{ if hugo.IsProduction }}
Disallow:
{{ else }}
Disallow: /
{{ end }}
{{ end }}

View File

@ -0,0 +1,15 @@
[build]
publish = "exampleSiteMultilingual/public"
command = "cd exampleSiteMultilingual && hugo --themesDir=../.. --baseURL $URL"
[build.environment]
HUGO_VERSION = "0.89.0"
HUGO_THEME = "repo"
[context.deploy-preview]
command = "cd exampleSiteMultilingual && hugo --themesDir=../.. --buildFuture --buildDrafts --baseURL $DEPLOY_PRIME_URL"
[[headers]]
for = "/*"
[headers.values]
Access-Control-Allow-Origin = "*"