diff --git a/README.md b/README.md index 507c728..dbe0c9f 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,12 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/). - Mobile support - Social icons - Google Analytics -- Disqus -- ISSO -- Utteranc.es +- Comment systems: Disqus, ISSO, Utteranc.es, GraphComment - RSS feeds +- Related posts (Read Next section) +- Deploy via Netlify (config included in example site) - Hiding posts from the RSS feed +- Hidden posts (available only by link) - Translations (en, ru, fr, pl) - Custom CSS/JS - Multilingual mode @@ -80,8 +81,11 @@ params: dateFormat: "2006-01-02" paginationSinglePost: true style: light-without-switcher - readMore: false + readMore: false # show read more button + readNextPosts: 5 # show 5 related posts, 0 by default disableSummary: false + copyCodeButton: true # true by default + rssAsSocialIcon: true # utteranc.es support utterancesRepo: "" # mandatory utterancesTheme: "" # optional @@ -101,6 +105,7 @@ params: avatar: true # optional avatar-bg: "#f0f0f0" # optional feed: false # optional + graphcommentId: "" webmentions: url: https://yourdomain.com/webemntions/receive login: hugo-theme-anubis @@ -131,9 +136,9 @@ Now enter [`localhost:1313`](http://localhost:1313/) in the address bar of your ### Dark Mode Customize via `style` param in `params` section of config. Options: -- `light-without-switcher` - light theme, without switcher, JS-free (by default) -- `dark-without-switcher` - dark theme, without switcher, JS-free -- `auto-without-switcher` - theme based on user system settings, without switcher, JS-free +- `light-without-switcher` - light theme, without switcher (by default) +- `dark-without-switcher` - dark theme, without switcher +- `auto-without-switcher` - theme based on user system settings, without switcher - `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 (by default in example sites) @@ -202,15 +207,25 @@ 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/). +### RSS +RSS is available by site url + /index.xml. Also available for specific language, section, taxonomy. +`rssAsSocialIcon` parameter enables rss sosial icon with link to site current language RSS. + ### Robots.txt Based on environment. For production — allow all, for other — disallow all. ### Favorite posts -To mark posts as favorite just add `favorite: true` in post's front matter. It adds a "★" icon nearby post's title. +Add `favorite: true` to post front matter. It adds a "★" icon nearby post's title. + +### Related posts (Read Next section) +Based on `readNextPosts` config parameter. Check [this article](https://gohugo.io/content-management/related/#configure-related-content) for configuration details. ### Hiding posts from RSS -To hide a post from the RSS feed, just add `disable_feed: true` to its front matter. +Add `disable_feed: true` to post front matter. + +### Make post available only by link +Add `hidden: true` to post front matter. Post also is not available in RSS feed. ### Pagination on post single page Enabled by `paginationSinglePost` param in `params` section of config. @@ -219,6 +234,9 @@ Enabled by `paginationSinglePost` param in `params` section of config. To provide webmention support you can **either** specify your webmention.io username with `login: webmentionusername` **or** specify a link to your custom webmention endpoint with `url: https://yourdomain.com/webemntions/receive`. If you use webmention.io you can also enable pingback with `pingback: true` +### Disabling comments per-page basis +Add `disableComments: true` to post front matter. + ## Contributing If you find a bug or have an idea for a feature, feel free to write an [issue](https://github.com/mitrichius/hugo-theme-anubis/issues) or make a PR. diff --git a/assets/css/dark.css b/assets/css/dark.css index a048cba..927a7cc 100644 --- a/assets/css/dark.css +++ b/assets/css/dark.css @@ -12,8 +12,8 @@ --nav-bg-color: #242424; --nav-link-color: #b6b6b6; ---pre-color: #333; ---pre-bg-color: #f1f1f1; +--pre-color: #f8f8f2; +--pre-bg-color: #272822; --bq-color: #ccc; --hr-color: #333; @@ -25,3 +25,6 @@ --switcher-color: #333; --switcher-bg-color: #fff; + +--svg-color: #ccc; +--svg-state-color:#ff5858; diff --git a/assets/css/light.css b/assets/css/light.css index cf45d75..3bb2fad 100644 --- a/assets/css/light.css +++ b/assets/css/light.css @@ -13,8 +13,8 @@ --nav-bg-color: #fafafa; --nav-link-color: #696969; - --pre-color: #333; - --pre-bg-color: #f1f1f1; + --pre-color: #f8f8f2; + --pre-bg-color: #272822; --bq-color: #ccc; --hr-color: #ccc; @@ -26,4 +26,7 @@ --switcher-color: #fff; --switcher-bg-color: #333; + + --svg-color: #333; + --svg-state-color: #a31d1d; } diff --git a/assets/css/main.css b/assets/css/main.css index 2481ddd..3663bb4 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -341,7 +341,6 @@ article:not(:last-of-type) { padding-bottom: 2em; } - article header h1 { font-size: 1.35em; line-height: 1.1em; @@ -356,6 +355,87 @@ article header h1 a { text-decoration: none; } +.post h1, +.post h2, +.post h3, +.post h4, +.post h5, +.post h6 { + position: relative; +} + +.post h1 a, +.post h2 a, +.post h3 a, +.post h4 a, +.post h5 a, +.post h6 a { + opacity: 0; + position: absolute; + left: -1.2rem; +} + +.post h1:hover a, +.post h2:hover a, +.post h3:hover a, +.post h4:hover a, +.post h5:hover a, +.post h6:hover a { + opacity: 1; + border-bottom: none; +} + +.post h1 a:hover, +.post h1 a:focus, +.post h1 a:active, +.post h2 a:hover, +.post h2 a:focus, +.post h2 a:active, +.post h3 a:hover, +.post h3 a:focus, +.post h3 a:active, +.post h4 a:hover, +.post h4 a:focus, +.post h4 a:active, +.post h5 a:hover, +.post h5 a:focus, +.post h5 a:active, +.post h6 a:hover, +.post h6 a:focus, +.post h6 a:active { + border-bottom: none; +} + +.post h1 svg, +.post h2 svg, +.post h3 svg, +.post h4 svg, +.post h5 svg, +.post h6 svg { + stroke: var(--svg-color); +} + +.post h1 svg:hover, +.post h1 svg:focus, +.post h1 svg:active, +.post h2 svg:hover, +.post h2 svg:focus, +.post h2 svg:active, +.post h3 svg:hover, +.post h3 svg:focus, +.post h3 svg:active, +.post h4 svg:hover, +.post h4 svg:focus, +.post h4 svg:active, +.post h5 svg:hover, +.post h5 svg:focus, +.post h5 svg:active, +.post h6 svg:hover, +.post h6 svg:focus, +.post h6 svg:active { + stroke: var(--svg-state-color); +} + .post-info { color: var(--post-info-color); font-size: 0.75em; @@ -476,6 +556,16 @@ article figcaption { color: var(--link-state-color); } +.read-next-title { + margin-bottom: 0; +} + +.read-next-posts { + margin-top: 5px; + list-style-type:"- "; + padding-inline-start: 20px; +} + /* Other pages */ .terms { list-style-type: none; @@ -560,6 +650,47 @@ ul.language-select > li, ul.footer-menu > li { display: none; } +/* Copy code */ +.highlight { + position: relative; +} +.highlight pre { + padding-right: 75px; +} + +.highlight:hover .highlight-copy-btn { + display: inline-block; + border: 1px solid var(--bg-color); +} + +.highlight-copy-btn { + display: none; + position: absolute; + top: 7px; + right: 7px; + border: 0; + border-radius: 4px; + padding: 1px; + font-size: 0.7em; + line-height: 1.8; + color: #fff; + background-color: #777; + min-width: 25px; + text-align: center; + border-radius: 5px; +} +.highlight-copy-btn:hover { + transition-duration: .1s; + background-color: #666; + border: 1px solid var(--bq-color) !important; +} + +.highlight-copy-btn, +.highlight-copy-btn svg { + vertical-align: middle; + margin: 8px; +} + /* Media Queries */ @media (max-width: 840px) { diff --git a/assets/images/link.svg b/assets/images/link.svg new file mode 100644 index 0000000..17830a4 --- /dev/null +++ b/assets/images/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/js/copy-code.js b/assets/js/copy-code.js new file mode 100644 index 0000000..e772f52 --- /dev/null +++ b/assets/js/copy-code.js @@ -0,0 +1,64 @@ +/* +This file has been taken from following blogpost with some modifications: +https://koki-nakamura22.github.io/blog/2019/10/03/hugo-adding-copy-button/ +Many thanks to Koki Nakamura! +*/ + +document.addEventListener("DOMContentLoaded", function(event) { + 'use strict'; + + if(!document.queryCommandSupported('copy')) { + return; + } + + let svgCopyCode = ''; + let svgSuccessCode = ''; + let svgFailCode = ''; + + function changeIcon(el, innerHtml) { + el.innerHTML = innerHtml; + setTimeout(() => { + el.innerHTML = svgCopyCode; + }, 1000); + } + + function selectText(node) { + let selection = window.getSelection(); + let range = document.createRange(); + if (node.childElementCount === 2) { + // Skip the title. + range.selectNodeContents(node.children[1]); + } else { + range.selectNodeContents(node); + } + selection.removeAllRanges(); + selection.addRange(range); + return selection; + } + + function addCopyButton(containerEl) { + let copyBtn = document.createElement("button"); + copyBtn.className = "highlight-copy-btn"; + copyBtn.innerHTML = svgCopyCode; + + let codeEl = containerEl.firstElementChild; + copyBtn.addEventListener('click', () => { + try { + let selection = selectText(codeEl); + document.execCommand('copy'); + selection.removeAllRanges(); + + changeIcon(copyBtn, svgSuccessCode) + } catch(e) { + console && console.log(e); + changeIcon(copyBtn, svgFailCode) + } + }); + + containerEl.appendChild(copyBtn); + } + + // Add copy button to code blocks + let highlightBlocks = document.getElementsByClassName('highlight'); + Array.prototype.forEach.call(highlightBlocks, addCopyButton); +}, false); \ No newline at end of file diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 681db9c..e1d58c4 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -17,6 +17,12 @@ dateFormat = "2006-01-02" paginationSinglePost = true style = "auto" readMore = false +readNextPosts = 2 +copyCodeButton = true +rssAsSocialIcon = true + +# Graphcomment support +graphcommentId = "" # utteranc.es support utterancesRepo = "" # mandatory @@ -57,4 +63,4 @@ category = "categories" tag = "tags" [markup.goldmark.renderer] -unsafe = true \ No newline at end of file +unsafe = true diff --git a/exampleSite/content/about-subpage.md b/exampleSite/content/about-subpage.md index 1d1dc16..f499aa6 100644 --- a/exampleSite/content/about-subpage.md +++ b/exampleSite/content/about-subpage.md @@ -1,23 +1,24 @@ --- -title: "Subpage" -description: "Just a subpage of about" +title: "About subpage" +description: "About subpage" date: "2019-02-28" author: "Hugo Authors" slug: /about/subpage menu: about: - identifier: about - name: About - title: About - url: /about + identifier: about-subpage-s + parent: about + name: About Subpage + title: About Subpage + url: /about/subpage/ weight: 1 subpage: - identifier: subpage + identifier: about-subpage2-s parent: about - name: Subpage - title: Subpage - url: /about/subpage/ + name: Second About subpage + title: Second About subpage + url: /about/subpage2/ weight: 10 --- -Just a subpage of About. +About subpage diff --git a/exampleSite/content/about-subpage2.md b/exampleSite/content/about-subpage2.md new file mode 100644 index 0000000..7963032 --- /dev/null +++ b/exampleSite/content/about-subpage2.md @@ -0,0 +1,24 @@ +--- +title: "Second About subpage" +description: "Second About subpage" +date: "2019-02-28" +author: "Hugo Authors" +slug: /about/subpage2 +menu: + about: + identifier: about-subpage-s2 + parent: about + name: About Subpage + title: About Subpage + url: /about/subpage/ + weight: 1 + subpage: + identifier: about-subpage2-s2 + parent: about + name: Second About subpage + title: Second About subpage + url: /about/subpage2/ + weight: 10 +--- + +Second About subpage diff --git a/exampleSite/content/about.md b/exampleSite/content/about.md index 627e661..6040fc8 100644 --- a/exampleSite/content/about.md +++ b/exampleSite/content/about.md @@ -2,22 +2,22 @@ title: "About" description: "Hugo, the world’s fastest framework for building websites" date: "2019-02-28" -aliases: - - "about-us" - - "about-hugo" - - "contact" +aliases: ["about-us","about-hugo","contact"] author: "Hugo Authors" menu: about: - name: About - title: About - url: /about + identifier: about-subpage + parent: about + name: About Subpage + title: About Subpage + url: /about/subpage/ weight: 1 subpage: + identifier: about-subpage2 parent: about - name: Subpage - title: Subpage - url: /about/subpage + name: Second About subpage + title: Second About subpage + url: /about/subpage2/ weight: 10 --- diff --git a/exampleSite/content/post/hidden-post.md b/exampleSite/content/post/hidden-post.md new file mode 100644 index 0000000..4239564 --- /dev/null +++ b/exampleSite/content/post/hidden-post.md @@ -0,0 +1,12 @@ ++++ +author = "Dmitry Kolosov" +title = "Hidden Post" +date = "2021-12-24" +description = "Post available only by link" +tags = [ + "privacy" +] +hidden = true ++++ + +This is hidden post \ No newline at end of file diff --git a/exampleSite/netlify.toml b/exampleSite/netlify.toml new file mode 100644 index 0000000..a7f6233 --- /dev/null +++ b/exampleSite/netlify.toml @@ -0,0 +1,8 @@ +[build] +publish = "public" +command = "hugo --gc --minify" + +[context.production.environment] +HUGO_VERSION = "0.92.0" +HUGO_ENV = "production" +HUGO_ENABLEGITINFO = "true" \ No newline at end of file diff --git a/exampleSiteMultilingual/config.toml b/exampleSiteMultilingual/config.toml index eb3e094..e8cfc91 100644 --- a/exampleSiteMultilingual/config.toml +++ b/exampleSiteMultilingual/config.toml @@ -18,6 +18,12 @@ dateFormat = "2006-01-02" paginationSinglePost = true style = "auto" readMore = false +readNextPosts = 2 +copyCodeButton = true +rssAsSocialIcon = true + +# Graphcomment support +graphcommentId = "" # utteranc.es support utterancesRepo = "" # mandatory @@ -80,4 +86,4 @@ category = "categories" tag = "tags" [markup.goldmark.renderer] -unsafe = true \ No newline at end of file +unsafe = true diff --git a/exampleSiteMultilingual/content/about-subpage.md b/exampleSiteMultilingual/content/about-subpage.md new file mode 100644 index 0000000..413f0ea --- /dev/null +++ b/exampleSiteMultilingual/content/about-subpage.md @@ -0,0 +1,24 @@ +--- +title: "About Subpage" +description: "About Subpage" +date: "2019-02-28" +author: "Hugo Authors" +slug: /about/subpage +menu: + subpage: + identifier: about-subpage-s + parent: about + name: About Subpage + title: About Subpage + url: /about/subpage/ + weight: 1 + subpage2: + identifier: about-subpage2-s + parent: about + name: Second About Subpage + title: Second About Subpage + url: /about/subpage2/ + weight: 10 +--- + +About subpage diff --git a/exampleSiteMultilingual/content/about-subpage.pl.md b/exampleSiteMultilingual/content/about-subpage.pl.md new file mode 100644 index 0000000..413f0ea --- /dev/null +++ b/exampleSiteMultilingual/content/about-subpage.pl.md @@ -0,0 +1,24 @@ +--- +title: "About Subpage" +description: "About Subpage" +date: "2019-02-28" +author: "Hugo Authors" +slug: /about/subpage +menu: + subpage: + identifier: about-subpage-s + parent: about + name: About Subpage + title: About Subpage + url: /about/subpage/ + weight: 1 + subpage2: + identifier: about-subpage2-s + parent: about + name: Second About Subpage + title: Second About Subpage + url: /about/subpage2/ + weight: 10 +--- + +About subpage diff --git a/exampleSiteMultilingual/content/about-subpage2.md b/exampleSiteMultilingual/content/about-subpage2.md new file mode 100644 index 0000000..372dced --- /dev/null +++ b/exampleSiteMultilingual/content/about-subpage2.md @@ -0,0 +1,24 @@ +--- +title: "Second About Subpage" +description: "Second About Subpage" +date: "2019-02-28" +author: "Hugo Authors" +slug: /about/subpage2 +menu: + subpage: + identifier: about-subpage-s2 + parent: about + name: About Subpage + title: About Subpage + url: /about/subpage/ + weight: 1 + subpage2: + identifier: about-subpage2-s2 + parent: about + name: Second About Subpage + title: Second About Subpage + url: /about/subpage2/ + weight: 10 +--- + +Second About subpage diff --git a/exampleSiteMultilingual/content/about-subpage2.pl.md b/exampleSiteMultilingual/content/about-subpage2.pl.md new file mode 100644 index 0000000..372dced --- /dev/null +++ b/exampleSiteMultilingual/content/about-subpage2.pl.md @@ -0,0 +1,24 @@ +--- +title: "Second About Subpage" +description: "Second About Subpage" +date: "2019-02-28" +author: "Hugo Authors" +slug: /about/subpage2 +menu: + subpage: + identifier: about-subpage-s2 + parent: about + name: About Subpage + title: About Subpage + url: /about/subpage/ + weight: 1 + subpage2: + identifier: about-subpage2-s2 + parent: about + name: Second About Subpage + title: Second About Subpage + url: /about/subpage2/ + weight: 10 +--- + +Second About subpage diff --git a/exampleSiteMultilingual/content/about.md b/exampleSiteMultilingual/content/about.md index a412806..0c2f335 100644 --- a/exampleSiteMultilingual/content/about.md +++ b/exampleSiteMultilingual/content/about.md @@ -1,10 +1,25 @@ -+++ -title = "About" -description = "Hugo, the world’s fastest framework for building websites" -date = "2019-02-28" -aliases = ["about-us","about-hugo","contact"] -author = "Hugo Authors" -+++ +--- +title: "About" +description: "Hugo, the world’s fastest framework for building websites" +date: "2019-02-28" +aliases: ["about-us","about-hugo","contact"] +author: "Hugo Authors" +menu: + subpage: + identifier: about-subpage + parent: about + name: About Subpage + title: About Subpage + url: /about/subpage/ + weight: 1 + subpage2: + identifier: about-subpage2 + parent: about + name: Second About Subpage + title: Second About Subpage + url: /about/subpage2/ + weight: 10 +--- Written in Go, Hugo is an open source static site generator available under the [Apache Licence 2.0.](https://github.com/gohugoio/hugo/blob/master/LICENSE) Hugo supports TOML, YAML and JSON data file types, Markdown and HTML content files and uses shortcodes to add rich content. Other notable features are taxonomies, multilingual mode, image processing, custom output formats, HTML/CSS/JS minification and support for Sass SCSS workflows. diff --git a/exampleSiteMultilingual/content/about.pl.md b/exampleSiteMultilingual/content/about.pl.md index a412806..0c2f335 100644 --- a/exampleSiteMultilingual/content/about.pl.md +++ b/exampleSiteMultilingual/content/about.pl.md @@ -1,10 +1,25 @@ -+++ -title = "About" -description = "Hugo, the world’s fastest framework for building websites" -date = "2019-02-28" -aliases = ["about-us","about-hugo","contact"] -author = "Hugo Authors" -+++ +--- +title: "About" +description: "Hugo, the world’s fastest framework for building websites" +date: "2019-02-28" +aliases: ["about-us","about-hugo","contact"] +author: "Hugo Authors" +menu: + subpage: + identifier: about-subpage + parent: about + name: About Subpage + title: About Subpage + url: /about/subpage/ + weight: 1 + subpage2: + identifier: about-subpage2 + parent: about + name: Second About Subpage + title: Second About Subpage + url: /about/subpage2/ + weight: 10 +--- Written in Go, Hugo is an open source static site generator available under the [Apache Licence 2.0.](https://github.com/gohugoio/hugo/blob/master/LICENSE) Hugo supports TOML, YAML and JSON data file types, Markdown and HTML content files and uses shortcodes to add rich content. Other notable features are taxonomies, multilingual mode, image processing, custom output formats, HTML/CSS/JS minification and support for Sass SCSS workflows. diff --git a/exampleSiteMultilingual/content/post/hidden-post.md b/exampleSiteMultilingual/content/post/hidden-post.md new file mode 100644 index 0000000..4239564 --- /dev/null +++ b/exampleSiteMultilingual/content/post/hidden-post.md @@ -0,0 +1,12 @@ ++++ +author = "Dmitry Kolosov" +title = "Hidden Post" +date = "2021-12-24" +description = "Post available only by link" +tags = [ + "privacy" +] +hidden = true ++++ + +This is hidden post \ No newline at end of file diff --git a/exampleSiteMultilingual/content/post/hidden-post.pl.md b/exampleSiteMultilingual/content/post/hidden-post.pl.md new file mode 100644 index 0000000..4239564 --- /dev/null +++ b/exampleSiteMultilingual/content/post/hidden-post.pl.md @@ -0,0 +1,12 @@ ++++ +author = "Dmitry Kolosov" +title = "Hidden Post" +date = "2021-12-24" +description = "Post available only by link" +tags = [ + "privacy" +] +hidden = true ++++ + +This is hidden post \ No newline at end of file diff --git a/exampleSiteMultilingual/netlify.toml b/exampleSiteMultilingual/netlify.toml new file mode 100644 index 0000000..a7f6233 --- /dev/null +++ b/exampleSiteMultilingual/netlify.toml @@ -0,0 +1,8 @@ +[build] +publish = "public" +command = "hugo --gc --minify" + +[context.production.environment] +HUGO_VERSION = "0.92.0" +HUGO_ENV = "production" +HUGO_ENABLEGITINFO = "true" \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..f3d87a2 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/Mitrichius/hugo-theme-anubis + +go 1.18 diff --git a/i18n/de.yaml b/i18n/de.yaml index 3c5bb6a..b06b956 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -42,3 +42,6 @@ darkTheme: lightTheme: other: "Helles Theme" + +readNext: + other: "Weiter lesen" \ No newline at end of file diff --git a/i18n/en.yaml b/i18n/en.yaml index a397d85..45e7d3f 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -1,11 +1,11 @@ powered: - other: "powered by" + other: "Powered by" theme: other: "theme" readMore: - other: "read more" + other: "Read more" toNewPosts: other: "to new posts" @@ -35,10 +35,13 @@ toAllCategories: other: "to all categories" skipToContent: - other: "skip to main content" + other: "Skip to main content" darkTheme: - other: "dark theme" + other: "Dark theme" lightTheme: - other: "light theme" + other: "Light theme" + +readNext: + other: "Read next" diff --git a/i18n/fr.yaml b/i18n/fr.yaml index 5492c81..3070df6 100644 --- a/i18n/fr.yaml +++ b/i18n/fr.yaml @@ -1,11 +1,11 @@ powered: - other: "propulsé par" + other: "Propulsé par" theme: other: "thème" readMore: - other: "lire la suite" + other: "Lire la suite" toNewPosts: other: "articles + récents" @@ -35,10 +35,13 @@ toAllCategories: other: "vers toutes les catégories" skipToContent: - other: "aller au contenu" + other: "Aller au contenu" darkTheme: - other: "thème sombre" + other: "Thème sombre" lightTheme: - other: "thème clair" + other: "Thème clair" + +readNext: + other: "Lire la suite" \ No newline at end of file diff --git a/i18n/pl.yaml b/i18n/pl.yaml index 5233c63..cce611e 100644 --- a/i18n/pl.yaml +++ b/i18n/pl.yaml @@ -1,14 +1,14 @@ powered: - other: "zasilany przez" + other: "Zasilany przez" theme: other: "motyw" readMore: - other: "czytaj dalej" + other: "Czytaj dalej" toNewPosts: - other: "poprzedia strona" + other: "poprzednia strona" toOldPosts: other: "następna strona" @@ -35,10 +35,13 @@ toAllCategories: other: "wszystkie kategorie" skipToContent: - other: "przejdź do głównej zawartości" + other: "Przejdź do głównej zawartości" darkTheme: - other: "ciemny schemat" + other: "Ciemny schemat" lightTheme: - other: "lekki schemat" + other: "Jasny schemat" + +readNext: + other: "Czytaj dalej" \ No newline at end of file diff --git a/i18n/pt.yaml b/i18n/pt.yaml new file mode 100644 index 0000000..1a4b702 --- /dev/null +++ b/i18n/pt.yaml @@ -0,0 +1,47 @@ +powered: + other: "Criado com" + +theme: + other: "tema" + +readMore: + other: "Ler mais" + +toNewPosts: + other: "novos posts" + +toOldPosts: + other: "posts anteriores" + +tag: + other: "tag" + +Tags: + other: "Tags" + +Posts: + other: "Posts" + +category: + other: "categoria" + +Categories: + other: "Categorias" + +toAllTags: + other: "ver todas as tags" + +toAllCategories: + other: "ver todas as categorias" + +skipToContent: + other: "Pular para o conteúdo principal" + +darkTheme: + other: "Tema Escuro" + +lightTheme: + other: "Tema Claro" + +readNext: + other: "Leia a seguir" \ No newline at end of file diff --git a/i18n/ru.yaml b/i18n/ru.yaml index 12e9ed7..b9688fa 100644 --- a/i18n/ru.yaml +++ b/i18n/ru.yaml @@ -1,11 +1,11 @@ powered: - other: "движок" + other: "Движок" theme: other: "тема" readMore: - other: "читать дальше" + other: "Читать дальше" toNewPosts: other: "к новым записям" @@ -35,10 +35,13 @@ toAllCategories: other: "ко списку всех категорий" skipToContent: - other: "перейти к основному контенту" + other: "Перейти к основному контенту" darkTheme: - other: "тёмная тема" + other: "Тёмная тема" lightTheme: - other: "светлая тема" + other: "Светлая тема" + +readNext: + other: "Читать далее" diff --git a/i18n/tw.yaml b/i18n/tw.yaml index 5d55d6c..05885c9 100644 --- a/i18n/tw.yaml +++ b/i18n/tw.yaml @@ -42,3 +42,6 @@ darkTheme: lightTheme: other: "亮色主題" + +readNext: + other: "閱讀下一篇" \ No newline at end of file diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index befc53e..858f820 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -41,4 +41,7 @@ darkTheme: other: "暗色主题" lightTheme: - other: "亮色主题" \ No newline at end of file + other: "亮色主题" + +readNext: + other: "继续阅读" diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..4ad6603 --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,8 @@ +{{ define "main"}} +
+
+

Go Home

+ Sorry, this Page is not available. +
+
+{{ end }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..d1af727 --- /dev/null +++ b/layouts/_default/_markup/render-heading.html @@ -0,0 +1,7 @@ +{{ .Text | safeHTML }} + + + + + + \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 97bfae4..a0ea13d 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -10,7 +10,7 @@ {{ end }} - {{ i18n "skipToContent" | humanize }} + {{ i18n "skipToContent" }}
{{ block "header" . }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 02500a2..2f6d7c4 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -5,11 +5,11 @@

{{ i18n .Title }}

- {{ $pages := where .Pages "Type" "in" site.Params.mainSections }} + {{ $pages := where (where .Pages "Type" "in" site.Params.mainSections) "Params.hidden" "!=" true}} {{ range $pages }}
-
+

{{ trim .Title " " }}

{{ partial "post-language-switcher.html" . }}
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index cb728d9..cc620f4 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,6 +1,6 @@ {{- $pctx := . -}} {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} -{{- $pages := where $pctx.RegularPages ".Params.disable_feed" "!=" true -}} +{{- $pages := where (where $pctx.RegularPages ".Params.disable_feed" "!=" true) "Params.hidden" "!=" true -}} {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 72cc1de..88917da 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,7 +2,7 @@ {{ if .Menus }} {{ end }} @@ -21,20 +21,23 @@ {{ partial "post-info.html" . }} + {{ if gt .Site.Params.readNextPosts 0 }} + {{ $related := .Site.RegularPages.Related . | first .Site.Params.readNextPosts }} + {{ with $related }} + + + {{ end }} + {{ end }} + {{ if and (.Site.Params.paginationSinglePost) (ne .Type "page") }} {{ partial "post-pagination.html" . }} {{ end }} - {{ if .Site.DisqusShortname }} - {{ partial "disqus.html" . }} + {{ if not .Params.disableComments }} + {{ partial "comments.html" . }} {{ end }} - - {{ if .Site.Params.UtterancesRepo }} - {{ partial "utterances.html" . }} - {{ end }} - - {{ if .Site.Params.isso.enabled }} - {{ partial "isso.html" . }} - {{ end }} - {{ end }} diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index c31cfb9..9c04382 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -3,7 +3,8 @@ - {{ range .Paginator.Pages }} + {{ $pages := where .Pages "Params.hidden" "!=" true }} + {{ range (.Paginate $pages).Pages }} {{ partial "post-summary.html" . }} {{ end }} {{ partial "pagination.html" . }} diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index d4e745e..60e624a 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -4,15 +4,15 @@

{{ i18n .Title }}

-
    - {{ range $key, $value := .Data.Terms }} -
  • - - {{ $key }} - - ({{ len $value }}) -
  • + {{ range .Data.Terms }} + {{ $postsNum := len (where .Pages "Params.hidden" "!=" true) }} + {{ if gt $postsNum 0 }} +
  • + {{ .Page.Title }} + ({{ $postsNum }}) +
  • + {{ end}} {{ end }}
diff --git a/layouts/index.html b/layouts/index.html index ed4e128..44f2764 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -4,7 +4,7 @@
- {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} + {{ $pages := where (where site.RegularPages "Type" "in" site.Params.mainSections) "Params.hidden" "!=" true }} {{ range (.Paginate $pages).Pages }} {{ partial "post-summary.html" . }} {{ end }} diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html new file mode 100644 index 0000000..079e0f9 --- /dev/null +++ b/layouts/partials/comments.html @@ -0,0 +1,15 @@ +{{ if .Site.DisqusShortname }} + {{ partial "disqus.html" . }} +{{ end }} + +{{ if .Site.Params.UtterancesRepo }} + {{ partial "utterances.html" . }} +{{ end }} + +{{ if .Site.Params.isso.enabled }} + {{ partial "isso.html" . }} +{{ end }} + +{{ if .Site.Params.graphcommentId }} + {{ partial "graphcomment.html" . }} +{{ end }} diff --git a/layouts/partials/fa-icons/rss.svg b/layouts/partials/fa-icons/rss.svg new file mode 100644 index 0000000..606aa89 --- /dev/null +++ b/layouts/partials/fa-icons/rss.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index fe1ba38..46dea49 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -15,7 +15,7 @@ {{ end }} diff --git a/layouts/partials/graphcomment.html b/layouts/partials/graphcomment.html new file mode 100644 index 0000000..41960a7 --- /dev/null +++ b/layouts/partials/graphcomment.html @@ -0,0 +1,32 @@ +
+ diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 6fd87a9..ea98f1a 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -7,13 +7,42 @@ {{ partial "title.html" . }} +{{ with .Keywords }} + +{{ end }} + +{{ if and (.IsPage) (eq .Params.hidden true)}} + +{{ end }} + {{ with .OutputFormats.Get "rss" -}} {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} {{ partial "favicons.html" . }} + + + + + {{ partial "resource.html" (dict "context" . "type" "css" "filename" "css/main.css") }} +{{ if .Site.Params.copyCodeButton | default true }} + {{ partial "resource.html" (dict "context" . "type" "js" "filename" "js/copy-code.js") }} +{{ end }} + {{ range .Site.Params.customJS -}} {{ partial "resource.html" (dict "context" $ "type" "js" "filename" . ) }} {{- end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 99b7adc..e808edf 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,7 +1,5 @@
-

- {{ .Site.Title }} -

+ {{ partial "site-title.html" . }} {{ partial "social.html" . }}
{{ if .Site.Menus.main }} diff --git a/layouts/partials/post-info.html b/layouts/partials/post-info.html index dc88e35..edfc6a3 100644 --- a/layouts/partials/post-info.html +++ b/layouts/partials/post-info.html @@ -15,15 +15,17 @@
{{ if .Params.categories }} {{ end }} {{ if .Params.tags }} {{ end }} diff --git a/layouts/partials/post-summary.html b/layouts/partials/post-summary.html index 618c280..06dc4a9 100644 --- a/layouts/partials/post-summary.html +++ b/layouts/partials/post-summary.html @@ -13,7 +13,7 @@ {{ end }} {{ if and (.Truncated) (.Site.Params.readMore) }} {{ end }} diff --git a/layouts/partials/site-title.html b/layouts/partials/site-title.html new file mode 100644 index 0000000..086008f --- /dev/null +++ b/layouts/partials/site-title.html @@ -0,0 +1,3 @@ +

+ {{ .Site.Title }} +

\ No newline at end of file diff --git a/layouts/partials/social.html b/layouts/partials/social.html index 10e266e..e358068 100644 --- a/layouts/partials/social.html +++ b/layouts/partials/social.html @@ -23,4 +23,15 @@ {{ end }} {{ end }} - + +{{ if .Site.Params.rssAsSocialIcon }} + {{ with .Site.Home.OutputFormats.Get "rss" -}} +
  • + + {{ partial "font-awesome.html" (dict "iconName" "rss" "custom" false) }} + +
  • + {{ end -}} +{{ end }} + + \ No newline at end of file diff --git a/layouts/partials/theme-switcher.html b/layouts/partials/theme-switcher.html index 5e8de97..ab97e84 100644 --- a/layouts/partials/theme-switcher.html +++ b/layouts/partials/theme-switcher.html @@ -5,69 +5,81 @@ {{ if not (in (slice "light-without-switcher" "dark-without-switcher" "auto-without-switcher") $style) }} +{{ end }} - -{{ end }} \ No newline at end of file + changeButtonText() +} + +function showContent() { + document.body.style.visibility = 'visible'; + document.body.style.opacity = 1; +} + \ No newline at end of file diff --git a/netlify.toml b/netlify.toml index e52bdcb..b41ac36 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ publish = "exampleSiteMultilingual/public" command = "cd exampleSiteMultilingual && hugo --themesDir=../.. --baseURL $URL" [build.environment] -HUGO_VERSION = "0.91.0" +HUGO_VERSION = "0.92.0" HUGO_THEME = "repo" [context.deploy-preview] @@ -12,4 +12,4 @@ command = "cd exampleSiteMultilingual && hugo --themesDir=../.. --buildFuture - [[headers]] for = "/*" [headers.values] - Access-Control-Allow-Origin = "*" \ No newline at end of file + Access-Control-Allow-Origin = "*"