mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

edit | blame | history | raw

Ananke, A theme for Hugo, a framework for building websites.

The intent of this theme is to provide a solid starting place for Hugo sites with basic features and include best practices for performance, accessibility, and rapid development.

screenshot

DEMO

Features

  • Responsive
  • Accessible
  • Contact form
  • Custom Robots.txt (changes values based on environment)
  • Internal templates for meta data, google analytics, and DISQUS or COMMENTO comments
  • RSS Discovery
  • Table of Contents (must declare toc: true in post parameter)
  • Stackbit configuration (Stackbit)

Also includes examples of Hugo Features or Functions:

  • Pagination (internal template)
  • Taxonomies
  • Archetypes
  • Custom shortcode
  • Related content
  • Hugo built-in menu
  • i18n
  • with
  • HUGO_ENV
  • first
  • after
  • sort
  • Site LanguageCode
  • where
  • Content Views
  • Partials
  • Template layouts (type "post" uses a special list template, single template, and a content view)
  • Tags
  • len
  • Conditionals
  • ge (greater than or equal to)
  • .Site.Params.mainSections to avoid hard-coding "blog," etc. [release note]

This theme uses the "Tachyons" CSS library. This will allow you to manipulate the design of the theme by changing class names in HTML without touching the original CSS files. For more information see the Tachyons website.

Installation

As a Hugo Module (recommanded)

Simply add the repo to your theme option:

theme:
  - github.com/theNewDynamic/gohugo-theme-ananke

As Git Submodule

Inside the folder of your Hugo site run:

$ git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke

For more information read the official setup guide of Hugo.

Getting started

After installing the theme successfully it requires a just a few more steps to get your site running.

The config file

Take a look inside the exampleSite folder of this theme. You'll find a file called config.toml. To use it, copy the config.toml in the root folder of your Hugo site. Feel free to change the strings in this theme.

You may need to delete the line: themesDir = "../.."

Add comments

To enable comments, add following to your config file:

  • DISQUS: disqusShortname = YOURSHORTNAME
  • COMMENTO:
    [params] commentoEnable = true

Change the hero background

For any page or post you can add a featured image by including the local path in front matter (see content in the exampleSite/content/_readme.md file for examples): featured_image: '/images/gohugo-default-sample-hero-image.jpg'

If you would like to hide the header text on the featured image on a page, set omit_header_text to true. See exampleSite/content/contact.md for an example.

You don't need an image though. The default background color is black, but you can change the color, by changing the default color class in the config.toml file. Choose a background color from any on the Tachyons library site, and preface it with "bg-"

example: background_color_class = "bg-blue" or background_color_class = "bg-gray"

Activate the contact form

This theme includes a shortcode for a contact form that you can add to any page (there is an example on the contact page in the exampleSite folder). One option is to use formspree.io as proxy to send the actual email. Each month, visitors can send you up to one thousand emails without incurring extra charges. Visit the Formspree site to get the "action" link and add it to your shortcode like this:

{{< form-contact action="https://formspree.io/your@email.com" >}}

Update font or body classes

The theme is set, by default, to use a near-white background color and the "Avenir" or serif typeface. You can change these in your config file with the body_classes parameter, like this:

[params]
  body_classes = "avenir bg-near-white"

which will give you a body class like this:

<body class="avenir bg-near-white">

note: The body_classes parameter will not change the font used in post content. To do this, you must use the post_content_classes parameter.

You can find a list of available typefaces here.

And a list of background colors here.

n.b. in future versions we will likely separate the typeface and other body classes.

Custom CSS

You can override the built-in css by using your own. Just put your own css files in the static directory of your website (the one in the theme directory also works but is not recommended) and modify the custom_css parameter in your config file. The path referenced in the parameter should be relative to the static folder. These css files will be added through the header partial after the built-in css file.

For example, if your css files are static/css/custom.css and static/css/custom2.css then add the following to the config file:

    [params]
      custom_css = ["css/custom.css","css/custom2.css"]

Show Reading Time and Word Count

If you add a key of show_reading_time true to either the Config Params, a page or section's front matter, articles will show the reading time and word count.

Adding Scripts to the Page Head

Some scripts need to be added within the page head. To add your own scripts to the page head, simply insert them into the head-additions.html partial located in the layouts/partials folder.

Logo

You can replace the title of your site in the top left corner of each page with your own logo. To do that put your own logo into the static directory of your website, and add the site_logo parameter to the site params in your config file. For example:

[params]
  site_logo = "img/logo.svg"

Nearly finished

In order to see your site in action, run Hugo's built-in local server.

$ hugo server

Now enter localhost:1313 in the address bar of your browser.

Production

To run in production (e.g. to have Google Analytics show up), run HUGO_ENV=production before your build command. For example:

HUGO_ENV=production hugo

Note: The above command will not work on Windows. If you are running a Windows OS, use the below command:

set HUGO_ENV=production
hugo

Contributing

If you find a bug or have an idea for a feature, feel free to use the issue tracker to let me know.

TODO:

edit | blame | history | raw

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog
and this project adheres to Semantic Versioning.

Generated by auto-changelog.

v2.6.1 - 2020-06-25

Commits

  • Updated minimum theme to .55 df4c78a

v2.6.0 - 2020-06-23

Merged

  • Update spanish translations #304
  • Add automatic cover image support #303

2.6.0 - 2020-06-17

Merged

  • Add translation for taxonomy page #299
  • Site logo #284
  • Add head partial #285
  • Long urls or links extend beyond content and overlap sidebar #259
  • Use relative URL for favicon #251
  • Fix relURL for custom_css #252
  • Fixed a typo in form-contact.html #266
  • adding Bulgarian translation #267
  • Use | relLangURL for the base url in the site-navigation #277
  • RSS svg icon #282
  • Updated Windows instructions in README.md #276
  • Replace another 2 .URL occurrences with .Permalink #275
  • Add alternative method for running prod to the readme #273
  • Swap the page title and site title in page <title> elements #272
  • Add the post_content_classes param for changing post content font #260
  • Add sharing links for the posts #255
  • Safari Reader View lacks content #254
  • Add Keybase social icon #248
  • Add StackOverflow social #243
  • Fix to take care of multiple author list, or for setting the #221
  • Fix Slack icon size #237
  • Correct the original translation #241

v2.5.6 - 2019-12-30

Merged

  • Use Hugo's built in Site Config for copyright according to PR #199 #240
  • Add italian translation #239

v2.5.5 - 2019-11-15

Merged

  • Remove stray grave accent #231
  • Add Slack to social options #236
  • Fix URL for menus #230
  • Fix word count heading typo in README.md #222
  • Add auto-changelog #228
  • Fix stackbit issues #226
  • Add Stackbit Configuration #223
  • Replace {{ .URL }} with {{ .Permalink }} #216
  • Adds an author to blog posts. #209
  • Fixes #212. #213
  • Add ukrainian translation #214
  • Add swedish translation #208
  • Deprecation messages fixes. #196
  • Fix README instructions #204
  • Use git submodules #183
  • Remove Google News meta tags #197

Fixed

  • Fix URL for menus (#230) #229
  • Add auto-changelog (#228) #227 #227
  • Fix stackbit issues (#226) #224
  • Add Stackbit Configuration (#223) #200
  • Fixes #212. (#213) #212
  • Deprecation messages fixes. (#196) #180

2.5.1 - 2019-08-12

Merged

  • remove deprecated meta tags for old Windows Mobile and BlackBerry #191
  • localization for form-contact shortcode #185
  • Fix min_version #189
  • Add portuguese translation #179
  • Add commento #178
  • feat: add RU translation #177
  • Spanish Translation #175
  • Dutch translations. #171
  • Correcting issue with cached i18n menu #174
  • Create zh.toml #170
  • Fix TOC header #168
  • Optimisation "partialCached" #165
  • Add a link to "mastodon" #159
  • Create fr.toml #157
  • add i18n translation support #156
  • Support hiding the featured image header text. #155
  • enable localization/modification of "Recent" string #154
  • add basic support for post translations #144
  • Keep article padding throughout widths #152
  • Improve semantic structure of pages #151
  • Improve social link accessibility #147
  • Add explicit path to image example #146
  • Open social media links in new tab and add Medium icon #143
  • Make cover dimming class customisable. #140
  • Removed hardcoded theme sample hero image. This will allow the user to "blank" out the hero default set in the config. The if statement for blank was unreachable. #133
  • Use relative url function for custom CSS files #132
  • Add Gitlab to social icons #131
  • Add div to wrap social icons #128
  • Fix asset paths when baseURL has sub-folder #103
  • Add inheritance for social links. #107
  • Issue 98 #101
  • Replace Asset References with a data file instead of paths #96
  • Pre-2.0 Enhancements #94
  • Don't duplicate site title in home page TITLE tag #78
  • Fix pagination #76
  • 68|Parmeterize number of recent posts in index.html #69

  • Fix typo in single.html #67
  • Fixed line breaks in code (resolves budparr/gohugo-theme-ananke#56). #57
  • Favicons #54
  • indent fix #45
  • Social icon updates #51
  • Add GitHub social icon #48
  • Make Hero image work out-of-the box #40
  • Removed excess o in Facebook #34
  • Fixes #31 #32
  • Bp/fix now function Fixes #29 #30
  • fix clunky construction on home page to get section name #25
  • fix clunky construction on home page to get section name #24
  • fix clunky construction on home page to get section name #17
  • tweak hero default behavior #16
  • improve terms template #15
  • improve image handling for edge cases Fixes #11 #14
  • Improve featured image handling Ref #11 + minor homepage impvs #12
  • Dev changes #10
  • pull in dev changes #9
  • keeping things in order #8
  • Improve home page posts #7
  • make form email comment make more sense. Ref #5 #6
  • use a cleaner way to include language code #3
  • update from DEV #2
  • add taxonomy templates #1

Fixed

  • Add blockquote styling #169
  • Keep article padding throughout widths (#152) #130
  • Update readme for formspree change #150
  • Improve semantic structure of pages (#151) #149
  • Add global background color class to footer #135
  • Add div to wrap social icons (#128) #127
  • Fix article padding on mobile #115
  • Make asset paths absolute #97
  • Fix linkedin icon to match the other social icons #70
  • Be smarter about linking to posts on home page. #50
  • Add body_classes parameter to body #43
  • Fixes #31 (#32) #31
  • Bp/fix now function Fixes #29 (#30) #29
  • Merge pull request #14 from budparr/dev #11
  • improve image handling for edge cases Fixes #11 #11
edit | blame | history | raw

The MIT License (MIT)

Copyright (c) 2016 Bud Parr

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

.github/ISSUE_TEMPLATE/bugs 1 KB
.github/changelog-old 14 KB
.github/pull_request_template 976 b
CHANGELOG 4 KB
LICENSE 1 KB
README 14 KB
archetypes/default 131 b
exampleSite/content/en/_index 446 b
exampleSite/content/en/about/index 922 b
exampleSite/content/en/contact 413 b
exampleSite/content/en/post/_index 226 b
exampleSite/content/en/post/chapter-1 5 KB
exampleSite/content/en/post/chapter-2 4 KB
exampleSite/content/en/post/chapter-3 6 KB
exampleSite/content/en/post/chapter-4 4 KB
exampleSite/content/en/post/chapter-5 4 KB
exampleSite/content/en/post/chapter-6 4 KB
exampleSite/content/fr/_index 330 b
exampleSite/content/fr/contact 452 b
exampleSite/content/fr/post/_index 95 b
exampleSite/content/fr/post/chapter-1 2 KB
layouts/robots 275 b