You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 7.2KB

7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. # Ananke, A theme for [Hugo](http://gohugo.io/), a framework for building websites.
  2. 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.
  3. ![screenshot](https://raw.githubusercontent.com/budparr/gohugo-theme-ananke/master/images/screenshot.png)
  4. [DEMO](https://gohugo-ananke-theme-demo.netlify.com/)
  5. Features
  6. - Responsive
  7. - Accessible
  8. - Contact form
  9. - Custom Robots.txt (changes values based on environment)
  10. - Internal templates for meta data, google analytics, and DISQUS or COMMENTO comments
  11. - RSS Discovery
  12. - Table of Contents (must declare `toc: true` in post parameter)
  13. - Stackbit configuration ([Stackbit](https://www.stackbit.com))
  14. Also includes examples of Hugo Features or Functions:
  15. - Pagination (internal template)
  16. - Taxonomies
  17. - Archetypes
  18. - Custom shortcode
  19. - Related content
  20. - Hugo built-in menu
  21. - i18n
  22. - `with`
  23. - `HUGO_ENV`
  24. - `first`
  25. - `after`
  26. - `sort`
  27. - Site LanguageCode
  28. - `where`
  29. - Content Views
  30. - Partials
  31. - Template layouts (type "post" uses a special list template, single template, and a content view)
  32. - Tags
  33. - `len`
  34. - Conditionals
  35. - `ge` (greater than or equal to)
  36. - `.Site.Params.mainSections` to avoid hard-coding "blog," etc. [[release note](https://github.com/spf13/hugo/blob/66ec6305f6cb450ddf9c489854146bac02f7dca1/docs/content/meta/release-notes.md#enhancements)]
  37. 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](http://tachyons.io/).
  38. ## Installation
  39. ### As a Hugo Module (recommended)
  40. Simply add the repo to your theme option:
  41. ```yaml
  42. theme:
  43. - github.com/theNewDynamic/gohugo-theme-ananke
  44. ```
  45. ### As Git Submodule
  46. Inside the folder of your Hugo site run:
  47. ```
  48. $ git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
  49. ```
  50. For more information read the official [setup guide](//gohugo.io/overview/installing/) of Hugo.
  51. ## Getting started
  52. After installing the theme successfully it requires a just a few more steps to get your site running.
  53. ### The config file
  54. Take a look inside the [`exampleSite`](https://github.com/theNewDynamic/gohugo-theme-ananke/tree/master/exampleSite) folder of this theme. You'll find a file called [`config.toml`](https://github.com/theNewDynamic/gohugo-theme-ananke/blob/master/exampleSite/config.toml). To use it, copy the [`config.toml`](https://github.com/theNewDynamic/gohugo-theme-ananke/blob/master/exampleSite/config.toml) in the root folder of your Hugo site. Feel free to change the strings in this theme.
  55. You may need to delete the line: `themesDir = "../.."`
  56. ### Add comments
  57. To enable comments, add following to your config file:
  58. - DISQUS: `disqusShortname = YOURSHORTNAME`
  59. - COMMENTO:
  60. ```
  61. [params]
  62. commentoEnable = true
  63. ```
  64. ### Change the hero background
  65. 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'`
  66. 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.
  67. 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](http://tachyons.io/docs/themes/skins/) library site, and preface it with "bg-"
  68. example: `background_color_class = "bg-blue"` or `background_color_class = "bg-gray"`
  69. ### Activate the contact form
  70. 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](//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:
  71. ```
  72. {{< form-contact action="https://formspree.io/your@email.com" >}}
  73. ```
  74. ### Update font or body classes
  75. 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:
  76. ```
  77. [params]
  78. body_classes = "avenir bg-near-white"
  79. ```
  80. which will give you a body class like this:
  81. ```
  82. <body class="avenir bg-near-white">
  83. ```
  84. 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.
  85. You can find a list of available typefaces [here](https://github.com/tachyons-css/tachyons/blob/v4.7.0/src/_font-family.css).
  86. And a list of background colors [here](https://github.com/tachyons-css/tachyons/blob/v4.7.0/src/_skins.css#L96).
  87. _n.b. in future versions we will likely separate the typeface and other body classes._
  88. ### Custom CSS
  89. 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.
  90. For example, if your css files are `static/css/custom.css` and `static/css/custom2.css` then add the following to the config file:
  91. ```
  92. [params]
  93. custom_css = ["css/custom.css","css/custom2.css"]
  94. ```
  95. ### Show Reading Time and Word Count
  96. 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.
  97. ### Adding Scripts to the Page Head
  98. 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.
  99. ### Logo
  100. 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:
  101. ```
  102. [params]
  103. site_logo = "img/logo.svg"
  104. ```
  105. ### Nearly finished
  106. In order to see your site in action, run Hugo's built-in local server.
  107. `$ hugo server`
  108. Now enter [`localhost:1313`](http://localhost:1313/) in the address bar of your browser.
  109. ## Production
  110. To run in production (e.g. to have Google Analytics show up), run `HUGO_ENV=production` before your build command. For example:
  111. ```
  112. HUGO_ENV=production hugo
  113. ```
  114. Note: The above command will not work on Windows. If you are running a Windows OS, use the below command:
  115. ```
  116. set HUGO_ENV=production
  117. hugo
  118. ```
  119. ## Contributing
  120. If you find a bug or have an idea for a feature, feel free to use the [issue tracker](https://github.com/theNewDynamic/gohugo-theme-ananke/issues) to let me know.
  121. TODO:
  122. - fix hard-coded link to [section](https://github.com/theNewDynamic/gohugo-theme-ananke/blob/master/layouts/index.html#L32)