First commit
20
LICENSE
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Track3
|
||||
|
||||
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.
|
75
README.md
Normal file
|
@ -0,0 +1,75 @@
|
|||
# Hugo theme Hermit
|
||||
|
||||
Hermit is a minimal and fast theme for Hugo. It's built for bloggers who want a simple and focused website.
|
||||
|
||||
![](https://github.com/Track3/hermit/raw/master/images/screenshot.png)
|
||||
|
||||
## Features
|
||||
|
||||
* A single-column layout and carefully crafted typography offers a great reading experience.
|
||||
* Navigations and functions are placed in the bottom bar which will hide when you scroll down.
|
||||
* Featured image is supported. It will be displayed as a dimmed background of the page.
|
||||
* Displays all of your posts on a single page, with one section per year, simple and compact.
|
||||
* Extremely lightweight and load fast. No third party framework, no unnecessary code.
|
||||
* Responsive & Retina Ready. Scales gracefully from a big screen all the way down to the smallest mobile phone. Assets in vector format ensures that it looks sharp on high-resolution screens.
|
||||
|
||||
![](https://github.com/Track3/hermit/raw/master/images/hermit.png)
|
||||
|
||||
## Getting started
|
||||
|
||||
### Installation
|
||||
|
||||
Run this command from the root of your Hugo directory (Git needs to be installed):
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/Track3/hermit.git themes/hermit
|
||||
```
|
||||
|
||||
Alternatively, if you are not familiar with git, you can download the theme as a `.zip` file, unzip the theme contents, and then move the unzipped source into your `themes` directory.
|
||||
|
||||
For more information, read the official [documentation](https://gohugo.io/themes/installing-and-using-themes/) of Hugo.
|
||||
|
||||
### Configuration
|
||||
|
||||
The example config file can be found in the theme's `exampleSite` folder. You can just copy the `config.toml` to the root directory of your Hugo site. There are instructions in the example config file, feel free to change strings as you like to customize your website.
|
||||
|
||||
#### Favicon
|
||||
|
||||
Use [RealFaviconGenerator](https://realfavicongenerator.net/) to generate these files, put them into your site's `static` folder:
|
||||
|
||||
* android-chrome-192x192.png
|
||||
* android-chrome-512x512.png
|
||||
* apple-touch-icon.png
|
||||
* favicon-16x16.png
|
||||
* favicon-32x32.png
|
||||
* favicon.ico
|
||||
* mstile-150x150.png
|
||||
* safari-pinned-tab.svg
|
||||
* site.webmanifest
|
||||
|
||||
#### Social icons
|
||||
|
||||
The following icons are supported, please make sure the `name` filed is exactly one of these:
|
||||
|
||||
* codepen
|
||||
* facebook
|
||||
* github
|
||||
* instagram
|
||||
* linkedin
|
||||
* slack
|
||||
* twitter
|
||||
* youtube
|
||||
* email
|
||||
|
||||
### Manage content
|
||||
|
||||
* Keep your regular pages in the `content` folder. To create a new page, run `hugo new page-title.md`
|
||||
* Keep your blog posts in the `content/posts` folder. To create a new post, run `hugo new posts/post-title.md`
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
* [normalize.css](https://necolas.github.io/normalize.css/) - [MIT](https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
* [animate.css](https://daneden.github.io/animate.css/) - [MIT](https://github.com/daneden/animate.css/blob/master/LICENSE)
|
||||
* [feather](https://feathericons.com/) - [MIT](https://github.com/feathericons/feather/blob/master/LICENSE)
|
||||
|
||||
Thanks!
|
7
archetypes/default.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
draft: true
|
||||
comments: false
|
||||
---
|
||||
|
9
archetypes/posts.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
draft: true
|
||||
featuredImg: ""
|
||||
tags:
|
||||
- tag
|
||||
---
|
||||
|
78
assets/js/main.js
Normal file
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* Utils
|
||||
*/
|
||||
|
||||
// Throttle
|
||||
//
|
||||
const throttle = (callback, limit) => {
|
||||
let timeoutHandler = null;
|
||||
return () => {
|
||||
if (timeoutHandler == null) {
|
||||
timeoutHandler = setTimeout(() => {
|
||||
callback();
|
||||
timeoutHandler = null;
|
||||
}, limit);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Functions
|
||||
*/
|
||||
|
||||
// Auto Hide Header
|
||||
//
|
||||
let lastScrollPosition = window.pageYOffset;
|
||||
let header = document.getElementById('site-header');
|
||||
|
||||
const autoHideHeader = () => {
|
||||
let currentScrollPosition = window.pageYOffset;
|
||||
if (currentScrollPosition > lastScrollPosition) {
|
||||
header.classList.remove('slideInUp');
|
||||
header.classList.add('slideOutDown');
|
||||
} else {
|
||||
header.classList.remove('slideOutDown');
|
||||
header.classList.add('slideInUp');
|
||||
}
|
||||
lastScrollPosition = currentScrollPosition;
|
||||
}
|
||||
|
||||
// Mobile Menu Toggle
|
||||
//
|
||||
let mobileMenu = document.getElementById('mobile-menu');
|
||||
let mobileMenuVisible = false;
|
||||
|
||||
const mobileMenuToggle = () => {
|
||||
if (mobileMenuVisible == false) {
|
||||
mobileMenu.style.animationName = 'bounceInRight';
|
||||
mobileMenu.style.webkitAnimationName = 'bounceInRight';
|
||||
mobileMenu.style.display = 'block';
|
||||
mobileMenuVisible = true;
|
||||
} else {
|
||||
mobileMenu.style.animationName = 'bounceOutRight';
|
||||
mobileMenu.style.webkitAnimationName = 'bounceOutRight'
|
||||
mobileMenuVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Show Featured Image
|
||||
//
|
||||
const showFeaturedImg = () => {
|
||||
document.getElementById('bg-img').classList.add('show-bg-img');
|
||||
}
|
||||
|
||||
const showContent = () => {
|
||||
document.getElementById('bg-img').classList.remove('show-bg-img');
|
||||
}
|
||||
|
||||
if (haveHeader == true) {
|
||||
document.getElementById('menu-btn').addEventListener('click', mobileMenuToggle);
|
||||
|
||||
window.addEventListener('scroll', throttle(() => {
|
||||
autoHideHeader();
|
||||
|
||||
if (mobileMenuVisible == true) {
|
||||
mobileMenuToggle();
|
||||
}
|
||||
}, 250));
|
||||
}
|
11
assets/scss/_animate.scss
Normal file
341
assets/scss/_normalize.scss
Normal file
|
@ -0,0 +1,341 @@
|
|||
/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */
|
||||
|
||||
/* Document
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Correct the line height in all browsers.
|
||||
* 2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
line-height: 1.15; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/* Sections
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the margin in all browsers.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the font size and margin on `h1` elements within `section` and
|
||||
* `article` contexts in Chrome, Firefox, and Safari.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
/* Grouping content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in Firefox.
|
||||
* 2. Show the overflow in Edge and IE.
|
||||
*/
|
||||
|
||||
hr {
|
||||
box-sizing: content-box; /* 1 */
|
||||
height: 0; /* 1 */
|
||||
overflow: visible; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
pre {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/* Text-level semantics
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the gray background on active links in IE 10.
|
||||
*/
|
||||
|
||||
a {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Remove the bottom border in Chrome 57-
|
||||
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none; /* 1 */
|
||||
text-decoration: underline; /* 2 */
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font weight in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` elements from affecting the line height in
|
||||
* all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/* Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the border on images inside links in IE 10.
|
||||
*/
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
/* Forms
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Change the font styles in all browsers.
|
||||
* 2. Remove the margin in Firefox and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
line-height: 1.15; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the overflow in IE.
|
||||
* 1. Show the overflow in Edge.
|
||||
*/
|
||||
|
||||
button,
|
||||
input { /* 1 */
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
||||
* 1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the inability to style clickable types in iOS and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
[type="button"],
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner border and padding in Firefox.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the focus styles unset by the previous rule.
|
||||
*/
|
||||
|
||||
button:-moz-focusring,
|
||||
[type="button"]:-moz-focusring,
|
||||
[type="reset"]:-moz-focusring,
|
||||
[type="submit"]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the padding in Firefox.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
padding: 0.35em 0.75em 0.625em;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the text wrapping in Edge and IE.
|
||||
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
||||
* 3. Remove the padding so developers are not caught out when they zero out
|
||||
* `fieldset` elements in all browsers.
|
||||
*/
|
||||
|
||||
legend {
|
||||
box-sizing: border-box; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
display: table; /* 1 */
|
||||
max-width: 100%; /* 1 */
|
||||
padding: 0; /* 3 */
|
||||
white-space: normal; /* 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the default vertical scrollbar in IE 10+.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in IE 10.
|
||||
* 2. Remove the padding in IE 10.
|
||||
*/
|
||||
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the cursor style of increment and decrement buttons in Chrome.
|
||||
*/
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the odd appearance in Chrome and Safari.
|
||||
* 2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner padding in Chrome and Safari on macOS.
|
||||
*/
|
||||
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inability to style clickable types in iOS and Safari.
|
||||
* 2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/* Interactive
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Add the correct display in Edge, IE 10+, and Firefox.
|
||||
*/
|
||||
|
||||
details {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the correct display in all browsers.
|
||||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
/* Misc
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10+.
|
||||
*/
|
||||
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10.
|
||||
*/
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
32
assets/scss/_predefined.scss
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Colors
|
||||
//
|
||||
$theme: #018574;
|
||||
$text: #c6cddb;
|
||||
$light-grey: #494f5c;
|
||||
$dark-grey: #3B3E48;
|
||||
$highlight-grey: #7d828a;
|
||||
$midnightblue: #2c3e50;
|
||||
|
||||
// Fonts
|
||||
//
|
||||
$fonts: "Trebuchet MS", Verdana, "Verdana Ref", "Segoe UI", Candara, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
|
||||
$code-fonts: Consolas, "Andale Mono WT", "Andale Mono", Menlo, Monaco, "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, "YaHei Consolas Hybrid", monospace, "Segoe UI Emoji", "PingFang SC", "Microsoft YaHei";
|
||||
|
||||
// Mixins
|
||||
//
|
||||
@mixin dimmed {
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
@mixin aTag {
|
||||
a {
|
||||
word-break: break-all;
|
||||
border: none;
|
||||
box-shadow: inset 0 -4px 0 $theme;
|
||||
transition-property: background-color;
|
||||
|
||||
&:hover {
|
||||
background-color: $theme;
|
||||
}
|
||||
}
|
||||
}
|
59
assets/scss/_syntax.scss
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* Background */ .chroma { color: #eee; background-color: $midnightblue }
|
||||
/* Error */ .chroma .err { color: #960050; background-color: #1e0010 }
|
||||
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
|
||||
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
|
||||
/* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc }
|
||||
/* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; }
|
||||
/* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; }
|
||||
/* Keyword */ .chroma .k { color: #66d9ef }
|
||||
/* KeywordConstant */ .chroma .kc { color: #66d9ef }
|
||||
/* KeywordDeclaration */ .chroma .kd { color: #66d9ef }
|
||||
/* KeywordNamespace */ .chroma .kn { color: #f92672 }
|
||||
/* KeywordPseudo */ .chroma .kp { color: #66d9ef }
|
||||
/* KeywordReserved */ .chroma .kr { color: #66d9ef }
|
||||
/* KeywordType */ .chroma .kt { color: #66d9ef }
|
||||
/* NameAttribute */ .chroma .na { color: #a6e22e }
|
||||
/* NameClass */ .chroma .nc { color: #a6e22e }
|
||||
/* NameConstant */ .chroma .no { color: #66d9ef }
|
||||
/* NameDecorator */ .chroma .nd { color: #a6e22e }
|
||||
/* NameException */ .chroma .ne { color: #a6e22e }
|
||||
/* NameFunction */ .chroma .nf { color: #a6e22e }
|
||||
/* NameOther */ .chroma .nx { color: #a6e22e }
|
||||
/* NameTag */ .chroma .nt { color: #f92672 }
|
||||
/* Literal */ .chroma .l { color: #ae81ff }
|
||||
/* LiteralDate */ .chroma .ld { color: #e6db74 }
|
||||
/* LiteralString */ .chroma .s { color: #e6db74 }
|
||||
/* LiteralStringAffix */ .chroma .sa { color: #e6db74 }
|
||||
/* LiteralStringBacktick */ .chroma .sb { color: #e6db74 }
|
||||
/* LiteralStringChar */ .chroma .sc { color: #e6db74 }
|
||||
/* LiteralStringDelimiter */ .chroma .dl { color: #e6db74 }
|
||||
/* LiteralStringDoc */ .chroma .sd { color: #e6db74 }
|
||||
/* LiteralStringDouble */ .chroma .s2 { color: #e6db74 }
|
||||
/* LiteralStringEscape */ .chroma .se { color: #ae81ff }
|
||||
/* LiteralStringHeredoc */ .chroma .sh { color: #e6db74 }
|
||||
/* LiteralStringInterpol */ .chroma .si { color: #e6db74 }
|
||||
/* LiteralStringOther */ .chroma .sx { color: #e6db74 }
|
||||
/* LiteralStringRegex */ .chroma .sr { color: #e6db74 }
|
||||
/* LiteralStringSingle */ .chroma .s1 { color: #e6db74 }
|
||||
/* LiteralStringSymbol */ .chroma .ss { color: #e6db74 }
|
||||
/* LiteralNumber */ .chroma .m { color: #ae81ff }
|
||||
/* LiteralNumberBin */ .chroma .mb { color: #ae81ff }
|
||||
/* LiteralNumberFloat */ .chroma .mf { color: #ae81ff }
|
||||
/* LiteralNumberHex */ .chroma .mh { color: #ae81ff }
|
||||
/* LiteralNumberInteger */ .chroma .mi { color: #ae81ff }
|
||||
/* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff }
|
||||
/* LiteralNumberOct */ .chroma .mo { color: #ae81ff }
|
||||
/* Operator */ .chroma .o { color: #f92672 }
|
||||
/* OperatorWord */ .chroma .ow { color: #f92672 }
|
||||
/* Comment */ .chroma .c { color: #75715e }
|
||||
/* CommentHashbang */ .chroma .ch { color: #75715e }
|
||||
/* CommentMultiline */ .chroma .cm { color: #75715e }
|
||||
/* CommentSingle */ .chroma .c1 { color: #75715e }
|
||||
/* CommentSpecial */ .chroma .cs { color: #75715e }
|
||||
/* CommentPreproc */ .chroma .cp { color: #75715e }
|
||||
/* CommentPreprocFile */ .chroma .cpf { color: #75715e }
|
||||
/* GenericDeleted */ .chroma .gd { color: #f92672 }
|
||||
/* GenericEmph */ .chroma .ge { font-style: italic }
|
||||
/* GenericInserted */ .chroma .gi { color: #a6e22e }
|
||||
/* GenericStrong */ .chroma .gs { font-weight: bold }
|
||||
/* GenericSubheading */ .chroma .gu { color: #75715e }
|
671
assets/scss/style.scss
Normal file
|
@ -0,0 +1,671 @@
|
|||
@import "predefined.scss";
|
||||
@import "normalize.scss";
|
||||
@import "syntax.scss";
|
||||
@import "animate.scss";
|
||||
|
||||
/* Webkit Scrollbar Customize */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background: $midnightblue;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #888;
|
||||
|
||||
&:hover {
|
||||
background: $text;
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
background: $light-grey;
|
||||
line-height: 1.6;
|
||||
letter-spacing: .06em;
|
||||
}
|
||||
|
||||
body,
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
color: $text;
|
||||
font-family: $fonts;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
pre tt {
|
||||
font-family: $code-fonts;
|
||||
}
|
||||
|
||||
pre {
|
||||
max-height: 40em;
|
||||
padding: .7em 1.1em;
|
||||
overflow: auto;
|
||||
font-size: .9em;
|
||||
line-height: 1.5;
|
||||
letter-spacing: normal;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
color: #eee;
|
||||
background: $midnightblue;
|
||||
border-radius: 4px;
|
||||
// -webkit-overflow-scrolling: touch;
|
||||
|
||||
code {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: $midnightblue;
|
||||
}
|
||||
}
|
||||
|
||||
code {
|
||||
color: #eee;
|
||||
background: $highlight-grey;
|
||||
border-radius: 3px;
|
||||
padding: 0 3px;
|
||||
margin: 0 4px;
|
||||
word-break: break-all;
|
||||
letter-spacing: normal;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
border-left: .25em solid;
|
||||
margin: 1em;
|
||||
padding: 0 1em;
|
||||
font-style: italic;
|
||||
|
||||
cite {
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
|
||||
&::before {
|
||||
content: "—— ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: $text;
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
transition-property: color;
|
||||
transition-duration: .4s;
|
||||
transition-timing-function: ease-out;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
hr {
|
||||
opacity: .2;
|
||||
border-width: 0 0 5px 0;
|
||||
border-style: dashed;
|
||||
background: transparent;
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
empty-cells: show;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 1.5%;
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: 700;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
|
||||
.section-inner {
|
||||
margin: 0 auto;
|
||||
max-width: 1200px;
|
||||
width: 93%;
|
||||
}
|
||||
|
||||
.thin {
|
||||
max-width: 720px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.feather {
|
||||
display: inline-block;
|
||||
vertical-align: -.125em;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
// Accessibility
|
||||
//
|
||||
.screen-reader-text {
|
||||
border: 0;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
clip-path: inset(50%);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute !important;
|
||||
width: 1px;
|
||||
word-wrap: normal !important;
|
||||
}
|
||||
|
||||
.screen-reader-text:focus {
|
||||
background-color: #f1f1f1;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
|
||||
clip: auto !important;
|
||||
clip-path: none;
|
||||
color: #21759b;
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
font-size: 0.875rem;
|
||||
font-weight: bold;
|
||||
height: auto;
|
||||
left: 5px;
|
||||
line-height: normal;
|
||||
padding: 15px 23px 14px;
|
||||
text-decoration: none;
|
||||
top: 5px;
|
||||
width: auto;
|
||||
z-index: 100000;
|
||||
}
|
||||
|
||||
// Header & Footer
|
||||
//
|
||||
#site-header {
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
box-shadow: -1px -2px 3px rgba(0, 0, 0, 0.45);
|
||||
background-color: $dark-grey;
|
||||
}
|
||||
|
||||
.hdr-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: .5em 0;
|
||||
font-size: 1.2rem;
|
||||
|
||||
.site-branding {
|
||||
display: inline-block;
|
||||
margin-right: .8em;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.site-nav {
|
||||
display: inline-block;
|
||||
font-size: 1.1em;
|
||||
opacity: .8;
|
||||
|
||||
a {
|
||||
margin-left: .8em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hdr-icons {
|
||||
display: inline-block;
|
||||
font-size: 1.2em;
|
||||
|
||||
a {
|
||||
margin-left: .4em;
|
||||
}
|
||||
}
|
||||
|
||||
.hdr-btn {
|
||||
border: none;
|
||||
background: none;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#menu-btn,
|
||||
#search-btn {
|
||||
display: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#mobile-menu {
|
||||
position: fixed;
|
||||
bottom: 4.8em;
|
||||
right: 1.5em;
|
||||
padding: .6em 1.8em;
|
||||
z-index: 1;
|
||||
box-sizing: border-box;
|
||||
box-shadow: -1px -2px 3px 0px rgba(0, 0, 0, 0.45);
|
||||
background-color: $dark-grey;
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 2;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
}
|
||||
|
||||
#site-footer {
|
||||
text-align: center;
|
||||
font-size: .9em;
|
||||
margin-bottom: 96px;
|
||||
margin-top: 64px;
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Spotlight
|
||||
//
|
||||
#spotlight {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
max-width: 93%;
|
||||
margin: auto;
|
||||
font-size: 1.5rem;
|
||||
|
||||
&.error-404 {
|
||||
flex-direction: row;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
p.img-404 {
|
||||
margin: 0;
|
||||
|
||||
svg {
|
||||
width: 180px;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.banner-404 {
|
||||
margin-left: 2em;
|
||||
|
||||
h1 {
|
||||
font-size: 3em;
|
||||
margin: .5rem 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: .6em;
|
||||
}
|
||||
|
||||
.btn-404 {
|
||||
font-size: .8em;
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
border: 2px solid $text;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
transition-property: color, border-color;
|
||||
word-break: break-all;
|
||||
|
||||
&:first-child {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
svg {
|
||||
margin-right: .5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#home-center {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#home-title {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#home-subtitle {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.5em;
|
||||
text-align: center;
|
||||
line-height: normal;
|
||||
font-size: .7em;
|
||||
font-style: italic;
|
||||
opacity: .9;
|
||||
}
|
||||
|
||||
#home-social {
|
||||
font-size: 1.4em;
|
||||
text-align: center;
|
||||
opacity: .8;
|
||||
|
||||
a {
|
||||
margin: 0 .2em;
|
||||
}
|
||||
}
|
||||
|
||||
#home-nav {
|
||||
opacity: .8;
|
||||
|
||||
a {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: .5em;
|
||||
}
|
||||
}
|
||||
|
||||
#home-footer {
|
||||
text-align: center;
|
||||
font-size: .6em;
|
||||
line-height: normal;
|
||||
@include dimmed;
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// list.html
|
||||
//
|
||||
.posts-group {
|
||||
display: flex;
|
||||
margin-bottom: 1.9em;
|
||||
line-height: normal;
|
||||
|
||||
.post-year {
|
||||
padding-top: 6px;
|
||||
margin-right: 1.8em;
|
||||
font-size: 1.6em;
|
||||
@include dimmed;
|
||||
}
|
||||
|
||||
.posts-list {
|
||||
flex-grow: 1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
|
||||
}
|
||||
|
||||
.post-item {
|
||||
border-bottom: 1px $highlight-grey dashed;
|
||||
|
||||
a {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
padding: 12px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.post-day {
|
||||
flex-shrink: 0;
|
||||
margin-left: 1em;
|
||||
@include dimmed;
|
||||
}
|
||||
}
|
||||
|
||||
// single.html
|
||||
//
|
||||
.bg-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: .03;
|
||||
z-index: -1;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
background-attachment: fixed;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
transition: opacity .5s;
|
||||
}
|
||||
|
||||
.show-bg-img {
|
||||
z-index: 100;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#show-img-btn {
|
||||
margin-right: .3em;
|
||||
}
|
||||
|
||||
.post-header {
|
||||
margin-top: 1.2em;
|
||||
line-height: normal;
|
||||
|
||||
.post-meta {
|
||||
font-size: .9em;
|
||||
letter-spacing: normal;
|
||||
@include dimmed;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: .1em;
|
||||
}
|
||||
}
|
||||
|
||||
hr.post-end {
|
||||
width: 50%;
|
||||
margin-top: 1.6em;
|
||||
margin-bottom: .8em;
|
||||
margin-left: 0;
|
||||
border-style: solid;
|
||||
border-bottom-width: 4px;
|
||||
}
|
||||
|
||||
.content {
|
||||
{{- with .Site.Params.justifyContent }}
|
||||
text-align: justify;
|
||||
text-justify: inter-ideograph; //For IE/Edge
|
||||
{{- end }}
|
||||
|
||||
@include aTag;
|
||||
|
||||
figure {
|
||||
max-width: 100;
|
||||
height: auto;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin: auto;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
ul,
|
||||
ol {
|
||||
padding: 0;
|
||||
margin-left: 1.8em;
|
||||
}
|
||||
}
|
||||
|
||||
figure.left {
|
||||
float: left;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
figure.right {
|
||||
float: right;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.footnote-ref a,
|
||||
a.footnote-return {
|
||||
box-shadow: none;
|
||||
text-decoration: underline;
|
||||
|
||||
&:hover {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.post-info {
|
||||
font-size: .8rem;
|
||||
line-height: normal;
|
||||
@include dimmed;
|
||||
|
||||
p {
|
||||
margin: .8em 0;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
svg {
|
||||
margin-right: .8em;
|
||||
}
|
||||
|
||||
.tag {
|
||||
margin-right: .5em;
|
||||
|
||||
&::before {
|
||||
content: "#"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.post-nav {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 1.5em;
|
||||
font-size: 1.2em;
|
||||
|
||||
a {
|
||||
flex-basis: 50%;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.next-post {text-align: left; padding-right: 5px;}
|
||||
.prev-post {text-align: right; padding-left: 5px;}
|
||||
|
||||
.post-nav-label {
|
||||
font-size: .8em;
|
||||
opacity: .8;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 800px) {
|
||||
.site-main {
|
||||
margin-top: 3em;
|
||||
}
|
||||
|
||||
hr.post-end {
|
||||
width: 40%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 960px) {
|
||||
.site-main {
|
||||
margin-top: 6em;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1300px) {
|
||||
.site-main {
|
||||
margin-top: 8em;
|
||||
}
|
||||
|
||||
hr.post-end {
|
||||
width: 30%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1800px) {
|
||||
.site-main {
|
||||
margin-top: 10em;
|
||||
}
|
||||
|
||||
.section-inner {
|
||||
max-width: 1600px;
|
||||
}
|
||||
|
||||
.thin {
|
||||
max-width: 960px;
|
||||
}
|
||||
|
||||
hr.post-end {
|
||||
width: 30%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
|
||||
.hide-in-mobile,
|
||||
.site-nav.hide-in-mobile {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#menu-btn,
|
||||
#search-btn {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.posts-group {
|
||||
display: block;
|
||||
|
||||
.post-year {
|
||||
margin: -6px 0 4px;
|
||||
}
|
||||
}
|
||||
|
||||
#spotlight.error-404 {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
|
||||
.banner-404 {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 520px) {
|
||||
|
||||
figure.left,
|
||||
figure.right {
|
||||
float: unset;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
hr.post-end {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
#mobile-menu {
|
||||
right: 1.2em;
|
||||
}
|
||||
}
|
58
exampleSite/config.toml
Normal file
|
@ -0,0 +1,58 @@
|
|||
baseURL = "https://example.com"
|
||||
languageCode = "en-us"
|
||||
title = "Hugo Hermit"
|
||||
theme = "hermit"
|
||||
# enableGitInfo = true
|
||||
pygmentsCodefences = true
|
||||
pygmentsUseClasses = true
|
||||
hasCJKLanguage = true # If there're Chinese/Japanese/Korean Languages in the content, enable this.
|
||||
rssLimit = 10 # Maximum number of items in the RSS feed.
|
||||
copyright = "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License." # This is only used by RSS template.
|
||||
# googleAnalytics = "UA-123-45"
|
||||
# disqusShortname = "yourdiscussshortname"
|
||||
|
||||
[author]
|
||||
name = "John Doe"
|
||||
|
||||
[blackfriday]
|
||||
hrefTargetBlank = true
|
||||
|
||||
[taxonomies]
|
||||
tag = "tags"
|
||||
category = "" # Categories are disabled by default.
|
||||
|
||||
[params]
|
||||
dateform = "Jan 2, 2006"
|
||||
dateformShort = "Jan 2"
|
||||
dateformNum = "2006-01-02"
|
||||
dateformNumTime = "2006-01-02 15:04 -0700"
|
||||
|
||||
# themeColor = "#494f5c" # Theme color in meta tags.
|
||||
homeSubtitle = "A minimal and fast theme for Hugo."
|
||||
footerCopyright = ' · <a href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="noopener">CC BY-NC 4.0</a>'
|
||||
# gitUrl = "https://github.com/Someone/SomeRepo/commit/" # Prefix of link to you git commit detail page. GitInfo must be enabled.
|
||||
justifyContent = false # Set "text-align: justify" to .content
|
||||
|
||||
[[params.social]]
|
||||
name = "twitter"
|
||||
url = "https://twitter.com/"
|
||||
|
||||
[[params.social]]
|
||||
name = "instagram"
|
||||
url = "https://instagram.com/"
|
||||
|
||||
[[params.social]]
|
||||
name = "github"
|
||||
url = "https://github.com/"
|
||||
|
||||
[menu]
|
||||
|
||||
[[menu.main]]
|
||||
name = "Posts"
|
||||
url = "/posts/"
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
name = "About"
|
||||
url = "/about-hugo/"
|
||||
weight = 20
|
17
exampleSite/content/about-hugo.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
+++
|
||||
title = "About Hugo"
|
||||
date = "2014-04-09"
|
||||
+++
|
||||
|
||||
Hugo is the **world’s fastest framework for building websites**. It is written in Go.
|
||||
|
||||
It makes use of a variety of open source projects including:
|
||||
|
||||
* https://github.com/russross/blackfriday
|
||||
* https://github.com/alecthomas/chroma
|
||||
* https://github.com/muesli/smartcrop
|
||||
* https://github.com/spf13/cobra
|
||||
* https://github.com/spf13/viper
|
||||
|
||||
Learn more and contribute on [GitHub](https://github.com/gohugoio).
|
||||
|
1142
exampleSite/content/posts/creating-a-new-theme.md
Normal file
338
exampleSite/content/posts/goisforlovers.md
Normal file
|
@ -0,0 +1,338 @@
|
|||
+++
|
||||
title = "(Hu)go Template Primer"
|
||||
tags = [
|
||||
"go",
|
||||
"golang",
|
||||
"templates",
|
||||
"themes",
|
||||
"development",
|
||||
]
|
||||
date = "2014-04-02"
|
||||
+++
|
||||
|
||||
Hugo uses the excellent [Go][] [html/template][gohtmltemplate] library for
|
||||
its template engine. It is an extremely lightweight engine that provides a very
|
||||
small amount of logic. In our experience that it is just the right amount of
|
||||
logic to be able to create a good static website. If you have used other
|
||||
template systems from different languages or frameworks you will find a lot of
|
||||
similarities in Go templates.
|
||||
|
||||
This document is a brief primer on using Go templates. The [Go docs][gohtmltemplate]
|
||||
provide more details.
|
||||
|
||||
## Introduction to Go Templates
|
||||
|
||||
Go templates provide an extremely simple template language. It adheres to the
|
||||
belief that only the most basic of logic belongs in the template or view layer.
|
||||
One consequence of this simplicity is that Go templates parse very quickly.
|
||||
|
||||
A unique characteristic of Go templates is they are content aware. Variables and
|
||||
content will be sanitized depending on the context of where they are used. More
|
||||
details can be found in the [Go docs][gohtmltemplate].
|
||||
|
||||
## Basic Syntax
|
||||
|
||||
Golang templates are HTML files with the addition of variables and
|
||||
functions.
|
||||
|
||||
**Go variables and functions are accessible within {{ }}**
|
||||
|
||||
Accessing a predefined variable "foo":
|
||||
|
||||
{{ foo }}
|
||||
|
||||
**Parameters are separated using spaces**
|
||||
|
||||
Calling the add function with input of 1, 2:
|
||||
|
||||
{{ add 1 2 }}
|
||||
|
||||
**Methods and fields are accessed via dot notation**
|
||||
|
||||
Accessing the Page Parameter "bar"
|
||||
|
||||
{{ .Params.bar }}
|
||||
|
||||
**Parentheses can be used to group items together**
|
||||
|
||||
{{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }}
|
||||
|
||||
|
||||
## Variables
|
||||
|
||||
Each Go template has a struct (object) made available to it. In hugo each
|
||||
template is passed either a page or a node struct depending on which type of
|
||||
page you are rendering. More details are available on the
|
||||
[variables](/layout/variables) page.
|
||||
|
||||
A variable is accessed by referencing the variable name.
|
||||
|
||||
<title>{{ .Title }}</title>
|
||||
|
||||
Variables can also be defined and referenced.
|
||||
|
||||
{{ $address := "123 Main St."}}
|
||||
{{ $address }}
|
||||
|
||||
|
||||
## Functions
|
||||
|
||||
Go template ship with a few functions which provide basic functionality. The Go
|
||||
template system also provides a mechanism for applications to extend the
|
||||
available functions with their own. [Hugo template
|
||||
functions](/layout/functions) provide some additional functionality we believe
|
||||
are useful for building websites. Functions are called by using their name
|
||||
followed by the required parameters separated by spaces. Template
|
||||
functions cannot be added without recompiling hugo.
|
||||
|
||||
**Example:**
|
||||
|
||||
{{ add 1 2 }}
|
||||
|
||||
## Includes
|
||||
|
||||
When including another template you will pass to it the data it will be
|
||||
able to access. To pass along the current context please remember to
|
||||
include a trailing dot. The templates location will always be starting at
|
||||
the /layout/ directory within Hugo.
|
||||
|
||||
**Example:**
|
||||
|
||||
{{ template "chrome/header.html" . }}
|
||||
|
||||
|
||||
## Logic
|
||||
|
||||
Go templates provide the most basic iteration and conditional logic.
|
||||
|
||||
### Iteration
|
||||
|
||||
Just like in Go, the Go templates make heavy use of range to iterate over
|
||||
a map, array or slice. The following are different examples of how to use
|
||||
range.
|
||||
|
||||
**Example 1: Using Context**
|
||||
|
||||
{{ range array }}
|
||||
{{ . }}
|
||||
{{ end }}
|
||||
|
||||
**Example 2: Declaring value variable name**
|
||||
|
||||
{{range $element := array}}
|
||||
{{ $element }}
|
||||
{{ end }}
|
||||
|
||||
**Example 2: Declaring key and value variable name**
|
||||
|
||||
{{range $index, $element := array}}
|
||||
{{ $index }}
|
||||
{{ $element }}
|
||||
{{ end }}
|
||||
|
||||
### Conditionals
|
||||
|
||||
If, else, with, or, & and provide the framework for handling conditional
|
||||
logic in Go Templates. Like range, each statement is closed with `end`.
|
||||
|
||||
|
||||
Go Templates treat the following values as false:
|
||||
|
||||
* false
|
||||
* 0
|
||||
* any array, slice, map, or string of length zero
|
||||
|
||||
**Example 1: If**
|
||||
|
||||
{{ if isset .Params "title" }}<h4>{{ index .Params "title" }}</h4>{{ end }}
|
||||
|
||||
**Example 2: If -> Else**
|
||||
|
||||
{{ if isset .Params "alt" }}
|
||||
{{ index .Params "alt" }}
|
||||
{{else}}
|
||||
{{ index .Params "caption" }}
|
||||
{{ end }}
|
||||
|
||||
**Example 3: And & Or**
|
||||
|
||||
{{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
|
||||
|
||||
**Example 4: With**
|
||||
|
||||
An alternative way of writing "if" and then referencing the same value
|
||||
is to use "with" instead. With rebinds the context `.` within its scope,
|
||||
and skips the block if the variable is absent.
|
||||
|
||||
The first example above could be simplified as:
|
||||
|
||||
{{ with .Params.title }}<h4>{{ . }}</h4>{{ end }}
|
||||
|
||||
**Example 5: If -> Else If**
|
||||
|
||||
{{ if isset .Params "alt" }}
|
||||
{{ index .Params "alt" }}
|
||||
{{ else if isset .Params "caption" }}
|
||||
{{ index .Params "caption" }}
|
||||
{{ end }}
|
||||
|
||||
## Pipes
|
||||
|
||||
One of the most powerful components of Go templates is the ability to
|
||||
stack actions one after another. This is done by using pipes. Borrowed
|
||||
from unix pipes, the concept is simple, each pipeline's output becomes the
|
||||
input of the following pipe.
|
||||
|
||||
Because of the very simple syntax of Go templates, the pipe is essential
|
||||
to being able to chain together function calls. One limitation of the
|
||||
pipes is that they only can work with a single value and that value
|
||||
becomes the last parameter of the next pipeline.
|
||||
|
||||
A few simple examples should help convey how to use the pipe.
|
||||
|
||||
**Example 1 :**
|
||||
|
||||
{{ if eq 1 1 }} Same {{ end }}
|
||||
|
||||
is the same as
|
||||
|
||||
{{ eq 1 1 | if }} Same {{ end }}
|
||||
|
||||
It does look odd to place the if at the end, but it does provide a good
|
||||
illustration of how to use the pipes.
|
||||
|
||||
**Example 2 :**
|
||||
|
||||
{{ index .Params "disqus_url" | html }}
|
||||
|
||||
Access the page parameter called "disqus_url" and escape the HTML.
|
||||
|
||||
**Example 3 :**
|
||||
|
||||
{{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
|
||||
Stuff Here
|
||||
{{ end }}
|
||||
|
||||
Could be rewritten as
|
||||
|
||||
{{ isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" | if }}
|
||||
Stuff Here
|
||||
{{ end }}
|
||||
|
||||
|
||||
## Context (aka. the dot)
|
||||
|
||||
The most easily overlooked concept to understand about Go templates is that {{ . }}
|
||||
always refers to the current context. In the top level of your template this
|
||||
will be the data set made available to it. Inside of a iteration it will have
|
||||
the value of the current item. When inside of a loop the context has changed. .
|
||||
will no longer refer to the data available to the entire page. If you need to
|
||||
access this from within the loop you will likely want to set it to a variable
|
||||
instead of depending on the context.
|
||||
|
||||
**Example:**
|
||||
|
||||
{{ $title := .Site.Title }}
|
||||
{{ range .Params.tags }}
|
||||
<li> <a href="{{ $baseurl }}/tags/{{ . | urlize }}">{{ . }}</a> - {{ $title }} </li>
|
||||
{{ end }}
|
||||
|
||||
Notice how once we have entered the loop the value of {{ . }} has changed. We
|
||||
have defined a variable outside of the loop so we have access to it from within
|
||||
the loop.
|
||||
|
||||
# Hugo Parameters
|
||||
|
||||
Hugo provides the option of passing values to the template language
|
||||
through the site configuration (for sitewide values), or through the meta
|
||||
data of each specific piece of content. You can define any values of any
|
||||
type (supported by your front matter/config format) and use them however
|
||||
you want to inside of your templates.
|
||||
|
||||
|
||||
## Using Content (page) Parameters
|
||||
|
||||
In each piece of content you can provide variables to be used by the
|
||||
templates. This happens in the [front matter](/content/front-matter).
|
||||
|
||||
An example of this is used in this documentation site. Most of the pages
|
||||
benefit from having the table of contents provided. Sometimes the TOC just
|
||||
doesn't make a lot of sense. We've defined a variable in our front matter
|
||||
of some pages to turn off the TOC from being displayed.
|
||||
|
||||
Here is the example front matter:
|
||||
|
||||
```
|
||||
---
|
||||
title: "Permalinks"
|
||||
date: "2013-11-18"
|
||||
aliases:
|
||||
- "/doc/permalinks/"
|
||||
groups: ["extras"]
|
||||
groups_weight: 30
|
||||
notoc: true
|
||||
---
|
||||
```
|
||||
|
||||
Here is the corresponding code inside of the template:
|
||||
|
||||
{{ if not .Params.notoc }}
|
||||
<div id="toc" class="well col-md-4 col-sm-6">
|
||||
{{ .TableOfContents }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
||||
|
||||
## Using Site (config) Parameters
|
||||
In your top-level configuration file (eg, `config.yaml`) you can define site
|
||||
parameters, which are values which will be available to you in chrome.
|
||||
|
||||
For instance, you might declare:
|
||||
|
||||
```yaml
|
||||
params:
|
||||
CopyrightHTML: "Copyright © 2013 John Doe. All Rights Reserved."
|
||||
TwitterUser: "spf13"
|
||||
SidebarRecentLimit: 5
|
||||
```
|
||||
|
||||
Within a footer layout, you might then declare a `<footer>` which is only
|
||||
provided if the `CopyrightHTML` parameter is provided, and if it is given,
|
||||
you would declare it to be HTML-safe, so that the HTML entity is not escaped
|
||||
again. This would let you easily update just your top-level config file each
|
||||
January 1st, instead of hunting through your templates.
|
||||
|
||||
```
|
||||
{{if .Site.Params.CopyrightHTML}}<footer>
|
||||
<div class="text-center">{{.Site.Params.CopyrightHTML | safeHtml}}</div>
|
||||
</footer>{{end}}
|
||||
```
|
||||
|
||||
An alternative way of writing the "if" and then referencing the same value
|
||||
is to use "with" instead. With rebinds the context `.` within its scope,
|
||||
and skips the block if the variable is absent:
|
||||
|
||||
```
|
||||
{{with .Site.Params.TwitterUser}}<span class="twitter">
|
||||
<a href="https://twitter.com/{{.}}" rel="author">
|
||||
<img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}"
|
||||
alt="Twitter"></a>
|
||||
</span>{{end}}
|
||||
```
|
||||
|
||||
Finally, if you want to pull "magic constants" out of your layouts, you can do
|
||||
so, such as in this example:
|
||||
|
||||
```
|
||||
<nav class="recent">
|
||||
<h1>Recent Posts</h1>
|
||||
<ul>{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
|
||||
<li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
|
||||
{{end}}</ul>
|
||||
</nav>
|
||||
```
|
||||
|
||||
|
||||
[go]: https://golang.org/
|
||||
[gohtmltemplate]: https://golang.org/pkg/html/template/
|
83
exampleSite/content/posts/hugoisforlovers.md
Normal file
|
@ -0,0 +1,83 @@
|
|||
+++
|
||||
title = "Getting Started with Hugo"
|
||||
tags = [
|
||||
"go",
|
||||
"golang",
|
||||
"hugo",
|
||||
"development",
|
||||
]
|
||||
date = "2014-04-02"
|
||||
+++
|
||||
|
||||
## Step 1. Install Hugo
|
||||
|
||||
Go to [Hugo releases](https://github.com/spf13/hugo/releases) and download the
|
||||
appropriate version for your OS and architecture.
|
||||
|
||||
Save it somewhere specific as we will be using it in the next step.
|
||||
|
||||
More complete instructions are available at [Install Hugo](https://gohugo.io/getting-started/installing/)
|
||||
|
||||
## Step 2. Build the Docs
|
||||
|
||||
Hugo has its own example site which happens to also be the documentation site
|
||||
you are reading right now.
|
||||
|
||||
Follow the following steps:
|
||||
|
||||
1. Clone the [Hugo repository](http://github.com/spf13/hugo)
|
||||
2. Go into the repo
|
||||
3. Run hugo in server mode and build the docs
|
||||
4. Open your browser to http://localhost:1313
|
||||
|
||||
Corresponding pseudo commands:
|
||||
|
||||
git clone https://github.com/spf13/hugo
|
||||
cd hugo
|
||||
/path/to/where/you/installed/hugo server --source=./docs
|
||||
> 29 pages created
|
||||
> 0 tags index created
|
||||
> in 27 ms
|
||||
> Web Server is available at http://localhost:1313
|
||||
> Press ctrl+c to stop
|
||||
|
||||
Once you've gotten here, follow along the rest of this page on your local build.
|
||||
|
||||
## Step 3. Change the docs site
|
||||
|
||||
Stop the Hugo process by hitting Ctrl+C.
|
||||
|
||||
Now we are going to run hugo again, but this time with hugo in watch mode.
|
||||
|
||||
/path/to/hugo/from/step/1/hugo server --source=./docs --watch
|
||||
> 29 pages created
|
||||
> 0 tags index created
|
||||
> in 27 ms
|
||||
> Web Server is available at http://localhost:1313
|
||||
> Watching for changes in /Users/spf13/Code/hugo/docs/content
|
||||
> Press ctrl+c to stop
|
||||
|
||||
|
||||
Open your [favorite editor](http://vim.spf13.com) and change one of the source
|
||||
content pages. How about changing this very file to *fix the typo*. How about changing this very file to *fix the typo*.
|
||||
|
||||
Content files are found in `docs/content/`. Unless otherwise specified, files
|
||||
are located at the same relative location as the url, in our case
|
||||
`docs/content/overview/quickstart.md`.
|
||||
|
||||
Change and save this file.. Notice what happened in your terminal.
|
||||
|
||||
> Change detected, rebuilding site
|
||||
|
||||
> 29 pages created
|
||||
> 0 tags index created
|
||||
> in 26 ms
|
||||
|
||||
Refresh the browser and observe that the typo is now fixed.
|
||||
|
||||
Notice how quick that was. Try to refresh the site before it's finished building. I double dare you.
|
||||
Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.
|
||||
|
||||
## Step 4. Have fun
|
||||
|
||||
The best way to learn something is to play with it.
|
150
exampleSite/content/posts/migrate-from-jekyll.md
Normal file
|
@ -0,0 +1,150 @@
|
|||
---
|
||||
date: 2014-03-10
|
||||
title: Migrate to Hugo from Jekyll
|
||||
---
|
||||
|
||||
## Move static content to `static`
|
||||
Jekyll has a rule that any directory not starting with `_` will be copied as-is to the `_site` output. Hugo keeps all static content under `static`. You should therefore move it all there.
|
||||
With Jekyll, something that looked like
|
||||
|
||||
▾ <root>/
|
||||
▾ images/
|
||||
logo.png
|
||||
|
||||
should become
|
||||
|
||||
▾ <root>/
|
||||
▾ static/
|
||||
▾ images/
|
||||
logo.png
|
||||
|
||||
Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`.
|
||||
|
||||
## Create your Hugo configuration file
|
||||
Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the [Hugo configuration documentation](/overview/configuration/) for details.
|
||||
|
||||
## Set your configuration publish folder to `_site`
|
||||
The default is for Jekyll to publish to `_site` and for Hugo to publish to `public`. If, like me, you have [`_site` mapped to a git submodule on the `gh-pages` branch](http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html), you'll want to do one of two alternatives:
|
||||
|
||||
1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended).
|
||||
|
||||
git submodule deinit _site
|
||||
git rm _site
|
||||
git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
|
||||
|
||||
2. Or, change the Hugo configuration to use `_site` instead of `public`.
|
||||
|
||||
{
|
||||
..
|
||||
"publishdir": "_site",
|
||||
..
|
||||
}
|
||||
|
||||
## Convert Jekyll templates to Hugo templates
|
||||
That's the bulk of the work right here. The documentation is your friend. You should refer to [Jekyll's template documentation](http://jekyllrb.com/docs/templates/) if you need to refresh your memory on how you built your blog and [Hugo's template](/layout/templates/) to learn Hugo's way.
|
||||
|
||||
As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours.
|
||||
|
||||
## Convert Jekyll plugins to Hugo shortcodes
|
||||
Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port.
|
||||
|
||||
### Implementation
|
||||
As an example, I was using a custom [`image_tag`](https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb) plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.
|
||||
|
||||
Jekyll's plugin:
|
||||
|
||||
module Jekyll
|
||||
class ImageTag < Liquid::Tag
|
||||
@url = nil
|
||||
@caption = nil
|
||||
@class = nil
|
||||
@link = nil
|
||||
// Patterns
|
||||
IMAGE_URL_WITH_CLASS_AND_CAPTION =
|
||||
IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i
|
||||
IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i
|
||||
IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
|
||||
IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
|
||||
def initialize(tag_name, markup, tokens)
|
||||
super
|
||||
if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
|
||||
@class = $1
|
||||
@url = $3
|
||||
@caption = $7
|
||||
@link = $9
|
||||
elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
|
||||
@class = $1
|
||||
@url = $3
|
||||
@caption = $7
|
||||
elsif markup =~ IMAGE_URL_WITH_CAPTION
|
||||
@url = $1
|
||||
@caption = $5
|
||||
elsif markup =~ IMAGE_URL_WITH_CLASS
|
||||
@class = $1
|
||||
@url = $3
|
||||
elsif markup =~ IMAGE_URL
|
||||
@url = $1
|
||||
end
|
||||
end
|
||||
def render(context)
|
||||
if @class
|
||||
source = "<figure class='#{@class}'>"
|
||||
else
|
||||
source = "<figure>"
|
||||
end
|
||||
if @link
|
||||
source += "<a href=\"#{@link}\">"
|
||||
end
|
||||
source += "<img src=\"#{@url}\">"
|
||||
if @link
|
||||
source += "</a>"
|
||||
end
|
||||
source += "<figcaption>#{@caption}</figcaption>" if @caption
|
||||
source += "</figure>"
|
||||
source
|
||||
end
|
||||
end
|
||||
end
|
||||
Liquid::Template.register_tag('image', Jekyll::ImageTag)
|
||||
|
||||
is written as this Hugo shortcode:
|
||||
|
||||
<!-- image -->
|
||||
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
||||
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
|
||||
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} />
|
||||
{{ if .Get "link"}}</a>{{ end }}
|
||||
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
||||
<figcaption>{{ if isset .Params "title" }}
|
||||
{{ .Get "title" }}{{ end }}
|
||||
{{ if or (.Get "caption") (.Get "attr")}}<p>
|
||||
{{ .Get "caption" }}
|
||||
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
|
||||
{{ .Get "attr" }}
|
||||
{{ if .Get "attrlink"}}</a> {{ end }}
|
||||
</p> {{ end }}
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
<!-- image -->
|
||||
|
||||
### Usage
|
||||
I simply changed:
|
||||
|
||||
{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg "One of my favorite touristy-type photos. I secretly waited for the good light while we were "having fun" and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." ->http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
|
||||
|
||||
to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`):
|
||||
|
||||
{{%/* fig class="full" src="http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg" title="One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." link="http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/" */%}}
|
||||
|
||||
As a bonus, the shortcode named parameters are, arguably, more readable.
|
||||
|
||||
## Finishing touches
|
||||
### Fix content
|
||||
Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that `hugo server --watch` is your friend. Test your changes and fix errors as needed.
|
||||
|
||||
### Clean up
|
||||
You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it.
|
||||
|
||||
## A practical example in a diff
|
||||
[Hey, it's Alex](http://heyitsalex.net/) was migrated in less than a _father-with-kids day_ from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this [diff](https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610).
|
17
exampleSite/content/posts/post-with-featured-image.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
title: "Post With Featured Image"
|
||||
date: 2018-10-01T16:15:09+08:00
|
||||
draft: false
|
||||
featuredImg: "https://picsum.photos/1024/768/?random"
|
||||
tags:
|
||||
- Demo
|
||||
- Image
|
||||
---
|
||||
|
||||
Just define the image URL in the content’s front matter, the featured image will be displayed as the background.
|
||||
|
||||
For example:
|
||||
|
||||
```yaml
|
||||
featuredImg: "https://picsum.photos/1024/768/?random"
|
||||
```
|
69
exampleSite/content/posts/typography.md
Normal file
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
title: "Typography"
|
||||
date: 2018-09-29T11:36:33+08:00
|
||||
draft: false
|
||||
featuredImg: ""
|
||||
tags:
|
||||
- Demo
|
||||
- Typography
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
|
||||
> An apple is a sweet, edible fruit produced by an apple tree (Malus pumila). Apple trees are cultivated worldwide, and are the most widely grown species in the genus Malus. The tree originated in Central Asia, where its wild ancestor, Malus sieversii, is still found today. Apples have been grown for thousands of years in Asia and Europe, and were brought to North America by European colonists. Apples have religious and mythological significance in many cultures, including Norse, Greek and European Christian traditions.[^1]
|
||||
|
||||
---
|
||||
|
||||
Inline styles:
|
||||
|
||||
**strong**, *emphasis*, ***strong and emphasis***,`code`, <u>underline</u>, ~~strikethrough~~, :haha:, $\LaTeX$, X^2^, H~2~O, ==highlight==, [Link](https://example.com), and image:
|
||||
|
||||
![img](https://picsum.photos/600/400/?random)
|
||||
|
||||
---
|
||||
|
||||
Headings:
|
||||
|
||||
# Heading 1
|
||||
|
||||
## Heading 2
|
||||
|
||||
### Heading 3
|
||||
|
||||
#### Heading 4
|
||||
|
||||
##### Heading 5
|
||||
|
||||
###### Heading 6
|
||||
|
||||
Table:
|
||||
|
||||
| Left-Aligned | Center Aligned | Right Aligned |
|
||||
| :------------ | :-------------: | ------------: |
|
||||
| col 3 is | some wordy text | $1600 |
|
||||
| col 2 is | centered | $12 |
|
||||
| zebra stripes | are neat | $1 |
|
||||
|
||||
Lists:
|
||||
|
||||
* Unordered list item 1.
|
||||
* Unordered list item 2.
|
||||
|
||||
1. ordered list item 1.
|
||||
2. ordered list item 2.
|
||||
+ sub-unordered list item 1.
|
||||
+ sub-unordered list item 2.
|
||||
+ [x] something is DONE.
|
||||
+ [ ] something is NOT DONE.
|
||||
|
||||
Syntax Highlighting:
|
||||
|
||||
```javascript
|
||||
var num1, num2, sum
|
||||
num1 = prompt("Enter first number")
|
||||
num2 = prompt("Enter second number")
|
||||
sum = parseInt(num1) + parseInt(num2) // "+" means "add"
|
||||
alert("Sum = " + sum) // "+" means combine into a string
|
||||
```
|
||||
|
||||
[^1]: From https://en.wikipedia.org/wiki/Apple
|
BIN
images/hermit.png
Normal file
After Width: | Height: | Size: 220 KiB |
BIN
images/screenshot.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
images/tn.png
Normal file
After Width: | Height: | Size: 24 KiB |
19
layouts/404.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{{ define "main" }}
|
||||
<div id="spotlight" class="error-404 animated fadeIn">
|
||||
<p class="img-404">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cloud-drizzle"><line x1="8" y1="19" x2="8" y2="21"></line><line x1="8" y1="13" x2="8" y2="15"></line><line x1="16" y1="19" x2="16" y2="21"></line><line x1="16" y1="13" x2="16" y2="15"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="12" y1="15" x2="12" y2="17"></line><path d="M20 16.58A5 5 0 0 0 18 7h-1.26A8 8 0 1 0 4 15.25"></path></svg>
|
||||
</p>
|
||||
<div class="banner-404">
|
||||
<h1>404</h1>
|
||||
<p>Oops, page not found…</p>
|
||||
<p class="btn-404">
|
||||
<a href="{{.Site.BaseURL}}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>Home</a>
|
||||
<a href="{{ "posts" | absURL }}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-archive"><polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line></svg>Archives</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer" }}
|
||||
<script>let haveHeader = false;</script>
|
||||
{{ end }}
|
36
layouts/_default/baseof.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{.Site.LanguageCode}}">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
{{- with .Site.Params.themeColor }}
|
||||
<meta name="theme-color" content="{{.}}">
|
||||
<meta name="msapplication-TileColor" content="{{.}}">
|
||||
{{- end }}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{"apple-touch-icon.png" | relURL}}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{"favicon-32x32.png" | relURL}}">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{"favicon-16x16.png" | relURL}}">
|
||||
<link rel="manifest" href="{{"site.webmanifest" | relURL}}">
|
||||
<link rel="mask-icon" href="{{"safari-pinned-tab.svg" | relURL}}" color="{{.Site.Params.themeColor}}">
|
||||
<link rel="shortcut icon" href="{{"favicon.ico" | relURL}}">
|
||||
<title>{{.Title}}</title>
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
{{ printf `<link rel="%s" type="%s+%s" href="%s" title="%s" />` .Rel .MediaType.Type .MediaType.Suffix .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end -}}
|
||||
{{ $style := resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "css/style.css" . | toCSS | minify | fingerprint -}}
|
||||
<link rel="stylesheet" href="{{ $style.RelPermalink }}" {{ printf "integrity=%q" $style.Data.Integrity | safeHTMLAttr }}>
|
||||
{{ block "head" . -}}{{- end }}
|
||||
</head>
|
||||
|
||||
<body id="page">
|
||||
{{ block "header" . -}}{{ end -}}
|
||||
{{ block "main" . -}}{{ end -}}
|
||||
{{ block "footer" . -}}{{ end }}
|
||||
{{ $script := resources.Get "js/main.js" | minify | fingerprint -}}
|
||||
<script src="{{ $script.RelPermalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }}></script>
|
||||
{{ template "_internal/google_analytics_async.html" . }}
|
||||
</body>
|
||||
|
||||
</html>
|
34
layouts/_default/list.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
{{ define "header" }}
|
||||
{{ partialCached "header.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<main class="site-main section-inner thin animated fadeIn faster">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{- if .Content }}
|
||||
<div class="content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- range .Data.Pages.GroupByDate "2006" }}
|
||||
<div class="posts-group">
|
||||
<div class="post-year">{{ .Key }}</div>
|
||||
<ul class="posts-list">
|
||||
{{- range .Pages }}
|
||||
<li class="post-item">
|
||||
<a href="{{.Permalink}}">
|
||||
<span class="post-title">{{.Title}}</span>
|
||||
<span class="post-day">{{ .Date.Format .Site.Params.dateformShort }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end }}
|
||||
</main>
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer" }}
|
||||
{{ partialCached "footer.html" . }}
|
||||
<script>let haveHeader = true;</script>
|
||||
{{ end }}
|
20
layouts/_default/single.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{{ define "header" }}
|
||||
{{ partialCached "header.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<main class="site-main section-inner thin animated fadeIn faster">
|
||||
<h1>{{ .Title }}</h1>
|
||||
<div class="content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
{{- with .Params.comments }}
|
||||
{{ with .Site.DisqusShortname }}{{ partialCached "disqus.html" . }}{{ end }}
|
||||
{{- end }}
|
||||
</main>
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer" }}
|
||||
{{ partialCached "footer.html" . }}
|
||||
<script>let haveHeader = true;</script>
|
||||
{{ end }}
|
27
layouts/index.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{{ define "main" }}
|
||||
<div id="spotlight" class="animated fadeIn">
|
||||
<div id="home-center">
|
||||
<h1 id="home-title">{{ .Site.Title }}</h1>
|
||||
{{- with .Site.Params.homeSubtitle }}
|
||||
<p id="home-subtitle">{{.}}</p>
|
||||
{{- end }}
|
||||
{{- with .Site.Params.social }}
|
||||
<div id="home-social">
|
||||
{{ partialCached "social-icons.html" . }}
|
||||
</div>
|
||||
{{- end }}
|
||||
<nav id="home-nav" class="site-nav">
|
||||
{{- range .Site.Menus.main }}
|
||||
<a href="{{ .URL }}">{{ .Name }}</a>
|
||||
{{- end }}
|
||||
</nav>
|
||||
</div>
|
||||
<div id="home-footer">
|
||||
<p>© 2018 <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>. <a href="{{ "posts/index.xml" | absURL }}" target="_blank" title="rss"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rss"><path d="M4 11a9 9 0 0 1 9 9"></path><path d="M4 4a16 16 0 0 1 16 16"></path><circle cx="5" cy="19" r="1"></circle></svg></a></p>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer" }}
|
||||
<script>let haveHeader = false;</script>
|
||||
{{ end }}
|
16
layouts/partials/disqus.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
// Don't ever inject Disqus on localhost--it creates unwanted
|
||||
// discussions from 'localhost:1313' on your Disqus account...
|
||||
if (window.location.hostname == "localhost")
|
||||
return;
|
||||
|
||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
var disqus_shortname = '{{ .Site.DisqusShortname }}';
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
<a href="http://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
4
layouts/partials/footer.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
<footer id="site-footer" class="section-inner thin animated fadeIn faster">
|
||||
<p>© 2018 <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>{{ .Site.Params.footerCopyright | safeHTML }}</p>
|
||||
<p>Made with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a> · Theme <a href="https://github.com/Track3/hermit" target="_blank" rel="noopener">Hermit</a> · <a href="{{ "posts/index.xml" | absURL }}" target="_blank" title="rss"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rss"><path d="M4 11a9 9 0 0 1 9 9"></path><path d="M4 4a16 16 0 0 1 16 16"></path><circle cx="5" cy="19" r="1"></circle></svg></a></p>
|
||||
</footer>
|
34
layouts/partials/header.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
<header id="site-header" class="animated slideInUp faster">
|
||||
<div class="hdr-wrapper section-inner">
|
||||
<div class="hdr-left">
|
||||
<div class="site-branding">
|
||||
<a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a>
|
||||
</div>
|
||||
<nav class="site-nav hide-in-mobile">
|
||||
{{- range .Site.Menus.main }}
|
||||
<a href="{{ .URL }}">{{ .Name }}</a>
|
||||
{{- end }}
|
||||
</nav>
|
||||
</div>
|
||||
<div class="hdr-right">
|
||||
<div class="hdr-icons">
|
||||
{{- with .Params.featuredImg }}
|
||||
<button id="show-img-btn" class="hdr-btn" onclick="showFeaturedImg()"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></button>
|
||||
{{- end }}
|
||||
{{- with .Site.Params.social }}
|
||||
<span class="hide-in-mobile">
|
||||
{{- partialCached "social-icons.html" . -}}
|
||||
</span>
|
||||
{{- end }}
|
||||
<button id="menu-btn" class="hdr-btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div id="mobile-menu" class="animated fast" style="display: none;">
|
||||
<ul>
|
||||
{{- range .Site.Menus.main }}
|
||||
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
3
layouts/partials/social-icons.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{ range . -}}
|
||||
<a href="{{ .url }}" target="_blank" rel="noopener"><span class="screen-reader-text">{{ .name }}</span>{{ partial "svg.html" . }}</a>
|
||||
{{- end }}
|
21
layouts/partials/svg.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{{- if (eq .name "codepen") -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-codepen"><polygon points="12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2"></polygon><line x1="12" y1="22" x2="12" y2="15.5"></line><polyline points="22 8.5 12 15.5 2 8.5"></polyline><polyline points="2 15.5 12 8.5 22 15.5"></polyline><line x1="12" y1="2" x2="12" y2="8.5"></line></svg>
|
||||
{{- else if (eq .name "facebook") -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-facebook"><path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"></path></svg>
|
||||
{{- else if (eq .name "github") -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-github"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg>
|
||||
{{- else if (eq .name "instagram") -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-instagram"><rect x="2" y="2" width="20" height="20" rx="5" ry="5"></rect><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"></path><line x1="17.5" y1="6.5" x2="17.5" y2="6.5"></line></svg>
|
||||
{{- else if (eq .name "linkedin") -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-linkedin"><path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z"></path><rect x="2" y="9" width="4" height="12"></rect><circle cx="4" cy="4" r="2"></circle></svg>
|
||||
{{- else if (eq .name "slack") -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-slack"><path d="M22.08 9C19.81 1.41 16.54-.35 9 1.92S-.35 7.46 1.92 15 7.46 24.35 15 22.08 24.35 16.54 22.08 9z"></path><line x1="12.57" y1="5.99" x2="16.15" y2="16.39"></line><line x1="7.85" y1="7.61" x2="11.43" y2="18.01"></line><line x1="16.39" y1="7.85" x2="5.99" y2="11.43"></line><line x1="18.01" y1="12.57" x2="7.61" y2="16.15"></line></svg>
|
||||
{{- else if (eq .name "twitter") -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-twitter"><path d="M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z"></path></svg>
|
||||
{{- else if (eq .name "youtube") -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-youtube"><path d="M22.54 6.42a2.78 2.78 0 0 0-1.94-2C18.88 4 12 4 12 4s-6.88 0-8.6.46a2.78 2.78 0 0 0-1.94 2A29 29 0 0 0 1 11.75a29 29 0 0 0 .46 5.33A2.78 2.78 0 0 0 3.4 19c1.72.46 8.6.46 8.6.46s6.88 0 8.6-.46a2.78 2.78 0 0 0 1.94-2 29 29 0 0 0 .46-5.25 29 29 0 0 0-.46-5.33z"></path><polygon points="9.75 15.02 15.5 11.75 9.75 8.48 9.75 15.02"></polygon></svg>
|
||||
{{- else if (eq .name "email") -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-mail"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>
|
||||
{{- else -}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||
{{- end -}}
|
27
layouts/posts/rss.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
|
||||
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
{{ with .OutputFormats.Get "RSS" -}}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end -}}
|
||||
{{ range .Pages }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Summary | html }}</description>
|
||||
<content type="html">{{ printf `<![CDATA[%s]]>` .Content | safeHTML }}</content>
|
||||
</item>
|
||||
{{ end }}
|
||||
</channel>
|
||||
</rss>
|
56
layouts/posts/single.html
Normal file
|
@ -0,0 +1,56 @@
|
|||
{{ define "header" }}
|
||||
{{ partial "header.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
{{- with .Params.featuredImg }}
|
||||
<div id="bg-img" class="bg-img" style="background-image: url({{.}});" onclick="showContent()"></div>
|
||||
{{- end }}
|
||||
<main class="site-main section-inner animated fadeIn faster">
|
||||
<article class="thin">
|
||||
<header class="post-header">
|
||||
<div class="post-meta"><span>{{ .Date.Format .Site.Params.dateform }}</span></div>
|
||||
<h1>{{ .Title }}</h1>
|
||||
</header>
|
||||
<div class="content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<hr class="post-end">
|
||||
<footer class="post-info">
|
||||
{{- with .Params.tags }}
|
||||
<p>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-tag meta-icon"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path><line x1="7" y1="7" x2="7" y2="7"></line></svg>
|
||||
{{- range . -}}
|
||||
<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}">{{.}}</a></span>
|
||||
{{- end }}
|
||||
</p>
|
||||
{{- end }}
|
||||
<p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>{{ .WordCount }} Words</p>
|
||||
<p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-calendar"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>{{ dateFormat .Site.Params.dateformNumTime .Date.Local }}</p>
|
||||
{{- if .GitInfo }}
|
||||
<p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-git-commit"><circle cx="12" cy="12" r="4"></circle><line x1="1.05" y1="12" x2="7" y2="12"></line><line x1="17.01" y1="12" x2="22.96" y2="12"></line></svg><a href="{{ .Site.Params.gitUrl -}}{{ .GitInfo.Hash }}" target="_blank" rel="noopener">{{ .GitInfo.AbbreviatedHash }}</a> @ {{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local }}</p>
|
||||
{{- end }}
|
||||
</footer>
|
||||
</article>
|
||||
<div class="post-nav thin">
|
||||
{{- with .NextInSection }}
|
||||
<a class="next-post" href="{{ .Permalink }}">
|
||||
<span class="post-nav-label"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg> Newer</span><br><span>{{ .Title }}</span>
|
||||
</a>
|
||||
{{- end }}
|
||||
{{- with .PrevInSection }}
|
||||
<a class="prev-post" href="{{ .Permalink }}">
|
||||
<span class="post-nav-label">Older <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg></span><br><span>{{ .Title }}</span>
|
||||
</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- with .Site.DisqusShortname }}
|
||||
{{ partialCached "disqus.html" . }}
|
||||
{{- end }}
|
||||
</main>
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer" }}
|
||||
{{ partialCached "footer.html" . }}
|
||||
<script>let haveHeader = true;</script>
|
||||
{{ end }}
|
|
@ -0,0 +1,7 @@
|
|||
const throttle=(callback,limit)=>{let timeoutHandler=null;return()=>{if(timeoutHandler==null){timeoutHandler=setTimeout(()=>{callback();timeoutHandler=null;},limit);}};};let lastScrollPosition=window.pageYOffset;let header=document.getElementById('site-header');const autoHideHeader=()=>{let currentScrollPosition=window.pageYOffset;if(currentScrollPosition>lastScrollPosition){header.classList.remove('slideInUp');header.classList.add('slideOutDown');}else{header.classList.remove('slideOutDown');header.classList.add('slideInUp');}
|
||||
lastScrollPosition=currentScrollPosition;}
|
||||
let mobileMenu=document.getElementById('mobile-menu');let mobileMenuVisible=false;const mobileMenuToggle=()=>{if(mobileMenuVisible==false){mobileMenu.style.animationName='bounceInRight';mobileMenu.style.webkitAnimationName='bounceInRight';mobileMenu.style.display='block';mobileMenuVisible=true;}else{mobileMenu.style.animationName='bounceOutRight';mobileMenu.style.webkitAnimationName='bounceOutRight'
|
||||
mobileMenuVisible=false;}}
|
||||
const showFeaturedImg=()=>{document.getElementById('bg-img').classList.add('show-bg-img');}
|
||||
const showContent=()=>{document.getElementById('bg-img').classList.remove('show-bg-img');}
|
||||
if(haveHeader==true){document.getElementById('menu-btn').addEventListener('click',mobileMenuToggle);window.addEventListener('scroll',throttle(()=>{autoHideHeader();if(mobileMenuVisible==true){mobileMenuToggle();}},250));}
|
|
@ -0,0 +1 @@
|
|||
{"Target":"js/main.min.00689ba18bbf9422fda222b02b555f01d54bfbb9b6d02f9bcffad67bdb2ff2cd.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-AGiboYu/lCL9oiKwK1VfAdVL+7m20C+bz/rWe9sv8s0="}}
|
|
@ -0,0 +1 @@
|
|||
{"Target":"css/style.min.4fecf4c2d95f896869e64f36a14369caef0eeb1b4beab0f48c949aa99d18cc07.css","MediaType":"text/css","Data":{"Integrity":"sha256-T+z0wtlfiWhp5k82oUNpyu8O6xtL6rD0jJSaqZ0YzAc="}}
|
BIN
static/android-chrome-192x192.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
static/android-chrome-384x384.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
static/apple-touch-icon.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
9
static/browserconfig.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#00aba9</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
BIN
static/favicon-16x16.png
Normal file
After Width: | Height: | Size: 401 B |
BIN
static/favicon-32x32.png
Normal file
After Width: | Height: | Size: 526 B |
BIN
static/favicon.ico
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
static/mstile-150x150.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
1
static/safari-pinned-tab.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg version="1" xmlns="http://www.w3.org/2000/svg" width="666.667" height="666.667" viewBox="0 0 500.000000 500.000000"><path d="M0 250v250h500V0H0v250zm203.2-55l-.5 43H297v-86h29.9l-.1 107.5V367H297V263h-94v104h-29V152h29.8l-.6 43z"/></svg>
|
After Width: | Height: | Size: 242 B |
19
static/site.webmanifest
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "",
|
||||
"short_name": "",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
18
theme.toml
Normal file
|
@ -0,0 +1,18 @@
|
|||
name = "Hermit"
|
||||
license = "MIT"
|
||||
licenselink = "https://github.com/Track3/hermit/blob/master/LICENSE"
|
||||
description = "A minimal and fast hugo theme for bloggers."
|
||||
homepage = "https://github.com/Track3/hermit"
|
||||
tags = ["blog", "minimal", "dark", "responsive"]
|
||||
features = [
|
||||
"single column",
|
||||
"featured image",
|
||||
"social icons",
|
||||
"google analytics",
|
||||
"disqus"
|
||||
]
|
||||
min_version = 0.43
|
||||
|
||||
[author]
|
||||
name = "Track3"
|
||||
homepage = "https://www.xxxlbox.com"
|