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.

269 lines
9.7 KiB

4 years ago
  1. # Terminal
  2. ![Terminal](https://github.com/panr/hugo-theme-terminal/blob/master/images/screenshot.png?raw=true)
  3. ### DEMO - https://hugo-terminal.now.sh/
  4. <a href="https://www.buymeacoffee.com/panr" target="_blank"><img src="https://res.cloudinary.com/panr/image/upload/v1579374705/buymeacoffee_y6yvov.svg" alt="Buy Me A Coffee" ></a>
  5. ---
  6. - [Features](#features)
  7. - [Built-in shortcodes](#built-in-shortcodes)
  8. - [Code highlighting](#code-highlighting)
  9. - [How to start](#how-to-start)
  10. - [How to run your site](#how-to-run-your-site)
  11. - [How to configure](#how-to-configure)
  12. - [Post archetype](#post-archetype)
  13. - [Add-ons](#add-ons)
  14. - [How to (safely) edit the theme](#how-to-edit)
  15. - [Found a bug?](#bug)
  16. - [New cool idea or feature](#feature)
  17. - [Terminal theme user?](#terminal-theme-user)
  18. - [Sponsoring](#sponsoring)
  19. - [Licence](#licence)
  20. ## Features
  21. - **5 duotone themes**, depending on your preferences (orange is default, red, blue, green, pink)
  22. - [**Fira Code**](https://github.com/tonsky/FiraCode) as default monospaced font. It's gorgeous!
  23. - **really nice duotone**, custom syntax highlighting based on [**PrismJS**](https://prismjs.com)
  24. - fully responsive
  25. #### Built-in shortcodes
  26. - **`image`** (prop required: **`src`**; props optional: **`alt`**, **`position`** (**left** is default | center | right), **`style`**)
  27. - eg: `{{< image src="/img/hello.png" alt="Hello Friend" position="center" style="border-radius: 8px;" >}}`
  28. - **`figure`** (same as `image`, plus few optional props: **`caption`**, **`captionPosition`** (left | **center** is default | right), **`captionStyle`**)
  29. - eg: `{{< figure src="/img/hello.png" alt="Hello Friend" position="center" style="border-radius: 8px;" caption="Hello Friend!" captionPosition="right" captionStyle="color: red;" >}}`
  30. - **`code`** (prop required: **`language`**; props optional: **`title`**, **`id`**, **`expand`** (default "△"), **`collapse`** (default "▽"), **`isCollapsed`**)
  31. - eg:
  32. ```go
  33. {{< code language="css" title="Really cool snippet" id="1" expand="Show" collapse="Hide" isCollapsed="true" >}}
  34. pre {
  35. background: #1a1a1d;
  36. padding: 20px;
  37. border-radius: 8px;
  38. font-size: 1rem;
  39. overflow: auto;
  40. @media (--phone) {
  41. white-space: pre-wrap;
  42. word-wrap: break-word;
  43. }
  44. code {
  45. background: none !important;
  46. color: #ccc;
  47. padding: 0;
  48. font-size: inherit;
  49. }
  50. }
  51. {{< /code >}}
  52. ```
  53. #### Code highlighting
  54. A custom syntax highlighting based on PrismJS. All you need to do is to wrap you code like this:
  55. ````
  56. ```html
  57. // your code here
  58. ```
  59. ````
  60. **Supported languages**: bash/shell, css, clike, javascript, apacheconf, actionscript, applescript, c, csharp, cpp, coffeescript, ruby, csp, css-extras, diff, django, docker, elixir, elm, markup-templating, erlang, fsharp, flow, git, go, graphql, less, handlebars, haskell, http, java, json, kotlin, latex, markdown, makefile, objectivec, ocaml, perl, php, php-extras, r, sql, processing, scss, python, jsx, typescript, toml, reason, textile, rust, sass, stylus, scheme, pug, swift, yaml, haml, twig, tsx, vim, visual-basic, wasm.
  61. ## How to start
  62. You can download the theme manually by going to [https://github.com/panr/hugo-theme-terminal.git](https://github.com/panr/hugo-theme-terminal.git) and pasting it to `themes/terminal` in your root directory.
  63. You can also clone it directly to your Hugo folder:
  64. ```
  65. $ git clone https://github.com/panr/hugo-theme-terminal.git themes/terminal
  66. ```
  67. If you don't want to make any radical changes, it's the best option, because you can get new updates when they are available. You can also include it as a git submodule:
  68. ```
  69. $ git submodule add https://github.com/panr/hugo-theme-terminal.git themes/terminal
  70. ```
  71. ⚠️ **The theme needs at least Hugo version 0.74.x**.
  72. ## How to run your site
  73. If you installed all needed `npm` dependencies, then you can run:
  74. ```
  75. $ hugo server -t terminal
  76. ```
  77. and go to `localhost:1313` in your browser. From now on all the changes you make will go live, so you don't need to refresh your browser every single time.
  78. ## How to configure
  79. The theme doesn't require any advanced configuration. Just copy:
  80. ```toml
  81. baseurl = "/"
  82. languageCode = "en-us"
  83. theme = "terminal"
  84. paginate = 5
  85. [params]
  86. # dir name of your main content (default is `content/posts`).
  87. # the list of set content will show up on your index page (baseurl).
  88. contentTypeName = "posts"
  89. # ["orange", "blue", "red", "green", "pink"]
  90. themeColor = "orange"
  91. # if you set this to 0, only submenu trigger will be visible
  92. showMenuItems = 2
  93. # show selector to switch language
  94. showLanguageSelector = false
  95. # set theme to full screen width
  96. fullWidthTheme = false
  97. # center theme with default width
  98. centerTheme = false
  99. # set a custom favicon (default is a `themeColor` square)
  100. # favicon = "favicon.ico"
  101. # set post to show the last updated
  102. # If you use git, you can set `enableGitInfo` to `true` and then post will automatically get the last updated
  103. showLastUpdated = false
  104. # Provide a string as a prefix for the last update date. By default, it looks like this: 2020-xx-xx [Updated: 2020-xx-xx] :: Author
  105. # updatedDatePrefix = "Updated"
  106. # set all headings to their default size (depending on browser settings)
  107. # it's set to `true` by default
  108. # oneHeadingSize = false
  109. [params.twitter]
  110. # set Twitter handles for Twitter cards
  111. # see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution
  112. # do not include @
  113. creator = ""
  114. site = ""
  115. [languages]
  116. [languages.en]
  117. languageName = "English"
  118. title = "Terminal"
  119. subtitle = "A simple, retro theme for Hugo"
  120. owner = ""
  121. keywords = ""
  122. copyright = ""
  123. menuMore = "Show more"
  124. readMore = "Read more"
  125. readOtherPosts = "Read other posts"
  126. newerPosts = "Newer posts"
  127. olderPosts = "Older posts"
  128. missingContentMessage = "Page not found..."
  129. missingBackButtonLabel = "Back to home page"
  130. [languages.en.params.logo]
  131. logoText = "Terminal"
  132. logoHomeLink = "/"
  133. [languages.en.menu]
  134. [[languages.en.menu.main]]
  135. identifier = "about"
  136. name = "About"
  137. url = "/about"
  138. [[languages.en.menu.main]]
  139. identifier = "showcase"
  140. name = "Showcase"
  141. url = "/showcase"
  142. ```
  143. to `config.toml` file in your Hugo root directory and change params fields. In case you need, here's [a YAML version](https://gist.github.com/panr/9eeea6f595c257febdadc11763e3a6d1).
  144. **NOTE:** Please keep in mind that currently `main menu` doesn't support nesting.
  145. ## Post archetype
  146. See the basic `post` file params supported by the theme — https://github.com/panr/hugo-theme-terminal/blob/master/archetypes/posts.md
  147. ## Add-ons
  148. - **Comments** — for adding comments to your blog posts please take a look at `layouts/partials/comments.html` https://github.com/panr/hugo-theme-terminal/blob/master/layouts/partials/comments.html.
  149. - **Extended Head** — please take a look at `layouts/partials/extended_head.html` https://github.com/panr/hugo-theme-terminal/blob/master/layouts/partials/extended_head.html
  150. - **Extended Footer** — please take a look at `layouts/partials/extended_footer.html` https://github.com/panr/hugo-theme-terminal/blob/master/layouts/partials/extended_footer.html
  151. ## How to (safely) edit the theme <a id="how-to-edit" />
  152. If you have to override only some of the styles, you can do this easily by adding `static/style.css` in your root directory and point things you want to change.
  153. To change something directly in the theme, you have to go to `themes/terminal` and modify the files.
  154. First, you need to install Node dependencies. To do so, go to the theme directory (from your Hugo root directory):
  155. ```bash
  156. $ cd themes/terminal
  157. ```
  158. then run:
  159. ```bash
  160. $ npm install
  161. $ npm i yarn
  162. $ yarn
  163. ```
  164. After you modified the files you can run webpack in watch mode:
  165. ```bash
  166. $ yarn dev
  167. ```
  168. or rebuild theme
  169. ```bash
  170. $ yarn build
  171. ```
  172. To see the changes (remember to restart `hugo server`).
  173. ## Found a bug? <a id="bug" />
  174. If you spot any bugs, please use [Issue Tracker](https://github.com/panr/hugo-theme-terminal/issues) or create a new [Pull Request](https://github.com/panr/hugo-theme-terminal/pulls) to fix the issue.
  175. ## New cool idea or feature? <a id="feature" />
  176. The theme is in constant development since 2019 and has got many cool features that helped many of you and made the theme better. But there were also many features that I wasn't sure about because I want to keep the theme as simple as possible.
  177. So, let's say you have an idea of how to extend the theme. That's cool and you're welcome to do that, just follow these steps:
  178. - fork the theme
  179. - implement the feature
  180. - write an instruction how to use the feature
  181. - give a working example of the implementation for other users
  182. - add info about your work to `COMMUNITY-FEATURES.md`
  183. - make a PR with edited `COMMUNITY-FEATURES.md`
  184. This will help keeping the theme close to its roots, and also allow anyone who wishes to improve it and match their needs, to do whatever they want.
  185. Sounds OK? Cool, let's rock! 🤘
  186. ## Terminal theme user?
  187. I'd be happy to know more about you and what you are doing. If you want to share it, please make a contribution and [add your site to the list](https://github.com/panr/hugo-theme-terminal/blob/master/USERS.md)! 🤗
  188. ## Sponsoring
  189. If you like my work and want to support the development of the project, now you can! Just:
  190. <a href="https://www.buymeacoffee.com/panr" target="_blank"><img src="https://res.cloudinary.com/panr/image/upload/v1579374705/buymeacoffee_y6yvov.svg" alt="Buy Me A Coffee" ></a>
  191. ## License
  192. Copyright © 2019-2020 Radosław Kozieł ([@panr](https://twitter.com/panr))
  193. The theme is released under the MIT License. Check the [original theme license](https://github.com/panr/hugo-theme-terminal/blob/master/LICENSE.md) for additional licensing information.