diff --git a/README.md b/README.md index 9fdab81..1849278 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ An accessibility-friendly Hugo theme, ported from the [original Cupper](https:// - [Shortcodes](#shortcodes) - [Syntax highlighting](#syntax-highlighting) - [Disable toc for a blog post](#disable-toc-for-a-blog-post) +- [Localization](#localization) +- [Custom css](#custom-css) - [Getting help](#getting-help) - [Credits](#credits) @@ -84,6 +86,18 @@ toc: false --- ``` +## Localization + +The strings in the templates of this theme can be localized. Make a copy of /i18n/en.yaml to /i18n/.yaml, and translate one by one, changing the 'translation' field. + +[Here is a tutorial that goes more in depth about this.](https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-2-i18n-string-localization/) + +## Custom css + +Instead of coppying the theme's css file to your own installation and modifiying this large file, you can provide a list of css files that will be loaded after the theme's one. This ennables you to override individual style while getting theme updates when they come. + +Please see the params section of the example site config.yaml for more details. + ## Getting help If you run into an issue that isn't answered by this documentation or the [`exampleSite`](https://github.com/zwbetz-gh/cupper-hugo-theme/tree/master/exampleSite), then visit the [Hugo forum](https://discourse.gohugo.io/). The folks there are helpful and friendly. **Before** asking your question, be sure to read the [requesting help guidelines](https://discourse.gohugo.io/t/requesting-help/9132). diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 52153a2..ae46486 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -24,6 +24,14 @@ params: dateFormat: Jan 2, 2006 codePenUser: someUser katex: true + # A list of custom css files can be provided, which must be placed inside + # 'static/'. + # This is useful to override just specific css classes, instead of copying + # the entire theme's css file to your own site. + # Usage: + # customCss: + # - css/foo.css # relative path starting from static/ + #- css/bar.css menu: nav: diff --git a/i18n/en.yaml b/i18n/en.yaml new file mode 100644 index 0000000..65534af --- /dev/null +++ b/i18n/en.yaml @@ -0,0 +1,25 @@ +- id: skip_to_content + translation: skip to content +- id: nav_main_navigation + translation: Main navigation +- id: nav_button_menu + translation: Menu +- id: discuss_show_comments_button + translation: Show comments +- id: discuss_comments_disabled + translation: Disqus comments are disabled. +- id: discuss_js_disabled + translation: Enable JavaScript to view Disqus comments. +- id: dark_theme + translation: "dark theme:" +- id: table_of_contents + translation: Table of contents +- id: publish_date + translation: "Publish date:" +- id: last_updated + translation: "Last updated:" +- id: tags + translation: "Tags:" +- id: aria_label_tags + translation: tags + diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html index 47e0661..ccf0340 100644 --- a/layouts/partials/disqus.html +++ b/layouts/partials/disqus.html @@ -1,11 +1,11 @@
{{ with .Site.DisqusShortname }} - +
{{ $isDummyName := eq . "yourdiscussshortname" }} {{ $isServer := $.Site.IsServer }} {{ if or $isDummyName $isServer }} -

Disqus comments are disabled.

+

{{ T "discuss_comments_disabled" }}

{{ end }} - +
{{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 9d24b2a..9334920 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,7 +1,7 @@