Merge pull request #11 from Junyi-99/feature-main

Feature main
This commit is contained in:
Junyi 2024-03-06 14:02:19 +08:00 committed by GitHub
commit 6eaf3539fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 63 additions and 26 deletions

View File

@ -93,7 +93,7 @@ params:
tocWordCount: 300 # ...when a post is longer than 300 words tocWordCount: 300 # ...when a post is longer than 300 words
copyCodeButton: true # true by default copyCodeButton: true # true by default
rssAsSocialIcon: true rssAsSocialIcon: true
mathjax: false # https://www.mathjax.org/ mathjax: false # https://www.mathjax.org/ loading cost 257.4KiB network traffic
# utteranc.es support # utteranc.es support
utterancesRepo: "" # mandatory utterancesRepo: "" # mandatory
utterancesTheme: "" # optional utterancesTheme: "" # optional

View File

@ -4,7 +4,6 @@
--card-color: #2e2e33; --card-color: #2e2e33;
--card-border-color: #333333; --card-border-color: #333333;
--card-border-radius: 0.5em;
--link-color:#599ada; --link-color:#599ada;
--link-state-color:#ff5858; --link-state-color:#ff5858;

View File

@ -5,7 +5,7 @@
--card-color: #fafafa; --card-color: #fafafa;
--card-border-color: #eeeeee; --card-border-color: #eeeeee;
--card-border-radius: 0.5em;
--link-color:#1d60a3; --link-color:#1d60a3;
--link-state-color:rgb(163, 29, 29); --link-state-color:rgb(163, 29, 29);

View File

@ -30,6 +30,12 @@
{{ end }} {{ end }}
/* Basic */ /* Basic */
:root {
--card-border-radius: 0.5em;
--card-margin: 1.5em;
}
html { html {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
/* 1 */ /* 1 */
@ -280,12 +286,13 @@ header h2 {
header nav:not(:empty){ header nav:not(:empty){
background: var(--nav-bg-color); background: var(--nav-bg-color);
margin-top: 1em; margin-top: var(--card-margin);
max-width: 100%; max-width: 100%;
text-align: center; text-align: center;
padding: 0.5em 0; padding: 0.5em 0;
border: 1px solid var(--card-border-color); border: 1px solid var(--card-border-color);
border-radius: var(--card-border-radius); border-radius: var(--card-border-radius);
font-size: 14px;
} }
header nav a { header nav a {
@ -343,7 +350,7 @@ main h1 {
} }
article:not(:last-of-type) { article:not(:last-of-type) {
margin-bottom: 1.5em; margin-bottom: var(--card-margin);
} }
.post-short-list:first-of-type { .post-short-list:first-of-type {
@ -408,19 +415,19 @@ article:not(:last-of-type) {
} }
.post-title.favorite::after { .post-title.favorite::after {
content: ""; content: "🌟";
display: inline-block; display: inline-block;
margin-left: 0.2em; margin-left: 0.2em;
} }
.post-title.draft::after { .post-title.draft::after {
content: ""; content: "✏️";
display: inline-block; display: inline-block;
margin-left: 0.2em; margin-left: 0.2em;
} }
.post-title.favorite.draft::after { .post-title.favorite.draft::after {
content: "☆ ✎"; content: "🌟 ✏️";
display: inline-block; display: inline-block;
margin-left: 0.2em; margin-left: 0.2em;
} }

View File

@ -2,7 +2,7 @@ baseURL = "https://example.com"
languageCode = "en-us" languageCode = "en-us"
defaultContentLanguage = "en" defaultContentLanguage = "en"
title = "Anubis2" title = "Anubis2"
theme = "anubis" theme = "anubis2"
paginate = 3 paginate = 3
disqusShortname = "" disqusShortname = ""
@ -17,12 +17,13 @@ description = "Anubis2 is another simple minimalist theme for Hugo blog engine."
dateFormat = "2006-01-02" dateFormat = "2006-01-02"
paginationSinglePost = true paginationSinglePost = true
style = "auto" style = "auto"
readMore = false readMore = true
readNextPosts = 2 readNextPosts = 2
copyCodeButton = true copyCodeButton = true
rssAsSocialIcon = true rssAsSocialIcon = true
locale = "en-us" locale = "en-us"
mathjax = false mathjax = false
toc = true
# Graphcomment support # Graphcomment support
graphcommentId = "" graphcommentId = ""
@ -44,44 +45,57 @@ url = "https://github.com/Junyi-99/hugo-theme-anubis2"
[languages.en] [languages.en]
languageName = "English" languageName = "English"
[[menu.main]]
identifier = "home"
name = "Home"
url = "/"
weight = 1
[[menu.main]] [[menu.main]]
identifier = "about" identifier = "about"
name = "About" name = "About"
url = "/about/" url = "/about/"
weight = 1 weight = 2
[[menu.main]] [[menu.main]]
identifier = "tags" identifier = "tags"
name = "Tags" name = "Tags"
url = "/tags/" url = "/tags/"
weight = 2 weight = 3
[[menu.main]] [[menu.main]]
name = "Archive" name = "Archive"
identifier = "archive" identifier = "archive"
url = "/posts/" url = "/posts/"
weight = 3 weight = 4
[languages.pl] [languages.pl]
languageName = "Polski" languageName = "Polski"
[[languages.pl.menu.main]]
identifier = "home"
name = "Strona Główna"
url = "/"
weight = 1
[[languages.pl.menu.main]] [[languages.pl.menu.main]]
identifier = "about" identifier = "about"
name = "O Hugo" name = "O Hugo"
url = "/about/" url = "/about/"
weight = 1 weight = 2
[[languages.pl.menu.main]] [[languages.pl.menu.main]]
identifier = "tags" identifier = "tags"
name = "Tagi" name = "Tagi"
url = "/tags/" url = "/tags/"
weight = 2 weight = 3
[[languages.pl.menu.main]] [[languages.pl.menu.main]]
identifier = "archive" identifier = "archive"
name = "Archiwum" name = "Archiwum"
url = "/posts/" url = "/posts/"
weight = 3 weight = 4
[languages.pl.params] [languages.pl.params]
languageCode = "pl-pl" languageCode = "pl-pl"
@ -89,23 +103,29 @@ languageCode = "pl-pl"
[languages.zh] [languages.zh]
languageName = "Chinese" languageName = "Chinese"
[[languages.zh.menu.main]]
identifier = "home"
name = "首页"
url = "/"
weight = 1
[[languages.zh.menu.main]] [[languages.zh.menu.main]]
identifier = "about" identifier = "about"
name = "关于" name = "关于"
url = "/about/" url = "/about/"
weight = 1 weight = 2
[[languages.zh.menu.main]] [[languages.zh.menu.main]]
identifier = "tags" identifier = "tags"
name = "标签" name = "标签"
url = "/tags/" url = "/tags/"
weight = 2 weight = 3
[[languages.zh.menu.main]] [[languages.zh.menu.main]]
identifier = "archive" identifier = "archive"
name = "归档" name = "归档"
url = "/posts/" url = "/posts/"
weight = 3 weight = 4
[languages.zh.params] [languages.zh.params]
languageCode = "zh-cn" languageCode = "zh-cn"

View File

@ -1,10 +1,21 @@
{{ $toc := and ($.Site.Params.toc) (ge .WordCount $.Site.Params.tocWordCount) }} {{ if isset .Params "toc" }} {{ $toc = .Params.toc }} {{ end }} {{ if $toc }} {{ $toc := and ($.Site.Params.toc) (ge .WordCount $.Site.Params.tocWordCount) }}
<details class="toc noselect"> {{ if isset .Params "toc" }}
<summary>Table of Contents</summary> {{ $toc = .Params.toc }}
<div class="inner">{{ .TableOfContents }}</div> {{ end }}
</details>
{{ if $toc }}
{{ $tocContent := .TableOfContents }}
{{ if findRE "<li>" $tocContent }}
<!-- we show the toc only if we have element in .TableOfContents -->
<details class="toc noselect">
<summary>Table of Contents</summary>
<div class="inner">{{ .TableOfContents }}</div>
</details>
{{ end }}
{{ end }} {{ end }}
<script> <script>
document.querySelector(".toc").addEventListener("click", function () { document.querySelector(".toc").addEventListener("click", function () {
if (event.target.tagName !== "A") { if (event.target.tagName !== "A") {

View File

@ -1,9 +1,9 @@
name = "Anubis" name = "Anubis2"
license = "MIT" license = "MIT"
licenselink = "https://github.com/Junyi-99/hugo-theme-anubis2/blob/master/LICENSE" licenselink = "https://github.com/Junyi-99/hugo-theme-anubis2/blob/master/LICENSE"
description = "A minimal Hugo theme" description = "A minimal Hugo theme"
homepage = "https://github.com/Junyi-99/hugo-theme-anubis2" homepage = "https://github.com/Junyi-99/hugo-theme-anubis2"
demosite = "https://hugo-theme-anubis.netlify.app/" demosite = "https://hugo-theme-anubis2.netlify.app/"
tags = [ tags = [
"blog", "blog",
"responsive", "responsive",