Added files of the theme
20
LICENSE.md
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Joe Hutchinson
|
||||
|
||||
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.
|
160
README.md
@ -1,3 +1,161 @@
|
||||
# blogotheme
|
||||
The theme for my blog, used by the Hugo static website generator. It's based on the design of newspapers, brutalist web design, and inspired by the solar website built by low tech magazine.
|
||||
|
||||
My blog's theme based on aether
|
||||
|
||||
## Features
|
||||
- It's **Fast**! PageSpeed scores consistently between 94-100
|
||||
- Fully **Responsive Design** allowing your site to look good on any size screen
|
||||
- Supports next-gen image format WebP with custom shortcodes
|
||||
- **Accessibility** is a priority, making your site easily navigated by screen readers
|
||||
- Category pages that group similar articles are automatically generated and added to the menu
|
||||
- Customizable website background image and home button image
|
||||
|
||||
## Color palet
|
||||
|
||||
|
||||
## Installation
|
||||
In the root directory of your Hugo Project, clone the repo into the themes directory.
|
||||
|
||||
```shell session
|
||||
git clone TODO themes/blogotheme
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Website Configuration
|
||||
Customize the look and feel of blogotheme through the config.toml file. See how to fill in the config file below.
|
||||
|
||||
```
|
||||
baseURL = "https://yourwebsitenamegoeshere.com/"
|
||||
languageCode = "The language code for the language the website is written in"
|
||||
title = "The website title that is used in each page title, displayed in the browser tab and search results"
|
||||
theme = "blogotheme"
|
||||
googleAnalytics = "Your google analytics tracking ID - optional"
|
||||
disqusShortname = "Your shortname for Disqus - optional"
|
||||
|
||||
[params]
|
||||
brand = "The name that is displayed in the top left of the website, consider it the website name"
|
||||
description = "The website's description"
|
||||
github = "URL to your Github account - link will be included in the footer"
|
||||
linkedin = "URL to your Linkedin account - link will be included in the footer"
|
||||
bgimg = "Path, within the 'assets' folder, of the image used for the page background - optional"
|
||||
rssinmenu = whether you would like a RSS feed link to appear in the navigation menu (true, false) - optional
|
||||
|
||||
[markup]
|
||||
[markup.highlight]
|
||||
style = "igor"
|
||||
```
|
||||
|
||||
The `title` parameter is used for each page title, the title that search engines display in search results. If you would like the title shown in the top left of the page to be different from the page title, use the `brand` parameter. For instance, the title parameter for my site is `Joe Hutchinson` but the brand parameter is set to `joehutch`.
|
||||
|
||||
Find your `language code` [here](https://www.metamodpro.com/browser-language-codes).
|
||||
|
||||
The `bgimg` parameters give you the ability to customize the look of your site further. The homeimg should reside in the assets folder of your site. The homeimg parameter is the image used for the home button at the bottom of every page. Since the text used on the home button is white, a darker background image is preferred. If the homeimg parameter is not specified, a fallback image is used. Aether is designed to look best with a subtle tiling image for the background. If no background image is specified, the background will be a solid gray color.
|
||||
|
||||
The default syntax highlighter `style` does not look great with blogotheme so I recommend using igor. If you want to change the highlighter theme you can specify a different one from [this list](https://xyproto.github.io/splash/docs/all.html). To configure the syntax highlighter further, such as adding line numbers, check out [this Hugo doc section](https://gohugo.io/getting-started/configuration-markup#highlight).
|
||||
|
||||
That is the only configuration required at the site level! You can now begin writing content for your site.
|
||||
|
||||
#### Favicons
|
||||
Aether supports a large array of favicon formats. Simply add your favicons with the correct file names to the root folder of your site (put them in the static folder). The favicon file names correspond to the files generated by the [real favicon generator](https://realfavicongenerator.net/).
|
||||
|
||||
- favicon.ico
|
||||
- favicon-16x16.png
|
||||
- favicon-32x32.png
|
||||
- apple-touch-icon.png
|
||||
- android-chrome-192x192.png
|
||||
- android-chrome-384x384.png
|
||||
- mstile-150x150.png
|
||||
- safari-pinned-tab.svg
|
||||
- browserconfig.xml
|
||||
- site.webmanifest
|
||||
|
||||
### Creating content
|
||||
Make a new blog post by executing `hugo new post/postnamehere/index.md` in your shell. At the top of the new markdown file, is what's called the front matter. The front matter is the page's metadata that determines how Hugo and blogotheme generate the HTML for your post. Below you can find what the front matter that blogotheme uses and what each of the parameters mean.
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: "The title of the post"
|
||||
date: date the post was generated (automatically generated)
|
||||
description: "Description of the post (displayed in the post's card)"
|
||||
categories: ["Add comma separated categories here", "another category"]
|
||||
toc: if the post should include a table of contents (true, false)
|
||||
displayInMenu: if the post should show up in the navigation menu (true, false)
|
||||
displayInList: if the post should be listed on the home page and category pages (true, false)
|
||||
draft: if the post is a draft (true, false)
|
||||
resources:
|
||||
- name: featuredImage
|
||||
src: "Filename of the post's featured image, used as the card image and the image at the top of the article"
|
||||
params:
|
||||
description: "Description for the featured image, used as the alt text"
|
||||
---
|
||||
```
|
||||
|
||||
The `displayInMenu` and `displayInList` parameters are used to determine where your content is displayed. Posts typically have displayInMenu set to false so that the post is not a menu option, and displayInList set to true so it shows up on the homepage's list of posts and in category page lists. An About Me page, on the other hand, would have displayInMenu set to true and displayInList set to false. That will allow the About Me page to be accessible from the menu but not displayed in the homepage's list of posts.
|
||||
|
||||
The `categories` parameter is used to group similar posts in category pages. Category pages are accessible from the menu and list all posts within the same category.
|
||||
|
||||
The `dropCap` parameter is used to determine if the first letter of a post should be a dropped capital. A dropped capital letter is the large decorative letter at the beginning of a book or section.
|
||||
|
||||
Add an interesting description and a good image to each post to get the most value from this theme.
|
||||
|
||||
Aether takes advantage of [page bundles](https://gohugo.io/content-management/page-bundles/) to optimize your images for your site. This may require you to update the way your content is structured, also see [content organization](https://gohugo.io/content-management/organization/). Use the `image` and `smallimg` shortcodes to take full advantage of image optimization. Also, the `featuredImage` resource must exist in the post's page bundle.
|
||||
|
||||
Posts are written in markdown. You can find how to write in markdown from this [markdown cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
|
||||
|
||||
#### Shortcodes
|
||||
Shortcodes extend markdown to make writing easier and more powerful.
|
||||
|
||||
`raw` allows for adding content that Hugo will pass through unmodified. Raw is useful for adding html to your content or **adding math equations in LaTeX**.
|
||||
|
||||
```html
|
||||
{{< raw >}}
|
||||
\[ S(x) = \frac{1}{1+e^{-x}} \]
|
||||
{{< /raw >}}
|
||||
```
|
||||
|
||||
`image` is how you add WebP images to your posts with a fallback in case WebP is not supported. Image just needs the src and alt parameters. WebP is a next-gen image format that was created to make the web fast. To use the image shortcode simply store a WebP image with the same name in the same directory as your normal image. Keep in mind that the Hugo image processing pipeline does not support resizing webp.
|
||||
|
||||
```html
|
||||
<!--- Will display a WebP image on supported browsers if awesome.webp exists -->
|
||||
{{< image src="awesome.jpg" alt="An awesome image that will use webp when possible. Much faster!" >}}
|
||||
```
|
||||
|
||||
`smallimg` allows you to add smaller images to your posts that aren't stretched to be as wide as the content area. Smallimg takes the parameters src, alt, smartfloat (optional), width (optional, in pixels only), and clear (optional). The smartfloat parameter can be set to right or left, and it floats the image to the right or left on big enough screens. The clear parameter allows you to clear a previous float which is helpful if you are using multiple smallimgs close to each other.
|
||||
|
||||
```html
|
||||
<!--- smallimg will also display a WebP image on supported browsers if smile.webp exists -->
|
||||
{{< smallimg src="smile.png" alt="A big beautiful smile" smartfloat="left" width="100px" clear="true" >}}
|
||||
```
|
||||
|
||||
### Further Customization
|
||||
To change the heading and subtext at the top of list pages just add a \_index.md file in the folder that the list page is generated from. For example, to change the heading at the top of the homepage, add an \_index.md file to the content folder with the following parameters.
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: "This is the main heading text in big letters"
|
||||
date: the date
|
||||
description: "This is the subtext below the main heading in smaller letters"
|
||||
---
|
||||
```
|
||||
#### Overriding CSS
|
||||
To override CSS, you should create file `project_root/assets/css/override.css` and place all your CSS inside it. This file will be merged with standard CSS when the site is generated.
|
||||
|
||||
#### Custom Meta Tags
|
||||
|
||||
You can add optional Open Graph, Twitter, or other meta tags by adding `project_root/layouts/partials/meta-tags.html`
|
||||
Refer to [/exampleSite/layouts/partials](/exampleSite/layouts/partials) for sample meta configs.
|
||||
|
||||
## Helpful Links
|
||||
[Aether Blog Post](https://www.joehutch.com/posts/blogotheme-theme/) - See blogotheme in action and learn more about the theme
|
||||
|
||||
[Hugo Documentation](https://gohugo.io/documentation/) - Learn how to use Hugo
|
||||
|
||||
[Markdown Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) - Write in markdown like a pro
|
||||
|
||||
[Latex Math Documentation](https://en.wikibooks.org/wiki/LaTeX/Mathematics) - Learn math typesetting with LaTeX (powered by KaTeX)
|
||||
|
||||
## Contributing
|
||||
I welcome you to help make it better! Contributions in the way of new features, documentation improvements, bug fixes, and feature requests are appreciated. Please make an individual pull-request/issue for each suggestion.
|
||||
|
||||
## License
|
||||
AGPLV - N07070
|
||||
|
9
archetypes/default.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
title: "{{ replace .TranslationBaseName "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
description: ""
|
||||
dropCap: false
|
||||
displayInMenu: false
|
||||
displayInList: true
|
||||
draft: true
|
||||
---
|
16
archetypes/posts.md
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
title: "{{ replace .TranslationBaseName "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
description: ""
|
||||
categories: []
|
||||
toc: false
|
||||
dropCap: true
|
||||
displayInMenu: false
|
||||
displayInList: true
|
||||
draft: true
|
||||
resources:
|
||||
- name: featuredImage
|
||||
src: ""
|
||||
params:
|
||||
description: ""
|
||||
---
|
349
assets/css/normalize.css
vendored
Normal file
@ -0,0 +1,349 @@
|
||||
/*! normalize.css v8.0.1 | 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the `main` element consistently in IE.
|
||||
*/
|
||||
|
||||
main {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
6
assets/css/override.css
Normal file
@ -0,0 +1,6 @@
|
||||
/*
|
||||
* To override CSS, you should create
|
||||
* project_root/assets/css/override.css
|
||||
* and place all your CSS inside it.
|
||||
* You should not modify this file.
|
||||
*/
|
551
assets/css/style.css
Normal file
@ -0,0 +1,551 @@
|
||||
.color-primary-0 { color: #6B6B6B } /* Main Primary color */
|
||||
.color-primary-1 { color: #C9C8C8 }
|
||||
.color-primary-2 { color: #999999 }
|
||||
.color-primary-3 { color: #343434 }
|
||||
.color-primary-4 { color: #040303 }
|
||||
|
||||
.bg-color-0 { background-color: #6B6B6B } /* Main Primary color */
|
||||
.bg-color-1 { background-color: #C9C8C8 }
|
||||
.bg-color-2 { background-color: #999999 }
|
||||
.bg-color-3 { background-color: #343434 }
|
||||
.bg-color-4 { background-color: #040303 }
|
||||
|
||||
/* Generated by Paletton.com © 2002-2014 */
|
||||
/* http://paletton.com */
|
||||
|
||||
body {
|
||||
font-family: Avenir, HelveticaNeue-Light, "Helvetica Neue Light",
|
||||
"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
color: #454545;
|
||||
font-size: 1.1em;
|
||||
/* background: linear-gradient(90deg, #000 21px, transparent 1%) center, linear-gradient(#000 21px, transparent 1%) center, white; */
|
||||
background-size: 22px 22px;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
word-break: break-word;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
p {
|
||||
margin: 1.5em 0;
|
||||
}
|
||||
.home-header {
|
||||
min-height: 26rem;
|
||||
max-width: 50rem;
|
||||
margin: 0 -1.2rem -5rem -1.2rem;
|
||||
padding: 1.2rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
z-index: -1;
|
||||
color: white;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
}
|
||||
.home-faceshot-card {
|
||||
align-self: center;
|
||||
padding: 0.5rem;
|
||||
margin-bottom: 3rem;
|
||||
max-width: 17rem;
|
||||
width: 100%;
|
||||
background-color: white;
|
||||
border-radius: 1.2rem;
|
||||
box-shadow: 0 0.7rem 2.3rem 0 rgba(0,0,0,0.1);
|
||||
}
|
||||
.home-faceshot {
|
||||
margin: 0;
|
||||
border-radius: 0.8rem;
|
||||
}
|
||||
.home-blob-text-container {
|
||||
margin: 2em 0;
|
||||
max-width: 30rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.home-blob-title{
|
||||
font-size: 1.5em;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
.home-blob-text{
|
||||
margin: 0.5em 0 0 0;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
.nav-bar {
|
||||
max-width: 60rem;
|
||||
/* width: 100%; */
|
||||
padding: 0.4em 0;
|
||||
/* display: flex; */
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.nav-header {
|
||||
margin: 0;
|
||||
padding: 0.4em;
|
||||
font-size: 1.4em;
|
||||
}
|
||||
.nav-text {
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
z-index: 105;
|
||||
color: black;
|
||||
font-weight: bolder;
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
|
||||
/* Navigation menu */
|
||||
|
||||
.menu-container {
|
||||
align-content: space-between;
|
||||
}
|
||||
|
||||
#menu {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#menu li{
|
||||
list-style: none;
|
||||
font-weight: bold;
|
||||
display: inline;
|
||||
padding: 0 1em 1em 0;
|
||||
margin-top: 0.4em;
|
||||
display: inline-grid;
|
||||
}
|
||||
|
||||
|
||||
/* #menu ul , li a{
|
||||
color: black;
|
||||
padding: 0 1em;
|
||||
word-break: keep-all;
|
||||
align-content: stretch;
|
||||
text-decoration: none;
|
||||
font-weight: bolder;
|
||||
} */
|
||||
|
||||
|
||||
.post {
|
||||
margin: 0 0 1em 0;
|
||||
line-height: 1.9;
|
||||
}
|
||||
.post-header {
|
||||
margin: 0 0 1.5em 0;
|
||||
}
|
||||
.post-title {
|
||||
font-size: 1.8em;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
margin: 0 0 0.4em 0;
|
||||
font-family: serif;
|
||||
}
|
||||
.post-date {
|
||||
display: block;
|
||||
color: #7a7b7c;
|
||||
font-size: 0.7em;
|
||||
margin: 0;
|
||||
}
|
||||
.post-figure {
|
||||
margin: 1.5em 0;
|
||||
}
|
||||
.dropcase > p:first-of-type::first-letter {
|
||||
float: left;
|
||||
font-size: 3em;
|
||||
line-height: 1;
|
||||
margin: 0.08em 0.15em -0.4em 0;
|
||||
/* initial-letter: 2; Maybe someday*/
|
||||
}
|
||||
.content {
|
||||
background-color: white;
|
||||
padding: 2em 0;
|
||||
margin-bottom: 3rem;
|
||||
margin-top: 1em;
|
||||
width: 100%;
|
||||
max-width: 50rem;
|
||||
/* border-radius: 1.2rem; */
|
||||
z-index: 2;
|
||||
transition: transform 0.2s cubic-bezier(0.25,0.8,0.25,1), box-shadow 0.2s cubic-bezier(0.25,0.8,0.25,1);
|
||||
box-shadow: 0 0.7rem 2.3rem 0 rgba(0,0,0,0.1);
|
||||
}
|
||||
.list-header {
|
||||
margin: 1em;
|
||||
text-align: center;
|
||||
}
|
||||
.list-header-title {
|
||||
margin: 0.1em 0 0.1em 0;
|
||||
font-size: 2em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.list-header-subtext {
|
||||
font-weight: normal;
|
||||
font-size: 1.5em;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
.list-header-content {
|
||||
margin: 5em 0;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
.card-container {
|
||||
max-width: 48rem;
|
||||
}
|
||||
/* .card-container > a:first-of-type {
|
||||
margin-top: 5em;
|
||||
} */
|
||||
.card {
|
||||
display: block;
|
||||
margin: 3rem 0;
|
||||
box-sizing: border-box;
|
||||
background-color: white;
|
||||
text-decoration: none;
|
||||
/* border-radius: 1.2rem; */
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
transition: transform 0.2s cubic-bezier(0.25,0.8,0.25,1), box-shadow 0.2s cubic-bezier(0.25,0.8,0.25,1);
|
||||
box-shadow: 0 0.7rem 2.3rem 0 rgba(0,0,0,0.1);
|
||||
}
|
||||
.home-card {
|
||||
padding: 0.8em;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
color: white;
|
||||
background-position: center center;
|
||||
object-fit: cover;
|
||||
}
|
||||
.blog-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
border-style: solid;
|
||||
}
|
||||
.bc-next {
|
||||
margin-top: 0;
|
||||
}
|
||||
.card-img-container {
|
||||
position: relative;
|
||||
margin: 0.5rem;
|
||||
background-color: grey;
|
||||
}
|
||||
.card-img {
|
||||
/* border-radius: 0.8rem; */
|
||||
margin: 0 0 -0.7em 0;
|
||||
max-height: 10em;
|
||||
object-fit: cover;
|
||||
}
|
||||
.card-img-overlay {
|
||||
/* border-radius: 0.8rem 0.8rem 0 0; */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
font-size: 1.27em;
|
||||
text-align: center;
|
||||
padding: 0.77em 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
color: white;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
z-index: 5;
|
||||
}
|
||||
.card-body {
|
||||
margin: 1.3em 1.5em;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.card-title {
|
||||
margin: 0;
|
||||
color: black;
|
||||
font-size: 1.3em;
|
||||
font-weight: 500;
|
||||
font-family: serif;
|
||||
}
|
||||
.card-text {
|
||||
margin: 1em 0;
|
||||
}
|
||||
.card-subtext {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.card-subtext > p {
|
||||
margin: 0;
|
||||
}
|
||||
.card-subtext > p + p {
|
||||
margin-left: 1em;
|
||||
padding-left: 1em;
|
||||
word-spacing: 0.5em;
|
||||
border-left: thin solid #7a7b7c;
|
||||
}
|
||||
.end-nav {
|
||||
width: 100%;
|
||||
max-width: 48rem;
|
||||
z-index: 2;
|
||||
}
|
||||
.pagination-nav {
|
||||
margin: 2em 0;
|
||||
width: 100%;
|
||||
max-width: 47rem;
|
||||
}
|
||||
/* .pagination-text {
|
||||
font-family: 'LatoLatinWebMedium';
|
||||
} */
|
||||
.pagination-newer {
|
||||
float:left;
|
||||
}
|
||||
.pagination-older {
|
||||
float: right;
|
||||
}
|
||||
.button {
|
||||
padding: 0.5em 0.6em;
|
||||
background-color: #FFF;
|
||||
text-decoration: none;
|
||||
border-radius: 0.3rem;
|
||||
transition: transform 0.1s cubic-bezier(0.25,0.8,0.25,1), box-shadow 0.1s cubic-bezier(0.25,0.8,0.25,1);
|
||||
box-shadow: 0 0.7rem 2.3rem 0 rgba(0,0,0,0.1);
|
||||
}
|
||||
.button:hover {
|
||||
box-shadow: 0 0.05rem 0.15rem rgba(0,0,0,0.12), 0 0.05rem 0.1rem rgba(0,0,0,0.24);
|
||||
transform: scale(0.97);
|
||||
}
|
||||
.button:active {
|
||||
transform: scale(1);
|
||||
}
|
||||
.side-gutter {
|
||||
margin-left: 1.2rem !important;
|
||||
margin-right: 1.2rem !important;
|
||||
}
|
||||
.side-padding {
|
||||
padding-left: 1.2rem !important;
|
||||
padding-right: 1.2rem !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
.side-text-padding {
|
||||
padding-left: 1.2rem !important;
|
||||
padding-right: 1.2rem !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
.small-pic {
|
||||
display: block;
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
.small-img {
|
||||
width: unset;
|
||||
max-width: 100%;
|
||||
margin: 0 auto 1.5em auto;
|
||||
}
|
||||
.muted-text {
|
||||
color: #8E8E8E;
|
||||
}
|
||||
.katex-display {
|
||||
margin: 1.5em 0;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
#disqus_thread {
|
||||
margin-top: 5em;
|
||||
}
|
||||
.no-scroll {
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
}
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin: 1.5em 0 -0.5em 0;
|
||||
clear: both;
|
||||
}
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
margin: 1.5em 0;
|
||||
}
|
||||
blockquote {
|
||||
border-left: 0.3em solid #D1D1D1;
|
||||
margin: 1.5em 0.8em;
|
||||
padding: .5em 0.5em;
|
||||
font-style: italic;
|
||||
}
|
||||
blockquote p {
|
||||
display: inline;
|
||||
}
|
||||
ul,
|
||||
ol {
|
||||
padding-left: 1.6em;
|
||||
}
|
||||
li ul, li ol {
|
||||
padding-left: 1em;
|
||||
}
|
||||
li > p {
|
||||
margin: 0;
|
||||
}
|
||||
code {
|
||||
font-size: 1.1rem;
|
||||
font-family: monospace;
|
||||
padding: .2em .5em;
|
||||
line-height: 1.5;
|
||||
border-radius: 0.3rem;
|
||||
background-color: #f5f6f7;
|
||||
}
|
||||
pre > code {
|
||||
margin: 1.5em 0;
|
||||
display: block;
|
||||
padding: 0.5em;
|
||||
word-break: normal;
|
||||
overflow-x: auto;
|
||||
color: black;
|
||||
}
|
||||
.highlight > pre {
|
||||
background-color: unset !important;
|
||||
}
|
||||
hr {
|
||||
border: 0;
|
||||
border-bottom: thin solid #D1D1D1;
|
||||
margin: 3em 0;
|
||||
clear: both;
|
||||
}
|
||||
a {
|
||||
color: #454545;
|
||||
}
|
||||
table {
|
||||
color: #141823;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
margin: 1.5em 0;
|
||||
}
|
||||
td,
|
||||
th {
|
||||
padding: 0.5em 1em;
|
||||
border: thin solid #D1D1D1
|
||||
}
|
||||
/* th {
|
||||
font-family: 'LatoLatinWebHeavy';
|
||||
font-weight: normal;
|
||||
} */
|
||||
tr:nth-child(even) td {
|
||||
background: #f5f6f7;
|
||||
}
|
||||
footer {
|
||||
height: 17rem;
|
||||
max-width: 50rem;
|
||||
width: 100%;
|
||||
margin-top: -10rem;
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
justify-content: space-evenly;
|
||||
align-items: flex-end;
|
||||
color: white;
|
||||
background-position: 40% 0%;
|
||||
background-size: 50rem;
|
||||
}
|
||||
.footer-link {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
.footer-icon {
|
||||
max-width: 3.2rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Medium devices (tablets, ~641px and up) */
|
||||
@media only screen and (min-width: 40.063em) {
|
||||
body {
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
.home-header {
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.home-blob-text-container {
|
||||
margin: 4rem 2rem 4rem 6rem;
|
||||
flex-shrink: 10;
|
||||
}
|
||||
.home-faceshot-card {
|
||||
align-self: unset;
|
||||
}
|
||||
.nav-bar {
|
||||
padding: 0.8em 0;
|
||||
background-color: white;
|
||||
z-index: auto;
|
||||
}
|
||||
|
||||
.nav-header {
|
||||
margin: 0;
|
||||
font-size: 1.4em;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.nav-text {
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
z-index: 105;
|
||||
color: black;
|
||||
font-weight: bolder;
|
||||
font-size: 3rem;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
/* #menu ul , li{
|
||||
padding: 0.4em 1em;
|
||||
list-style: none;
|
||||
font-weight: bold;
|
||||
padding-left: 4em;
|
||||
} */
|
||||
|
||||
.list-header-title {
|
||||
font-weight: normal;
|
||||
font-size: 4.2em;
|
||||
}
|
||||
.blog-card {
|
||||
flex-direction: row;
|
||||
align-items: stretch;
|
||||
}
|
||||
.card-img {
|
||||
margin: 0;
|
||||
max-height: unset;
|
||||
height: 100%;
|
||||
width: 16em;
|
||||
}
|
||||
.card-img-overlay {
|
||||
border-radius: 0.8rem 0.8rem 0 0;
|
||||
}
|
||||
.card-body {
|
||||
margin: 1.3em 1.7em;
|
||||
}
|
||||
.card-title {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
.card-text {
|
||||
font-size: 0.9em;
|
||||
margin: 0.8em 0 1.2em 0;
|
||||
}
|
||||
.card-subtext {
|
||||
font-size: 0.7em;
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
.content {
|
||||
/* border-radius: 1.2rem; */
|
||||
}
|
||||
.post {
|
||||
margin: 1em 1.8em 2em 1.8em;
|
||||
}
|
||||
.post-title {
|
||||
font-size: 2em;
|
||||
}
|
||||
.button {
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
.smartfloat-right {
|
||||
float: right;
|
||||
margin: 0 0 1.5em 1.5em;
|
||||
}
|
||||
.smartfloat-left {
|
||||
float: left;
|
||||
margin: 0 1.5em 1.5em 0;
|
||||
}
|
||||
code {
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
}
|
350
assets/js/auto-render.js
Normal file
@ -0,0 +1,350 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory(require("katex"));
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define(["katex"], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["renderMathInElement"] = factory(require("katex"));
|
||||
else
|
||||
root["renderMathInElement"] = factory(root["katex"]);
|
||||
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) {
|
||||
return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 1);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXTERNAL MODULE: external "katex"
|
||||
var external_katex_ = __webpack_require__(0);
|
||||
var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
|
||||
|
||||
// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
|
||||
/* eslint no-constant-condition:0 */
|
||||
var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
|
||||
// Adapted from
|
||||
// https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
|
||||
var index = startIndex;
|
||||
var braceLevel = 0;
|
||||
var delimLength = delimiter.length;
|
||||
|
||||
while (index < text.length) {
|
||||
var character = text[index];
|
||||
|
||||
if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
|
||||
return index;
|
||||
} else if (character === "\\") {
|
||||
index++;
|
||||
} else if (character === "{") {
|
||||
braceLevel++;
|
||||
} else if (character === "}") {
|
||||
braceLevel--;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
var splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) {
|
||||
var finalData = [];
|
||||
|
||||
for (var i = 0; i < startData.length; i++) {
|
||||
if (startData[i].type === "text") {
|
||||
var text = startData[i].data;
|
||||
var lookingForLeft = true;
|
||||
var currIndex = 0;
|
||||
var nextIndex = void 0;
|
||||
nextIndex = text.indexOf(leftDelim);
|
||||
|
||||
if (nextIndex !== -1) {
|
||||
currIndex = nextIndex;
|
||||
finalData.push({
|
||||
type: "text",
|
||||
data: text.slice(0, currIndex)
|
||||
});
|
||||
lookingForLeft = false;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (lookingForLeft) {
|
||||
nextIndex = text.indexOf(leftDelim, currIndex);
|
||||
|
||||
if (nextIndex === -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
finalData.push({
|
||||
type: "text",
|
||||
data: text.slice(currIndex, nextIndex)
|
||||
});
|
||||
currIndex = nextIndex;
|
||||
} else {
|
||||
nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length);
|
||||
|
||||
if (nextIndex === -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
finalData.push({
|
||||
type: "math",
|
||||
data: text.slice(currIndex + leftDelim.length, nextIndex),
|
||||
rawData: text.slice(currIndex, nextIndex + rightDelim.length),
|
||||
display: display
|
||||
});
|
||||
currIndex = nextIndex + rightDelim.length;
|
||||
}
|
||||
|
||||
lookingForLeft = !lookingForLeft;
|
||||
}
|
||||
|
||||
finalData.push({
|
||||
type: "text",
|
||||
data: text.slice(currIndex)
|
||||
});
|
||||
} else {
|
||||
finalData.push(startData[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return finalData;
|
||||
};
|
||||
|
||||
/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters);
|
||||
// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js
|
||||
/* eslint no-console:0 */
|
||||
|
||||
|
||||
|
||||
var auto_render_splitWithDelimiters = function splitWithDelimiters(text, delimiters) {
|
||||
var data = [{
|
||||
type: "text",
|
||||
data: text
|
||||
}];
|
||||
|
||||
for (var i = 0; i < delimiters.length; i++) {
|
||||
var delimiter = delimiters[i];
|
||||
data = auto_render_splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false);
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
/* Note: optionsCopy is mutated by this method. If it is ever exposed in the
|
||||
* API, we should copy it before mutating.
|
||||
*/
|
||||
|
||||
|
||||
var auto_render_renderMathInText = function renderMathInText(text, optionsCopy) {
|
||||
var data = auto_render_splitWithDelimiters(text, optionsCopy.delimiters);
|
||||
|
||||
if (data.length === 1 && data[0].type === 'text') {
|
||||
// There is no formula in the text.
|
||||
// Let's return null which means there is no need to replace
|
||||
// the current text node with a new one.
|
||||
return null;
|
||||
}
|
||||
|
||||
var fragment = document.createDocumentFragment();
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data[i].type === "text") {
|
||||
fragment.appendChild(document.createTextNode(data[i].data));
|
||||
} else {
|
||||
var span = document.createElement("span");
|
||||
var math = data[i].data; // Override any display mode defined in the settings with that
|
||||
// defined by the text itself
|
||||
|
||||
optionsCopy.displayMode = data[i].display;
|
||||
|
||||
try {
|
||||
if (optionsCopy.preProcess) {
|
||||
math = optionsCopy.preProcess(math);
|
||||
}
|
||||
|
||||
external_katex_default.a.render(math, span, optionsCopy);
|
||||
} catch (e) {
|
||||
if (!(e instanceof external_katex_default.a.ParseError)) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
|
||||
fragment.appendChild(document.createTextNode(data[i].rawData));
|
||||
continue;
|
||||
}
|
||||
|
||||
fragment.appendChild(span);
|
||||
}
|
||||
}
|
||||
|
||||
return fragment;
|
||||
};
|
||||
|
||||
var renderElem = function renderElem(elem, optionsCopy) {
|
||||
for (var i = 0; i < elem.childNodes.length; i++) {
|
||||
var childNode = elem.childNodes[i];
|
||||
|
||||
if (childNode.nodeType === 3) {
|
||||
// Text node
|
||||
var frag = auto_render_renderMathInText(childNode.textContent, optionsCopy);
|
||||
|
||||
if (frag) {
|
||||
i += frag.childNodes.length - 1;
|
||||
elem.replaceChild(frag, childNode);
|
||||
}
|
||||
} else if (childNode.nodeType === 1) {
|
||||
(function () {
|
||||
// Element node
|
||||
var className = ' ' + childNode.className + ' ';
|
||||
var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) {
|
||||
return className.indexOf(' ' + x + ' ') === -1;
|
||||
});
|
||||
|
||||
if (shouldRender) {
|
||||
renderElem(childNode, optionsCopy);
|
||||
}
|
||||
})();
|
||||
} // Otherwise, it's something else, and ignore it.
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var renderMathInElement = function renderMathInElement(elem, options) {
|
||||
if (!elem) {
|
||||
throw new Error("No element provided to render");
|
||||
}
|
||||
|
||||
var optionsCopy = {}; // Object.assign(optionsCopy, option)
|
||||
|
||||
for (var option in options) {
|
||||
if (options.hasOwnProperty(option)) {
|
||||
optionsCopy[option] = options[option];
|
||||
}
|
||||
} // default options
|
||||
|
||||
|
||||
optionsCopy.delimiters = optionsCopy.delimiters || [{
|
||||
left: "$$",
|
||||
right: "$$",
|
||||
display: true
|
||||
}, {
|
||||
left: "\\(",
|
||||
right: "\\)",
|
||||
display: false
|
||||
}, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
|
||||
// {left: "$", right: "$", display: false},
|
||||
// \[…\] must come last in this array. Otherwise, renderMathInElement
|
||||
// will search for \[ before it searches for $$ or \(
|
||||
// That makes it susceptible to finding a \\[0.3em] row delimiter and
|
||||
// treating it as if it were the start of a KaTeX math zone.
|
||||
{
|
||||
left: "\\[",
|
||||
right: "\\]",
|
||||
display: true
|
||||
}];
|
||||
optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"];
|
||||
optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
|
||||
optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different
|
||||
// math elements within a single call to `renderMathInElement`.
|
||||
|
||||
optionsCopy.macros = optionsCopy.macros || {};
|
||||
renderElem(elem, optionsCopy);
|
||||
};
|
||||
|
||||
/* harmony default export */ var auto_render = __webpack_exports__["default"] = (renderMathInElement);
|
||||
|
||||
/***/ })
|
||||
/******/ ])["default"];
|
||||
});
|
0
assets/js/core.js
Normal file
BIN
exampleSite/assets/img/faceshot.jpg
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
exampleSite/assets/img/ignasi_pattern_s.png
Normal file
After Width: | Height: | Size: 29 KiB |
16
exampleSite/config.toml
Normal file
@ -0,0 +1,16 @@
|
||||
baseurl = "https://example.com"
|
||||
title = "Hugo Themes - aether"
|
||||
author = "Joe Hutchinson"
|
||||
canonifyurls = true
|
||||
paginate = 3
|
||||
theme = "aether"
|
||||
themesDir = "../../"
|
||||
|
||||
[params]
|
||||
brand = "aether"
|
||||
description = "aether Hugo theme for blogs"
|
||||
headshotimg = "img/faceshot.jpg"
|
||||
|
||||
[markup]
|
||||
[markup.highlight]
|
||||
style = "igor"
|
5
exampleSite/content/_index.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "aether"
|
||||
date: 2018-04-27T09:46:15-04:00
|
||||
description: "A clean Hugo theme for blogs emphasizing motion, material, and depth."
|
||||
---
|
20
exampleSite/content/about/index.md
Normal file
@ -0,0 +1,20 @@
|
||||
+++
|
||||
title = "About Hugo"
|
||||
date = "2014-04-09"
|
||||
displayInMenu = true
|
||||
displayInList = false
|
||||
dropCap = false
|
||||
+++
|
||||
|
||||
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).
|
||||
|
135
exampleSite/content/posts/aether-features/index.md
Normal file
@ -0,0 +1,135 @@
|
||||
---
|
||||
title: "Aether Features"
|
||||
date: 2018-12-19T10:35:35-05:00
|
||||
description: "Hugo combined with the Aether theme turns easy to write markdown into powerful web pages. KaTeX, Highlight.js, and Hugo provides the ability to create mathmatical symobols, equations, highlighted code, tables, lists, and much more."
|
||||
categories: ["Features"]
|
||||
dropCap: true
|
||||
displayInMenu: false
|
||||
displayInList: true
|
||||
draft: false
|
||||
resources:
|
||||
- name: featuredImage
|
||||
src: "mdd-iphone.jpg"
|
||||
---
|
||||
|
||||
Hugo combined with the Aether theme turns easy to write markdown into powerful web pages. KaTeX, Highlight.js, and Hugo provides the ability to create mathmatical symobols, equations, highlighted code, tables, lists, and much more.
|
||||
|
||||
For each feature below, the first line is the markdown and the second line is the result after Hugo, KaTeX, and Highlight.js process the markdown. You can find many more features in the Hugo documentation.
|
||||
|
||||
## LaTeX style math typsetting with KaTeX
|
||||
|
||||
```md
|
||||
{{</* raw */>}}
|
||||
\[u(t) = K_p e(t) + K_i \int_{0}^{t} e(\tau) d\tau + K_d \frac{de(t)}{dt} \]
|
||||
{{</* /raw */>}}
|
||||
```
|
||||
|
||||
{{< raw >}}
|
||||
\[u(t) = K_p e(t) + K_i \int_{0}^{t} e(\tau) d\tau + K_d \frac{de(t)}{dt} \]
|
||||
{{< /raw >}}
|
||||
|
||||
## Code (Supports many programming languages and formats)
|
||||
|
||||
````md
|
||||
```javascript
|
||||
var s = "JavaScript syntax highlighting";
|
||||
alert(s);
|
||||
```
|
||||
````
|
||||
|
||||
```javascript
|
||||
var s = "JavaScript syntax highlighting";
|
||||
alert(s);
|
||||
```
|
||||
|
||||
## Inline code
|
||||
|
||||
```md
|
||||
Here is `var s = "Hello World"` inline code
|
||||
```
|
||||
|
||||
Here is `var s = "Hello World"` inline code
|
||||
|
||||
## Tables
|
||||
|
||||
```md
|
||||
| Tables | Are | Cool |
|
||||
| ------------- |:-------------:| -----:|
|
||||
| col 3 is | right-aligned | $1600 |
|
||||
| col 2 is | centered | $12 |
|
||||
| zebra stripes | are neat | $1 |
|
||||
```
|
||||
|
||||
| Tables | Are | Cool |
|
||||
| ------------- |:-------------:| -----:|
|
||||
| col 3 is | right-aligned | $1600 |
|
||||
| col 2 is | centered | $12 |
|
||||
| zebra stripes | are neat | $1 |
|
||||
|
||||
## Ordered List
|
||||
|
||||
```md
|
||||
1. Number one
|
||||
2. Number Two
|
||||
1. Indented Number 1
|
||||
2. Indented Number 2
|
||||
```
|
||||
|
||||
1. Number one
|
||||
2. Number Two
|
||||
1. Indented Number 1
|
||||
2. Indented Number 2
|
||||
|
||||
## Unordered List
|
||||
|
||||
```md
|
||||
* Get groceries at Harris Teeter before the party
|
||||
* Get a Spider Man cake
|
||||
* Chocolate or marble
|
||||
* Whipped cream frosting
|
||||
* Don't forget to walk the dog before you leave
|
||||
* Bring lots of plates and silverware so that we don't run out
|
||||
* Plastic Dixie brand is fine
|
||||
```
|
||||
|
||||
* Get groceries at Harris Teeter before the party
|
||||
* Get a Spider Man cake
|
||||
* Chocolate or marble
|
||||
* Whipped cream frosting
|
||||
* Don't forget to walk the dog before you leave
|
||||
* Bring lots of plates and silverware so that we don't run out
|
||||
* Plastic Dixie brand is fine
|
||||
|
||||
## Comments
|
||||
|
||||
```md
|
||||
> This is some text that should show up as a comment. Someone may have made this comment but i'm not sure.
|
||||
```
|
||||
|
||||
> This is some text that should show up as a comment. Someone may have made this comment but i'm not sure.
|
||||
|
||||
## Images
|
||||
|
||||
```md
|
||||
![NYC Skyline](/post/aether-features/mdd-iphone.jpg)
|
||||
```
|
||||
|
||||
![NYC Skyline](/post/aether-features/mdd-iphone.jpg)
|
||||
|
||||
## Small Images
|
||||
|
||||
```md
|
||||
{{</* smallimg src="featuredImage" alt="NYC Skyline" smartfloat="left" width="250px" */>}}
|
||||
```
|
||||
|
||||
{{<smallimg src="featuredImage" alt="aether theme displayed on an iPhone" smartfloat="left" width="250px">}}
|
||||
|
||||
This image floats to the left of this paragraph and is 250px wide. Its aspect ratio is maintained so it will not stretch. The picture shows the New York skyline. You can see how the design is responsive and how the cards intelligently fit to the display. With flexbox and css grid, heavy frameworks such as bootstrap aren't necessary to create beautiful responsive designs. The cards in aether use flexbox to change the image from the right side on desktops to the top on mobile.
|
||||
|
||||
## Links
|
||||
|
||||
```md
|
||||
[Aether's Github page](https://github.com/josephhutch/aether)
|
||||
```
|
||||
|
||||
[Aether's Github page](https://github.com/josephhutch/aether)
|
BIN
exampleSite/content/posts/aether-features/mdd-iphone.jpg
Normal file
After Width: | Height: | Size: 778 KiB |
97
exampleSite/content/posts/aether-theme/index.md
Normal file
@ -0,0 +1,97 @@
|
||||
---
|
||||
title: "Aether: A Clean Theme for Hugo"
|
||||
date: 2018-05-02T14:33:42-04:00
|
||||
description: " Aether is new theme for Hugo that emphasizes motion, material, and depth as design elements. Distracting styling and page elements are forgone to focus on the content."
|
||||
categories: ["Web"]
|
||||
dropCap: true
|
||||
displayInMenu: false
|
||||
displayInList: true
|
||||
draft: false
|
||||
resources:
|
||||
- name: featuredImage
|
||||
src: "mdd-macbook.jpg"
|
||||
params:
|
||||
description: "A MacBook showing a website using the aether theme"
|
||||
---
|
||||
|
||||
Today's web is a frustrating mess of pop-ups, intrusive banners, and ads obstructing the content. I designed aether to be free of all these distractions and simply highlight the content. The result feels more like a native application than a website. Interactions are intuitive, content is the focus, and distractions are omitted.
|
||||
|
||||
Aether is a Hugo theme for blogs that elevates good writing and photography. If you use Hugo for your blog, give aether a try.
|
||||
|
||||
## Installation
|
||||
In the root directory of your Hugo Project, clone the aether repo into the themes directory.
|
||||
|
||||
```shell session
|
||||
git clone https://github.com/josephhutch/aether.git themes/aether
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Website Configuration
|
||||
|
||||
Add the following parameters to your config file if they are not present already.
|
||||
|
||||
```toml
|
||||
baseURL = "https://yourwebsitenamegoeshere.com"
|
||||
languageCode = "your language code"
|
||||
title = "your website title"
|
||||
theme = "aether"
|
||||
googleAnalytics = "Your google analytics tracking ID"
|
||||
|
||||
[params]
|
||||
brand = "the title displayed in the nav bar - optional"
|
||||
description = "your website's description"
|
||||
homeimg = "url to the image used for the home button - optional"
|
||||
bgimg = "url to the image used for the background - optional"
|
||||
```
|
||||
|
||||
The `title` parameter is used for each page title, the title that search engines display in search results. If you would like the title shown in the top left of the page to be different from the page title, use the `brand` parameter. For instance, the title parameter for my site is `Joe Hutchinson` but the brand parameter is set to `joehutch`.
|
||||
|
||||
The `homeimg` and `bgimg` parameters give you the ability to customize the look of your site further. The homeimg parameter is the image used for the home button at the bottom of every page. Since the text used on the home button is white, a darker background image is preferred. If the homeimg parameter is not specified, a fallback image is used. Similarly, the bgimg parameter is used for the background of each webpage. Aether is designed to look best with a subtle tiling image for the background. If no background image is specified, the background will be a solid gray color.
|
||||
|
||||
That is the only configuration required at the site level! You can now begin writing content for your site.
|
||||
|
||||
### Creating content
|
||||
Make a new blog post by executing `hugo new posts/postnamehere/index.md` in your shell. At the top of the new markdown file, is what's called the front matter. The front matter is the page's metadata that determines how Hugo and aether generate the HTML for your post. Below you can find what the front matter should contain for a new post and what each of the parameters mean.
|
||||
|
||||
```properties
|
||||
---
|
||||
title: "The title of your post"
|
||||
date: date the post was generated
|
||||
description: "Description of the post (displayed in the post's card)"
|
||||
categories: ["add comma separated categories here", "another category"]
|
||||
featuredImage: "url to the page's featured image"
|
||||
featuredImageDescription: "Description for the featured image, used as the alt text"
|
||||
dropCap: if the first letter should be a large decorative capital letter (true, false)
|
||||
displayInMenu: if post is listed in the navigation menu (true, false)
|
||||
displayInList: if post is listed on the home page and category pages (true, false)
|
||||
draft: if the page is a draft (true, false)
|
||||
---
|
||||
```
|
||||
|
||||
The `displayInMenu` and `displayInList` parameters are used to determine where your content is displayed. Posts typically have displayInMenu set to false so that the post is not a menu option, and displayInList set to true so it shows up on the homepage's list of posts and in category page lists. An About Me page, on the other hand, would have displayInMenu set to true and displayInList set to false. That will allow the About Me page to be accessible from the menu but not displayed in the homepage's list of posts.
|
||||
|
||||
The `categories` parameter is used to group similar posts in category pages. Category pages are accessible from the menu and list all posts with the same category.
|
||||
|
||||
The `dropCap` parameter is used to determine if the first letter of a post should be a dropped capital. A dropped capital letter is the large decorative letter at the beginning of a book or section.
|
||||
|
||||
Add an interesting description and a good image to each post to get the most value from this theme.
|
||||
|
||||
Aether takes advantage of [page bundles](https://gohugo.io/content-management/page-bundles/) to optimize your images for your site. This may require you to update the way your content is structured, also see [content organization](https://gohugo.io/content-management/organization/). Use the `image` and `smallimg` shortcodes to take full advantage of image optimization.
|
||||
|
||||
Posts are written in markdown and LaTeX (for math symbols and equations). You can find tons of information on how to format your posts with markdown and LaTeX on the web.
|
||||
|
||||
### Further Customization
|
||||
To change the heading and subtext at the top of list pages just add a \_index.md file in the folder that the list page is generated from. For example to change the heading at the top of the homepage, add an \_index.md file to the content folder with the following parameters.
|
||||
|
||||
```properties
|
||||
---
|
||||
title: "This is the main heading text in big letters"
|
||||
date: the date
|
||||
description: "This is the subtext above the main heading in small letters"
|
||||
---
|
||||
```
|
||||
|
||||
### Learn More
|
||||
|
||||
To learn more about aether, visit [aether's Github page](https://github.com/josephhutch/aether). To learn more about Hugo, visit [Hugo's website](https://gohugo.io/).
|
BIN
exampleSite/content/posts/aether-theme/mdd-macbook.jpg
Normal file
After Width: | Height: | Size: 551 KiB |
1150
exampleSite/content/posts/creating-a-new-theme/index.md
Normal file
BIN
exampleSite/content/posts/creating-a-new-theme/nyc.jpg
Normal file
After Width: | Height: | Size: 261 KiB |
350
exampleSite/content/posts/goisforlovers/index.md
Normal file
@ -0,0 +1,350 @@
|
||||
+++
|
||||
title = "(Hu)go Template Primer"
|
||||
displayInMenu = false
|
||||
displayInList = true
|
||||
draft = false
|
||||
tags = [
|
||||
"go",
|
||||
"golang",
|
||||
"templates",
|
||||
"themes",
|
||||
"development",
|
||||
]
|
||||
date = "2014-04-02"
|
||||
categories = [
|
||||
"Development",
|
||||
"golang",
|
||||
]
|
||||
[[resources]]
|
||||
name = "featuredImage"
|
||||
src = "lucas-benjamin-565254-unsplash.jpg"
|
||||
[resources.params]
|
||||
description = "Alt description for the featured image"
|
||||
+++
|
||||
|
||||
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/
|
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 95 KiB |
94
exampleSite/content/posts/hugoisforlovers/index.md
Normal file
@ -0,0 +1,94 @@
|
||||
+++
|
||||
title = "Getting Started with Hugo"
|
||||
featuredImage = "img/andrew-neel-609846-unsplash.jpg"
|
||||
displayInMenu = false
|
||||
displayInList = true
|
||||
draft = false
|
||||
tags = [
|
||||
"go",
|
||||
"golang",
|
||||
"hugo",
|
||||
"development",
|
||||
]
|
||||
date = "2014-04-02"
|
||||
categories = [
|
||||
"Development",
|
||||
"golang",
|
||||
]
|
||||
[[resources]]
|
||||
name = "featuredImage"
|
||||
src = "andrew-neel-609846-unsplash.jpg"
|
||||
+++
|
||||
|
||||
## 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.
|
156
exampleSite/content/posts/migrate-from-jekyll/index.md
Normal file
@ -0,0 +1,156 @@
|
||||
---
|
||||
date: 2014-03-10
|
||||
displayInMenu: false
|
||||
displayInList: true
|
||||
draft: false
|
||||
title: Migrate to Hugo from Jekyll
|
||||
resources:
|
||||
- name: featuredImage
|
||||
src: "yan-ots-257617-unsplash.jpg"
|
||||
---
|
||||
|
||||
## 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).
|
After Width: | Height: | Size: 126 KiB |
13
exampleSite/layouts/partials/meta-tags.html
Normal file
@ -0,0 +1,13 @@
|
||||
<meta property="og:locale" content="{{ .Site.Language.Lang }}">
|
||||
<meta property="og:type" content="{{ if .IsHome }}website{{ else }}article{{ end }}">
|
||||
<meta property="og:title" content="{{ .Site.Params.Brand }}">
|
||||
<meta property="og:description" content="{{ .Site.Params.description }}">
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
<meta property="og:site_name" content="{{ .Site.Params.Brand }}">
|
||||
<meta property="og:image" content="{{ .Site.Params.metaImage | absURL }}">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:title" content="{{ .Site.Params.Brand }}">
|
||||
<meta name="twitter:description" content="{{ .Site.Params.description }}">
|
||||
<meta name="twitter:site" content="{{ .Site.BaseURL }}">
|
||||
<meta name="twitter:creator" content="{{ .Site.Params.metaCreator }}">
|
||||
<meta name="twitter:image" content="{{ .Site.Params.metaImage | absURL }}">
|
0
exampleSite/static/.gitignore
vendored
Normal file
BIN
images/screenshot.png
Normal file
After Width: | Height: | Size: 476 KiB |
BIN
images/tn.png
Normal file
After Width: | Height: | Size: 206 KiB |
0
layouts/404.html
Normal file
33
layouts/_default/home.html
Normal file
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.LanguageCode }}" dir="ltr">
|
||||
{{ partial "head.html" . }}
|
||||
<body class="list-body">
|
||||
|
||||
<main class="card-container side-gutter">
|
||||
{{ partial "nav-bar.html" . }}
|
||||
|
||||
{{ if or (not (eq .Description "")) (not (eq .Title "")) -}}
|
||||
{{- end }}
|
||||
{{ with .Content -}}
|
||||
<section class="list-header-content">
|
||||
{{ . }}
|
||||
</section>
|
||||
{{- end }}
|
||||
{{ $pages := .Pages }}
|
||||
{{ if .IsHome }}
|
||||
{{ $pages = .Site.RegularPages }}
|
||||
{{ end }}
|
||||
{{ $paginator := .Paginate (where $pages "Params.displayinlist" "!=" false) -}}
|
||||
{{- range $paginator.Pages -}}
|
||||
{{ .Render "li" }}
|
||||
{{- end }}
|
||||
</main>
|
||||
{{ if or ($paginator.HasPrev) ($paginator.HasNext) -}}
|
||||
<nav class="pagination-nav side-padding">
|
||||
{{ if $paginator.HasPrev }}<a href="{{ $paginator.Prev.URL }}" class="pagination-newer pagination-text">< Newer Posts</a>{{ end }}
|
||||
{{ if $paginator.HasNext }}<a href="{{ $paginator.Next.URL }}" class="pagination-older pagination-text">Older Posts ></a>{{ end }}
|
||||
</nav>
|
||||
{{- end }}
|
||||
{{ partial "scripts.html" . }}
|
||||
</body>
|
||||
</html>
|
34
layouts/_default/li-next.html
Normal file
@ -0,0 +1,34 @@
|
||||
<a href="{{ .Permalink }}" class="card blog-card bc-next bg-color-4" rel="bookmark" >
|
||||
<div class="card-img-container">
|
||||
{{ with .Resources.GetMatch "featuredImage" }}
|
||||
<p class="card-img-overlay">Next Article</p>
|
||||
<picture>
|
||||
{{ with $.Resources.GetMatch (replace (.Title) (path.Ext (.Title)) ".webp") -}}
|
||||
<source srcset="{{ .Permalink }}" type="image/webp">
|
||||
{{- end }}
|
||||
<source srcset="{{ .Permalink }}">
|
||||
<img src="{{ .Permalink }}" class="card-img" {{ with .Params.description -}} alt="{{ . }}" {{- end }}>
|
||||
</picture>
|
||||
{{ end }}
|
||||
</div>
|
||||
<article class="card-body">
|
||||
<h2 class="card-title">{{ .Title }}</h2>
|
||||
<p class="card-text">{{ if (isset .Params "description") }}{{ index .Params "description" | htmlUnescape }}{{ else }}{{ .Summary | plainify | htmlUnescape }}{{ end }}</p>
|
||||
<div class="card-subtext muted-text">
|
||||
<p>
|
||||
Posted <time datetime="{{ .PublishDate.Format "2006-01-02 12:00" }}">{{ .PublishDate.Format "Jan 2, 2006" }}</time>
|
||||
</p>
|
||||
|
||||
{{ if (isset .Params "categories") }}
|
||||
<p>
|
||||
{{ range .Params.categories }}#{{ . }} {{ end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
|
||||
<p class="card-subtext muted-text">This is the next article in the same categorie</p>
|
||||
|
||||
|
||||
</article>
|
||||
</a>
|
23
layouts/_default/li.html
Normal file
@ -0,0 +1,23 @@
|
||||
<a
|
||||
href="{{ .Permalink }}" class="card blog-card" rel="bookmark" >
|
||||
<div class="card-img-container">
|
||||
{{ with .Resources.GetMatch "featuredImage" }}
|
||||
<picture>
|
||||
{{ with $.Resources.GetMatch (replace (.Title) (path.Ext (.Title)) ".webp") -}}
|
||||
<source srcset="{{ .Permalink }}" type="image/webp">
|
||||
{{- end }}
|
||||
{{ $thumbnail := .Fit "800x600 Lanczos" }}
|
||||
<source srcset="{{ $thumbnail.Permalink }}">
|
||||
<img src="{{ $thumbnail.Permalink }}" class="card-img" {{ with .Params.description -}} alt="{{ . }}" {{- end }}>
|
||||
</picture>
|
||||
{{- end }}
|
||||
</div>
|
||||
<article class="card-body">
|
||||
<h2 class="card-title">{{ .Title }}</h2>
|
||||
<p class="card-text">{{ if (isset .Params "description") }}{{ index .Params "description" | htmlUnescape }}{{ else }}{{ .Summary | plainify | htmlUnescape }}{{ end }}</p>
|
||||
<div class="card-subtext muted-text">
|
||||
<p>Posted <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "Jan 2, 2006" }}</time></p>
|
||||
{{ if (isset .Params "categories") }}<p>{{ range .Params.categories }}#{{ . | urlize | title }} {{ end }}</p>{{ end }}
|
||||
</div>
|
||||
</article>
|
||||
</a>
|
35
layouts/_default/list.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.LanguageCode }}" dir="ltr">
|
||||
{{ partial "head.html" . }}
|
||||
<body class="list-body">
|
||||
{{ partial "nav-bar.html" . }}
|
||||
<main class="card-container side-gutter">
|
||||
{{ if or (not (eq .Description "")) (not (eq .Title "")) -}}
|
||||
<!-- <header class="list-header">
|
||||
{{ with .Title }}<h1 class="list-header-title">{{ . }}</h1>{{ end }}
|
||||
{{ with .Description }}<p class="list-header-subtext">{{ . }}</p>{{ end }}
|
||||
</header> -->
|
||||
{{- end }}
|
||||
{{ with .Content -}}
|
||||
<section class="list-header-content">
|
||||
{{ . }}
|
||||
</section>
|
||||
{{- end }}
|
||||
{{ $pages := .Pages }}
|
||||
{{ if .IsHome }}
|
||||
{{ $pages = .Site.RegularPages }}
|
||||
{{ end }}
|
||||
{{ $paginator := .Paginate (where $pages "Params.displayinlist" "!=" false) -}}
|
||||
{{- range $paginator.Pages -}}
|
||||
{{ .Render "li" }}
|
||||
{{- end }}
|
||||
</main>
|
||||
{{ if or ($paginator.HasPrev) ($paginator.HasNext) -}}
|
||||
<nav class="pagination-nav side-padding">
|
||||
{{ if $paginator.HasPrev }}<a href="{{ $paginator.Prev.URL }}" class="pagination-newer pagination-text">< Newer Posts</a>{{ end }}
|
||||
{{ if $paginator.HasNext }}<a href="{{ $paginator.Next.URL }}" class="pagination-older pagination-text">Older Posts ></a>{{ end }}
|
||||
</nav>
|
||||
{{- end }}
|
||||
{{ partial "scripts.html" . }}
|
||||
</body>
|
||||
</html>
|
27
layouts/_default/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 }}{{.}} - {{ 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 }}
|
||||
{{ $paginator := .Paginate (where .Pages "Params.displayinlist" "!=" false) -}}
|
||||
{{- range $paginator.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>{{ if (isset .Params "description") }}{{ index .Params "description" | html }}{{ else }}{{ .Summary | html }}{{ end }}</description>
|
||||
</item>
|
||||
{{- end }}
|
||||
</channel>
|
||||
</rss>
|
41
layouts/_default/single.html
Normal file
@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.LanguageCode }}" dir="ltr">
|
||||
|
||||
{{ partial "head.html" . }}
|
||||
|
||||
<body class="single-body">
|
||||
|
||||
{{ partial "nav-bar.html" . }}
|
||||
|
||||
<main class="content side-text-padding">
|
||||
<article class="post {{ if ne .Params.dropcap false }}dropcase{{ end }}">
|
||||
<header class="post-header">
|
||||
<h1 class="post-title">{{ .Title }}</h1>
|
||||
{{ if isset .Params "date" }}<p class="post-date">Posted <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "Jan 2, 2006" }}</time></p>{{ end }}
|
||||
</header>
|
||||
{{ with .Resources.GetMatch "featuredImage" -}}
|
||||
<picture class="post-figure">
|
||||
{{ with $.Resources.GetMatch (replace (.Title) (path.Ext (.Title)) ".webp") -}}
|
||||
<source srcset="{{ .Permalink }}" type="image/webp">
|
||||
{{- end }}
|
||||
{{ $featured := .Resize "800x Lanczos" }}
|
||||
<source srcset="{{ $featured.Permalink }}">
|
||||
<img src="{{ $featured.Permalink }}" {{ with .Params.description -}} alt="{{ . }}" {{- end }}>
|
||||
</picture>
|
||||
{{- end }}
|
||||
{{ if .Params.toc -}}
|
||||
<h2>Contents</h2>
|
||||
{{ .TableOfContents }}
|
||||
{{- end }}
|
||||
{{ .Content }}
|
||||
</article>
|
||||
</main>
|
||||
<nav class="end-nav side-padding">
|
||||
{{ with .PrevInSection }}
|
||||
{{ .Render "li-next" }}
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ partial "footer.html" . }}
|
||||
{{ partial "scripts.html" . }}
|
||||
</body>
|
||||
</html>
|
3
layouts/partials/footer.html
Normal file
@ -0,0 +1,3 @@
|
||||
<footer class="side-padding" >
|
||||
The Octet Press, N07070's blog. Self-hosted, low-tech, no JS and static, as it should be.
|
||||
</footer>
|
43
layouts/partials/head.html
Normal file
@ -0,0 +1,43 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>{{ if not .IsHome }}{{with .Title }}{{ . }} · {{ end }}{{ end }}{{ .Site.Title }}</title>
|
||||
<meta name="description" content="{{if .IsHome}}{{ $.Site.Params.description }}{{else}}{{.Description}}{{end}}" />
|
||||
{{ if (fileExists "static/apple-touch-icon.png") -}}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ "/apple-touch-icon.png" | absURL }}">
|
||||
{{ end -}}
|
||||
{{ if (fileExists "static/favicon-32x32.png") -}}
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ "/favicon-32x32.png" | absURL }}">
|
||||
{{ end -}}
|
||||
{{ if (fileExists "static/favicon-16x16.png") -}}
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ "/favicon-16x16.png" | absURL }}">
|
||||
{{ end -}}
|
||||
{{ if (fileExists "static/site.webmanifest") -}}
|
||||
<link rel="manifest" href="{{ "/site.webmanifest" | absURL }}">
|
||||
{{ end -}}
|
||||
{{ if (fileExists "static/safari-pinned-tab.svg") -}}
|
||||
<link rel="mask-icon" href="{{ "/safari-pinned-tab.svg" | absURL }}" color="#5bbad5">
|
||||
{{ end -}}
|
||||
{{ if (fileExists "layouts/partials/meta-tags.html") -}}
|
||||
{{ partial "meta-tags.html" . }}
|
||||
{{ end -}}
|
||||
{{ with resources.Get "css/katex.css" -}}
|
||||
<link href="{{ .Permalink }}" rel="stylesheet">
|
||||
{{ end -}}
|
||||
{{ $normalizeStyle := resources.Get "css/normalize.css" }}
|
||||
{{ $mainStyle := resources.Get "css/style.css" }}
|
||||
{{ $overrideStyle := resources.Get "css/override.css" }}
|
||||
{{ $style := slice $normalizeStyle $mainStyle $overrideStyle | resources.Concat "css/concated.css" | minify }}
|
||||
<link href="{{ $style.Permalink }}" rel="stylesheet">
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end -}}
|
||||
{{ with resources.GetMatch .Site.Params.bgimg -}}
|
||||
<style>
|
||||
body {
|
||||
background: #ecedef url("{{ .Permalink | safeCSS }}") repeat;
|
||||
}
|
||||
</style>
|
||||
{{- end }}
|
||||
</head>
|
3
layouts/partials/home-card.html
Normal file
@ -0,0 +1,3 @@
|
||||
<a href="{{ .Site.BaseURL }}" class="card home-card" style="background-image: url({{if isset .Site.Params "homeimg"}} {{ (resources.Get .Site.Params.homeimg).Permalink | safeCSS }} {{ else }} {{ (resources.Get "img/grey-cloud.jpg").Permalink | safeCSS }} {{ end }})" rel="bookmark" >
|
||||
Home
|
||||
</a>
|
35
layouts/partials/nav-bar.html
Normal file
@ -0,0 +1,35 @@
|
||||
<nav class="nav-bar card-container">
|
||||
|
||||
<div class="card blog-card menu-container">
|
||||
<h1 class="nav-header">
|
||||
<a href="{{ .Site.BaseURL }}" class="nav-text">
|
||||
{{- if isset $.Site.Params "brand"}}
|
||||
{{- $.Site.Params.brand -}}
|
||||
{{ else }}
|
||||
{{- $.Site.Title -}}
|
||||
{{ end -}}
|
||||
</a>
|
||||
</h1>
|
||||
<br>
|
||||
<section id="menu">
|
||||
<ul>
|
||||
<li><a href="{{ .Site.BaseURL }}" class="">HOME</a></li>
|
||||
|
||||
{{ range where .Site.Pages "Params.displayinmenu" true -}}
|
||||
<li><a href="{{ .Permalink }}" class="">{{ .Title | upper }}</a></li>
|
||||
{{ end -}}
|
||||
|
||||
<!-- Categories -->
|
||||
<!-- {{ range $key, $value := .Site.Taxonomies.categories -}}
|
||||
<!-- {{ with $.Site.GetPage (printf "%s%s" "categories/" ($key | urlize)) }}
|
||||
<li><a href="{{ .Permalink }}" class="">{{ .Title | upper }}</a></li>
|
||||
{{ end }}
|
||||
{{- end }} -->
|
||||
|
||||
{{ if eq .Site.Params.rssinmenu true -}}
|
||||
<li><a href="{{ "/index.xml" | absURL }}" class="hamburger-menu-overlay-link">RSS</a></li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</nav>
|
6
layouts/partials/scripts.html
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- {{ with resources.Get "js/katex.js" }}
|
||||
<script defer src="{{ .Permalink }}"></script>
|
||||
{{ end }}
|
||||
{{ with resources.Get "js/auto-render.js" }}
|
||||
<script defer src="{{ .Permalink }}" onload="renderMathInElement(document.body);"></script>
|
||||
{{ end }} -->
|
1
layouts/shortcodes/clearfloat.html
Normal file
@ -0,0 +1 @@
|
||||
<div style="clear: both;"></div>
|
14
layouts/shortcodes/image.html
Normal file
@ -0,0 +1,14 @@
|
||||
<picture>
|
||||
{{ if (fileExists (printf "%s/%s" "content" (replace (.Get "src") (path.Ext (.Get "src")) ".webp"))) -}}
|
||||
<source srcset="{{ replace (.Get "src") (path.Ext (.Get "src")) ".webp" | absURL }}" type="image/webp">
|
||||
{{- end }}
|
||||
{{ $image := $.Page.Resources.GetMatch (.Get "src") }}
|
||||
{{ if gt $image.Width 800 -}}
|
||||
{{ $resized := $image.Resize "800x Lanczos" }}
|
||||
<source srcset="{{ $resized.Permalink }}">
|
||||
<img src="{{ $resized.Permalink }}" {{ if isset .Params "alt" -}} alt="{{ .Get "alt"}}" {{- end }}>
|
||||
{{ else }}
|
||||
<source srcset="{{ $image.Permalink }}">
|
||||
<img src="{{ $image.Permalink }}" {{ if isset .Params "alt" -}} alt="{{ .Get "alt"}}" {{- end }}>
|
||||
{{- end}}
|
||||
</picture>
|
1
layouts/shortcodes/raw.html
Normal file
@ -0,0 +1 @@
|
||||
{{.Inner}}
|
36
layouts/shortcodes/smallimg.html
Normal file
@ -0,0 +1,36 @@
|
||||
<picture class="small-pic {{ if eq .Params.clear "true" -}} clear {{- end }}">
|
||||
{{ if (fileExists (printf "%s/%s" "content" (replace (.Get "src") (path.Ext (.Get "src")) ".webp"))) -}}
|
||||
<source srcset="{{ replace (.Get "src") (path.Ext (.Get "src")) ".webp" | absURL }}" type="image/webp">
|
||||
{{- end }}
|
||||
{{ $image := $.Page.Resources.GetMatch (.Get "src") }}
|
||||
{{ if or (gt $image.Width 800) (and (isset .Params "width") (gt $image.Width (.Get "width"))) -}}
|
||||
{{ $.Scratch.Set "imgwidth" "800" }}
|
||||
{{ if and (isset .Params "width") (lt (.Get "width") 800) -}}
|
||||
{{ $.Scratch.Set "imgwidth" (trim (.Get "width") "px") }}
|
||||
{{- end }}
|
||||
{{ $resized := $image.Resize (printf "%sx Lanczos" ($.Scratch.Get "imgwidth")) }}
|
||||
<source srcset="{{ $resized.Permalink }}">
|
||||
<img src="{{ $resized.Permalink }}" class="small-img {{ if isset .Params "smartfloat" -}}
|
||||
{{- if eq .Params.smartfloat "left" -}}
|
||||
smartfloat-left
|
||||
{{- else if eq .Params.smartfloat "right" -}}
|
||||
smartfloat-right
|
||||
{{- end -}}
|
||||
{{- end }}"
|
||||
{{- with .Get "alt" }} alt="{{ . }}" {{ end -}}
|
||||
{{- with .Get "width" }} style="width: {{ . }};" {{- end -}}
|
||||
/>
|
||||
{{ else }}
|
||||
<source srcset="{{ $image.Permalink }}">
|
||||
<img src="{{ $image.Permalink }}" class="small-img {{ if isset .Params "smartfloat" -}}
|
||||
{{- if eq .Params.smartfloat "left" -}}
|
||||
smartfloat-left
|
||||
{{- else if eq .Params.smartfloat "right" -}}
|
||||
smartfloat-right
|
||||
{{- end -}}
|
||||
{{- end }}"
|
||||
{{- with .Get "alt" }} alt="{{ . }}" {{ end -}}
|
||||
{{- with .Get "width" }} style="width: {{ . }};" {{- end -}}
|
||||
/>
|
||||
{{- end }}
|
||||
</picture>
|