initial commit

This commit is contained in:
Greg Gauthier 2021-03-30 21:50:34 +01:00
commit b800f8ad86
62 changed files with 3900 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
public/

6
archetypes/default.md Normal file
View File

@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

53
config.toml Normal file
View File

@ -0,0 +1,53 @@
baseURL = "https://gmgauthier.com/"
languageCode = "en-us"
theme = "blackburn"
title = "Ipse Solus"
author = "Greg Gauthier"
copyright = "© 2021. All rights reserved."
canonifyurls = true
paginate = 10
[indexes]
tag = "tags"
topic = "topics"
[params]
subtitle = "A Journal"
highlightjs = "androidstudio"
highlightjs_extra_languages = ["yaml"]
dateFormat = "02 Jan 2006, 15:04"
[menu]
[[menu.main]]
name = "Home"
pre = "<i class='fa fa-home fa-fw'></i>"
weight = 1
identifier = "home"
url = "/"
[[menu.main]]
name = "Posts"
pre = "<i class='fa fa-list fa-fw'></i>"
weight = 2
identifier = "post"
url = "/post/"
[[menu.main]]
name = "About"
pre = "<i class='fa fa-user fa-fw'></i>"
weight = 3
identifier = "about"
url = "/about/"
[[menu.main]]
name = "Contact"
pre = "<i class='fa fa-phone fa-fw'></i>"
weight = 4
identifier = "contact"
url = "/contact/"
[social]
github = "gmgauthier"
locals = "https://exitingthecave.locals.com/"
gab = "https://gab.com/exitingthecave/"

11
content/about.md Normal file
View File

@ -0,0 +1,11 @@
# Welcome To My Online Home
This site is my first serious attempt to build a statically generated blog. My "heavy" blog can be found at [Exiting The Cave](https://exitingthecave.com/). It is a traditional wordpress blog, with all that implies. This blog, however, is meant to simplify my life, in a way. I type these posts out in VIM or [Typora](https://typora.io/), run the [Hugo](https://gohugo.io/) generator, and then push the build directly to this site's apache doc root. No server-side code, no security threats, no cpu-heavy php or ruby or java. Just a simple apache server, and the text. The way the web was meant to be. I may, over time, add simple javascript instrumentation for various reasons, but for right now, this will do.
Unlike my formal philosophy blog, which tends to avoid my personal feelings, opinions, and tangential topics like politics, culture, and current events, this blog will dabble in that, as well as heavy technical topics, including snippets of code I find, and problems I've solved on my new job. I hope you enjoy reading it, but I won't sweat if you don't. This blog is more for me, than it is for anyone else. If it happens to gather a following, then so much the better!

9
content/contact.md Normal file
View File

@ -0,0 +1,9 @@
# Contact Me
| | | |
| ----------------: | :----: | :---------------------------------------------- |
| **email** | = | gmgauthier@protonmail.com |
| **phone** | = | +44 07910094267 |
| **social media** | = | https://www.linkedin.com/in/gregorygauthier/ |
| **snail mail** | = | 10-11 Barnsbury Terrace, Flat F, N1 1JH London |

View File

@ -0,0 +1,41 @@
---
title: "Hello, World!"
date: 2021-03-29T20:14:33+01:00
draft: true
---
# Hello World!
This is my first static blog post. I think I might be doing a lot of this in the future.
### Do Not Go Gentle.
```
Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.
Though wise men at their end know dark is right,
Because their words had forked no lightning they
Do not go gentle into that good night.
Good men, the last wave by, crying how bright
Their frail deeds might have danced in a green bay,
Rage, rage against the dying of the light.
Wild men who caught and sang the sun in flight,
And learn, too late, they grieve it on its way,
Do not go gentle into that good night.
Grave men, near death, who see with blinding sight
Blind eyes could blaze like meteors and be gay,
Rage, rage against the dying of the light.
And you, my father, there on the sad height,
Curse, bless, me now with your fierce tears, I pray.
Do not go gentle into that good night.
Rage, rage against the dying of the light.
```

44
content/post/its-alive.md Normal file
View File

@ -0,0 +1,44 @@
---
title: "It's Alive!"
date: 2021-03-30T20:14:33+01:00
draft: true
---
# Welcome To My Blog
Here's a snippet of Go.
```go
func str2int(strnum string) int {
i, err := strconv.Atoi(strnum)
if err != nil {
return 9999
}
return i
}
```
Here's a snippet of Java Springboot.
```java
@RestController
@RequestMapping(value = "/hello")
public class TrainerController {
@GetMapping
public String helloWorld(){
return "Hello, World!";
}
}
```
Here's a snippet of Python.
```python
def test_firefox_browser(headless):
bd = BrowserDriver().get("firefox", headless=headless)
bd.get('https://test.io')
assert "QA Testing as a Service | test IO" == bd.title
bd.quit()
```

View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2016 YOUR_NAME_HERE
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.

257
themes/blackburn/README.md Normal file
View File

@ -0,0 +1,257 @@
# Blackburn
Blackburn is a clear and responsive theme for [Hugo](//gohugo.io).
## Overview
* Based on Yahoo's [Pure CSS](http://purecss.io/) (v1.0.0)
* Fixed sidebar with social links:
* Twitter
* GNU social
* Facebook
* Google+
* Weibo
* Tumblr
* Instagram
* Flickr
* 500px
* Pinterest
* YouTube
* Vimeo
* Vine
* SlideShare
* LinkedIn
* Xing
* Reddit
* Hacker News
* GitHub
* GitLab
* Bitbucket
* Stack Overflow
* Server Fault
* Steam
* MobyGames
* Last.fm
* Discogs
* Keybase
* Client-side syntax highlighting by [Highlight.js](https://highlightjs.org) (v10.6.0)
* Web analytics by Piwik, Google Analytics, or [GoatCounter](https://www.goatcounter.com/)
* Comments by Disqus or [Commento](https://www.commento.io/)
* Icons by Font Awesome (v5.15.2)
## Demo
* [Demo](http://themes.gohugo.io/theme/blackburn/)
* You can also see it in action on my personal website [here](http://yoshiharuyamashita.com/)
## Screenshots
![screenshot](https://raw.githubusercontent.com/yoshiharuyamashita/blackburn/master/images/screenshot.png)
## Installation
In your Hugo site directory, run:
```shell
$ mkdir themes
$ cd themes
$ git clone https://github.com/yoshiharuyamashita/blackburn.git
```
or download from [here](//github.com/yoshiharuyamashita/blackburn/archive/master.zip).
See [Hugo Quickstart Guide](//gohugo.io/overview/quickstart/) for more information.
## Configuration
Example config.toml:
```toml
baseurl = "https://www.example.com/" # Make sure to end baseurl with a '/'
title = "Your site title"
author = "Your name"
# Shown in the side menu
copyright = "&copy; 2016. All rights reserved."
canonifyurls = true
paginate = 10
[indexes]
tag = "tags"
topic = "topics"
[params]
# Shown in the home page
subtitle = "A Hugo Theme"
brand = "Blackburn"
googleAnalytics = "Your Google Analytics tracking ID"
disqus = "Your Disqus shortname"
# CSS name for highlight.js
highlightjs = "androidstudio"
highlightjs_extra_languages = ["yaml"]
dateFormat = "02 Jan 2006, 15:04"
# Include any custom CSS and/or JS files
# (relative to /static folder)
custom_css = ["css/my.css"]
custom_js = ["js/my.js"]
[params.piwikAnalytics]
siteid = 2
piwikroot = "//analytics.example.com/"
[menu]
# Shown in the side menu.
[[menu.main]]
name = "Home"
pre = "<i class='fa fa-home fa-fw'></i>"
weight = 1
identifier = "home"
url = "/"
[[menu.main]]
name = "Posts"
pre = "<i class='fa fa-list fa-fw'></i>"
weight = 2
identifier = "post"
url = "/post/"
[[menu.main]]
name = "About"
pre = "<i class='fa fa-user fa-fw'></i>"
weight = 3
identifier = "about"
url = "/about/"
[[menu.main]]
name = "Contact"
pre = "<i class='fa fa-phone fa-fw'></i>"
weight = 4
url = "/contact/"
[social]
# Link your social networking accounts to the side menu
# by entering your username or ID.
# SNS microblogging
twitter = "*"
gnusocial = "*" # Specify href (e.g. https://quitter.se/yourusername)
facebook = "*"
googleplus = "*"
weibo = "*"
tumblr = "*"
# SNS photo/video sharing
instagram = "*"
flickr = "*"
photo500px = "*"
pinterest = "*"
youtube = "*"
vimeo = "*"
vine = "*"
slideshare = "*"
# SNS career oriented
linkedin = "*"
xing = "*"
# SNS news
reddit = "*"
hackernews = "*"
# Techie
github = "yoshiharuyamashita"
gitlab = "*"
bitbucket = "*"
stackoverflow = "*"
serverfault = "*"
# Gaming
steam = "*"
mobygames = "*"
# Music
lastfm = "*"
discogs = "*"
# Other
keybase = "*"
```
## Usage
* Write Markdown files in `content/post`
* Add fixed pages (e.g., about.md) to the side menu by defining them under `[menu]` in the config.toml:
```toml
[[menu.main]]
name = "About"
pre = "<i class='fa fa-user fa-fw'></i>"
weight = 2
identifier = "about"
url = "/about/"
```
* Override the theme by linking to custom CSS files or URLs:
```toml
[params]
custom_css = ["css/my.css"]
```
* Add new behaviours by linking to custom JS files or URLs:
```toml
[params]
custom_js = ["js/my.js", "https://cdnjs.cloudflare.com/ajax/libs/zooming/1.4.2/zooming.min.js"]
```
## Shortcodes
### pure_table
```
{{< pure_table
"columnName1|columnName2|...|columnName99"
"dataValue1|dataValue2|...|dataValue99"
"dataValue1|dataValue2|...|dataValue99"
"dataValue1|dataValue2|...|dataValue99"
"... and so on"
>}}
```
where each positional parameter is separated by the vertical bar (i.e., |). The resulting `<table>` is set to have `class="pure-table pure-table-striped"`.
### fluid_imgs
```
{{< fluid_imgs
"class|src|alt"
"class|src|alt"
"... and so on"
>}}
```
where each positional parameter is separated by the vertical bar (i.e., |).
- `class`: specifies a Pure CSS unit class name (**required**)
- `src`: specifies the URL of an image (**required**)
- `alt`: specifies an alternate text for an image (optional)
See [here](http://yoshiharuyamashita.com/post/hugo-shortcode-to-show-multiple-images/) for examples.
### fluid_img (obsolete)
#### Positional
```
{{% fluid_img "/path/to/img" %}}
```
#### Named
```
{{% fluid_img class="pure-u-1-2" src="/path/to/img" alt="img description" %}}
{{% fluid_img class="pure-u-1-3" src="/path/to/img" caption="img description" %}}
```
* `class`, `alt` and `caption` are optional.
* See [Pure CSS Grids](http://purecss.io/grids/) for possible `class` values.
## License
* [MIT](//opensource.org/licenses/MIT)

View File

@ -0,0 +1,8 @@
+++
title = "{{ replace .Name "-" " " | title }}"
date = "{{ .Date }}"
draft = true
tags = []
topics = []
description = ""
+++

View File

@ -0,0 +1,2 @@
public/
themes

View File

@ -0,0 +1,79 @@
baseurl = "https://www.example.com/"
languageCode = "en-us"
title = "Blackburn Theme Demo"
theme = "blackburn"
author = "Yoshiharu Yamashita"
copyright = "&copy; 2016. All rights reserved."
canonifyurls = true
paginate = 10
[indexes]
tag = "tags"
topic = "topics"
[params]
# Shown in the home page
subtitle = "A Hugo Theme"
brand = "Blackburn"
googleAnalytics = "Your Google Analytics tracking ID"
disqus = "Your Disqus shortname"
# CSS name for highlight.js
highlightjs = "androidstudio"
dateFormat = "02 Jan 2006, 15:04"
[menu]
# Shown in the side menu.
[[menu.main]]
name = "Home"
pre = "<i class='fa fa-home fa-fw'></i>"
weight = 1
identifier = "home"
url = "/"
[[menu.main]]
name = "Posts"
pre = "<i class='fa fa-list fa-fw'></i>"
weight = 2
identifier = "post"
url = "/post/"
[[menu.main]]
name = "About"
pre = "<i class='fa fa-user fa-fw'></i>"
weight = 3
identifier = "about"
url = "/about/"
[[menu.main]]
name = "Contact"
pre = "<i class='fa fa-phone fa-fw'></i>"
weight = 4
url = "/contact/"
[social]
# Link your social networking accouns to the side menu
# by entering your username or ID.
twitter="*"
# gnusocial="*"
facebook="*"
# weibo="*"
# tumblr="*"
instagram="*"
# flickr="*"
# photo500px="*"
# pinterest="*"
# youtube="*"
# vimeo="*"
# vine="*"
# slideshare="*"
linkedin="*"
# xing="*"
# reddit="*"
# hackernews="*"
github="yoshiharuyamashita"
# gitlab="*"
# bitbucket="*"
stackoverflow="*"
# serverfault="*"
# steam="*"
# mobygames="*"
# lastfm="*"
# discogs="*"
# keybase="*"

View File

@ -0,0 +1,31 @@
+++
title = "About"
date = "2014-04-09"
sidemenu = "true"
description = "About me and this site"
+++
Hugo is a static site engine written in Go.
It makes use of a variety of open source projects including:
* [Cobra](https://github.com/spf13/cobra)
* [Viper](https://github.com/spf13/viper)
* [J Walter Weatherman](https://github.com/spf13/jWalterWeatherman)
* [Cast](https://github.com/spf13/cast)
Learn more and contribute on [GitHub](https://github.com/spf13).
## Setup
Some fun facts about [Hugo](http://gohugo.io/):
* Built in [Go](http://golang.org/)
* Loosely inspired by [Jekyll](http://jekyllrb.com/)
* Primarily developed by [spf13](http://spf13.com/) on the train while commuting to and from Manhattan.
* Coded in [Vim](http://vim.org) using [spf13-vim](http://vim.spf13.com/)
Have questions or suggestions? Feel free to [open an issue on GitHub](https://github.com/spf13/hugo/issues/new) or [ask me on Twitter](https://twitter.com/spf13).
Thanks for reading!

View File

@ -0,0 +1,46 @@
+++
title = "Contact"
date = "2014-04-09"
sidemenu = "true"
description = "How to contact me"
+++
<form class="pure-form pure-form-stacked">
<fieldset>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-3">
<label for="first-name">First Name</label>
<input id="first-name" class="pure-u-23-24" type="text">
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="last-name">Last Name</label>
<input id="last-name" class="pure-u-23-24" type="text">
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="email">E-Mail</label>
<input id="email" class="pure-u-23-24" type="email" required>
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="city">City</label>
<input id="city" class="pure-u-23-24" type="text">
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="state">State</label>
<select id="state" class="pure-input-1-2">
<option>AL</option>
<option>CA</option>
<option>IL</option>
</select>
</div>
</div>
<fieldset class="pure-group">
<input type="text" class="pure-input-1-2" placeholder="A title">
<textarea class="pure-input-1-2" placeholder="Your message"></textarea>
</fieldset>
<button type="submit" class="pure-button pure-button-primary">Send</button>
</fieldset>
</form>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,343 @@
+++
title = "(Hu)go Template Primer"
description = ""
tags = [
"go",
"golang",
"templates",
"themes",
"development",
]
date = "2014-04-02"
categories = [
"Development",
"golang",
]
+++
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
Go lang 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 &#xA9; 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]: <http://golang.org/>
[gohtmltemplate]: <http://golang.org/pkg/html/template/>

View File

@ -0,0 +1,88 @@
+++
title = "Getting Started with Hugo"
description = ""
tags = [
"go",
"golang",
"hugo",
"development",
]
date = "2014-04-02"
categories = [
"Development",
"golang",
]
+++
## Step 1. Install Hugo
Goto [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 [installing hugo](/overview/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.

View File

@ -0,0 +1,153 @@
---
date: 2014-03-10
linktitle: Migrating from Jekyll
title: Migrate to Hugo from Jekyll
weight: 10
---
## 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).

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

View File

@ -0,0 +1 @@
<li><time>{{ with .Site.Params.dateFormat }}{{ $.Date.Format . }}{{ else }}{{ .Date.Format "02 Jan 2006, 15:04" }}{{ end }}</time> - <a href="{{ .Permalink }}">{{ .Title }}</a></li>

View File

@ -0,0 +1,15 @@
{{ define "main" }}
<main>
{{ .Content }}
<ul class="contents">
{{ range .Paginator.Pages }}
<li>{{.Title}}
<div>
{{ partial "summary.html" . }}
</div>
</li>
{{ end }}
</ul>
{{ partial "pagination.html" . }}
</main>
{{ end }}

View File

@ -0,0 +1,11 @@
{{ partial "header.html" . }}
<div class="header">
<h1>{{ .Title }}</h1>
<h2>{{ .Description }}</h2>
</div>
<div class="content">
{{ .Content }}
</div>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,18 @@
<article>
<header>
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
{{ partial "post_meta.html" . }}
</header>
<p>
{{ .Summary }}
</p>
{{ if .Truncated }}
<footer>
<a href="{{ .RelPermalink }}">Read more<i class="fa fa-angle-double-right fa-fw"></i></a>
</footer>
{{ end }}
</article>

View File

@ -0,0 +1,13 @@
{{ partial "header.html" . }}
<div class="header">
<h1>{{ .Title }}</h1>
</div>
<div class="content">
{{ range .Data.Pages }}
{{ .Render "summary"}}
{{ end }}
</div>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,18 @@
{{ partial "header.html" . }}
<div class="header">
<h1>{{ .Title }}</h1>
</div>
<div class="content">
<ul>
{{ $data := .Data }}
{{ range $key, $value := .Data.Terms.ByCount }}
<li>
<a href="{{ $value.Name | urlize }}">{{ $value.Name }}</a>
<span>&#40;{{ $value.Count }}&#41;</span>
</li>
{{ end }}
</ul>
</div>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,17 @@
{{ partial "header.html" . }}
<div class="header">
<h1>{{ .Title }}</h1>
<h2>{{ .Site.Params.subtitle }}</h2>
</div>
<div class="content">
{{ range ( .Paginate (where .Site.RegularPages "Type" "post")).Pages }}
{{ .Render "summary"}}
{{ end }}
{{ partial "pagination.html" . }}
</div>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,3 @@
{{ with .Site.Params.brand }}
<a class="pure-menu-heading brand" href="/">{{ . | safeHTML }}</a>
{{ end }}

View File

@ -0,0 +1,6 @@
{{ with .Site.Params.commento }}
<div id="commento_thread"></div>
<script defer src="https://cdn.commento.io/js/commento.js"></script>
<div id="commento"></div>
<noscript>This site uses privacy-respecting comments integration provided by <a href="https://commento.io/">Commento</a>. Please enable Javascript to see comments.</noscript>
{{ end }}

View File

@ -0,0 +1,9 @@
<div>
<div class="small-print">
<small>{{ .Site.Copyright | safeHTML }}</small>
</div>
<div class="small-print">
<small>Built with&nbsp;<a href="https://gohugo.io/" target="_blank">Hugo</a></small>
<small>Theme&nbsp;<a href="https://github.com/yoshiharuyamashita/blackburn" target="_blank">Blackburn</a></small>
</div>
</div>

View File

@ -0,0 +1,19 @@
{{ with .Site.Params.disqus }}
<div id="disqus_thread"></div>
<script type="text/javascript">
(function() {
// Don't ever inject Disqus on localhost--it creates unwanted
// discussions from 'localhost:1313' on your Disqus account...
if (window.location.hostname == "localhost")
return;
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
var disqus_shortname = '{{ . }}';
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
{{ end }}

View File

@ -0,0 +1 @@
<link rel="shortcut icon" href="{{ .Site.BaseURL }}img/favicon.ico" type="image/x-icon" />

View File

@ -0,0 +1,13 @@
</div>
</div>
<script src="{{ .Site.BaseURL }}js/ui.js"></script>
<script src="{{ .Site.BaseURL }}js/menus.js"></script>
{{ partial "goatcounter_analytics.html" . }}
{{ partial "google_analytics.html" . }}
{{ partial "piwik_analytics.html" . }}
{{ partial "footer_mathjax" . }}
</body>
</html>

View File

@ -0,0 +1,4 @@
{{ if and (not .Params.disable_mathjax) (or (in (string .Content) "\\") (in (string .Content) "$")) }}
<script src="{{ "/js/math-code.js" | relURL }}"></script>
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>
{{ end }}

View File

@ -0,0 +1,5 @@
{{ with .Site.Params.goatcounterAnalytics }}
<!-- GoatCounter -->
<script data-goatcounter="https://{{ . }}.goatcounter.com/count"
async src="//gc.zgo.at/count.js"></script>
{{ end }}

View File

@ -0,0 +1,14 @@
{{ with .Site.Params.googleAnalytics }}
<script>
// Never report traffic that originates from local testing.
if (window.location.hostname != "localhost") {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ . }}', 'auto');
ga('send', 'pageview');
}
</script>
{{ end }}

View File

@ -0,0 +1,75 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ if .IsNode }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ else }}{{ with .Description }}{{ . }}{{ end }}{{ end }}">
{{hugo.Generator}}
<title>{{ if .IsHome }}{{ .Title }}{{ else }}{{ .Title }} &middot; {{ .Site.Title }}{{ end }}</title>
{{ if .Params.canonical }}
<link rel="canonical" href="{{ .Params.canonical }}">
{{ end }}
<!-- CSS -->
{{ $purecss := "https://cdnjs.cloudflare.com/ajax/libs/pure/1.0.0/" }}
<link rel="stylesheet" href="{{ $purecss }}pure-min.css">
{{ "<!--[if lte IE 8]>" | safeHTML }}
<link rel="stylesheet" href="{{ $purecss }}grids-responsive-old-ie-min.css">
{{ "<![endif]-->" | safeHTML }}
{{ "<!--[if gt IE 8]><!-->" | safeHTML }}
<link rel="stylesheet" href="{{ $purecss }}grids-responsive-min.css">
{{ "<!--<![endif]-->" | safeHTML }}
{{ "<!--[if lte IE 8]>" | safeHTML }}
<link rel="stylesheet" href="/css/side-menu-old-ie.css">
{{ "<![endif]-->" | safeHTML }}
{{ "<!--[if gt IE 8]><!-->" | safeHTML }}
<link rel="stylesheet" href="/css/side-menu.css">
{{ "<!--<![endif]-->" | safeHTML }}
<link rel="stylesheet" href="/css/blackburn.css">
<!-- Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Raleway&display=swap" rel="stylesheet" type="text/css">
<!-- MathJax -->
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- RSS -->
{{ if .OutputFormats.Get "RSS" }}
<link rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}"
href='{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}' />
{{ end }}
{{ with .Site.Params.highlightjs }}
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/styles/{{ . }}.min.css">
<script async src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/highlight.min.js"></script>
{{ range $.Site.Params.highlightjs_extra_languages }}
<script async src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/languages/{{ . }}.min.js"></script>
{{ end }}
<script>hljs.initHighlightingOnLoad();</script>
{{ end }}
{{ partial "favicon.html" . }}
{{ range .Site.Params.custom_css }}
{{ if findRE "https?://" . }}
<link rel="stylesheet" href="{{ . }}">
{{ else }}
<link rel="stylesheet" href="{{ $.Site.BaseURL }}{{ . }}">
{{ end }}
{{ end }}
{{ range .Site.Params.custom_js }}
{{ if findRE "https?://" . }}
<script src="{{ . }}"></script>
{{ else }}
<script src="{{ $.Site.BaseURL }}{{ . }}"></script>
{{ end }}
{{ end }}
</head>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
{{ partial "head.html" . }}
<body>
<div id="layout">
{{ partial "sidemenu.html" . }}
<div id="main">

View File

@ -0,0 +1,17 @@
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
{{ $prev := "fa fa-chevron-left"}}
{{ $next := "fa fa-chevron-right"}}
<nav class="pagination" role="pagination">
{{ if .Paginator.HasPrev }}
<a href="{{ .Paginator.Prev.URL }}"><i class="{{ $prev }}"></i></a>
{{ else }}
<i class="{{ $prev }}"></i>
{{ end }}
<span>&nbsp;{{ .Paginator.PageNumber }} / {{ .Paginator.TotalPages }}&nbsp;</span>
{{ if .Paginator.HasNext }}
<a href="{{ .Paginator.Next.URL }}"><i class="{{ $next }}"></i></a>
{{ else }}
<i class="{{ $next }}"></i>
{{ end }}
</nav>
{{ end }}

View File

@ -0,0 +1,16 @@
{{ with .Site.Params.piwikAnalytics }}
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="{{ .piwikroot }}";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', {{ .siteid }}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="{{ .piwikroot }}piwik.php?idsite={{ .siteid }}" style="border:0;" alt="" /></p></noscript>
{{ end }}

View File

@ -0,0 +1,34 @@
<div class="post-meta">
<div>
<i class="fa fa-calendar fa-fw"></i>
<time>{{ with .Site.Params.dateFormat }}{{ $.Date.Format . }}{{ else }}{{ .Date.Format "02 Jan 2006, 15:04" }}{{ end }}</time>
</div>
{{ $baseUrl := .Site.BaseURL }}
{{ if isset .Params "topics" }}
{{ $count := len .Params.topics }}
{{ if gt $count 0 }}
<div>
<i class="fa fa-folder fa-fw"></i>
{{ range $k, $v := .Params.topics }}
<a class="post-taxonomy-topic" href="{{ $baseUrl }}topics/{{ . | urlize }}">{{ . }}</a>{{ if lt $k (sub $count 1) }}&nbsp;&#47;{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}
{{ if isset .Params "tags" }}
{{ $count := len .Params.tags }}
{{ if gt $count 0 }}
<div>
<i class="fa fa-tags fa-fw"></i>
{{ range $k, $v := .Params.tags }}
<a class="post-taxonomy-tag" href="{{ $baseUrl }}tags/{{ . | urlize }}">{{ . }}</a>{{ if lt $k (sub $count 1) }}&nbsp;&#47;{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}
</div>

View File

@ -0,0 +1,31 @@
{{ if or (.NextPage) (.PrevPage) }}
<div class="prev-next-post pure-g">
<div class="pure-u-1-24" style="text-align: left;">
{{ if .PrevInSection }}
<a href="{{ .PrevInSection.Permalink }}"><i class="fa fa-chevron-left"></i></a>
{{ end }}
</div>
<div class="pure-u-10-24">
{{ if .PrevInSection }}
<nav class="prev">
<a href="{{ .PrevInSection.Permalink }}">{{ .PrevInSection.Title }}</a>
</nav>
{{ end }}
</div>
<div class="pure-u-2-24">
&nbsp;
</div>
<div class="pure-u-10-24">
{{ if .NextInSection }}
<nav class="next">
<a href="{{ .NextInSection.Permalink }}">{{ .NextInSection.Title }}</a>
</nav>
{{ end }}
</div>
<div class="pure-u-1-24" style="text-align: right;">
{{ if .NextInSection }}
<a href="{{ .NextInSection.Permalink }}"><i class="fa fa-chevron-right"></i></a>
{{ end }}
</div>
</div>
{{ end }}

View File

@ -0,0 +1,38 @@
<h4><i class="fas fa-share-alt" aria-hidden="true"></i>&nbsp;Share!</h4>
<ul class="share-buttons">
<li><a href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" title="Share on Facebook"><i class="fab fa-facebook" aria-hidden="true"></i><span class="sr-only">Share on Facebook</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="https://twitter.com/intent/tweet?source={{ .Permalink }}" target="_blank" title="Tweet"><i class="fab fa-twitter" aria-hidden="true"></i><span class="sr-only">Tweet</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="https://plus.google.com/share?url={{ .Permalink }}" target="_blank" title="Share on Google+"><i class="fab fa-google-plus" aria-hidden="true"></i><span class="sr-only">Share on Google+</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="http://www.tumblr.com/share?v=3&u={{ .Permalink }}" target="_blank" title="Post to Tumblr"><i class="fab fa-tumblr" aria-hidden="true"></i><span class="sr-only">Post to Tumblr</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="http://pinterest.com/pin/create/button/?url={{ .Permalink }}" target="_blank" title="Pin it"><i class="fab fa-pinterest-p" aria-hidden="true"></i><span class="sr-only">Pin it</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="http://www.reddit.com/submit?url={{ .Permalink }}" target="_blank" title="Submit to Reddit"><i class="fab fa-reddit-alien" aria-hidden="true"></i><span class="sr-only">Submit to Reddit</span></a>
</li>
</ul>
<!-- Style for Icons, Inlined for less requests-->
<style>
ul.share-buttons{
list-style: none;
padding: 0;
}
ul.share-buttons li{
display: inline;
}
ul.share-buttons .sr-only{
position: absolute;
clip: rect(1px 1px 1px 1px);
clip: rect(1px, 1px, 1px, 1px);
padding: 0;
border: 0;
height: 1px;
width: 1px;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,35 @@
<!-- Menu toggle -->
<a href="#menu" id="menuLink" class="menu-link">
<!-- Hamburger icon -->
<span></span>
</a>
<div id="menu">
{{ partial "brand.html" . }}
<div class="pure-menu">
<ul class="pure-menu-list">
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="pure-menu-item pure-menu-has-children">
<a class="pure-menu-link" href="#">{{ .Pre }}{{ .Name }}</a>
<ul class="pure-menu-children">
{{ range .Children }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
{{else}}
<li class="pure-menu-item">
<a class="pure-menu-link" {{ printf "href=%q" .URL | safeHTMLAttr }}>{{ .Pre }}{{ .Name }}</a>
{{end}}
</li>
{{end}}
</ul>
</div>
{{ partial "social.html" . }}
{{ partial "copyright.html" . }}
</div>

View File

@ -0,0 +1,190 @@
<div class="pure-menu social">
<ul class="pure-menu-list">
{{ if .OutputFormats.Get "RSS" }}
<li class="pure-menu-item">
<a class="pure-menu-link" href='{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}'><i
class="fas fa-rss fa-fw"></i>RSS</a>
</li>
{{ end }}
<!-- SNS microblogging -->
{{ with .Site.Social.twitter }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://twitter.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-twitter-square fa-fw"></i>Twitter</a>
</li>
{{ end }}
{{ with .Site.Social.gnusocial }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="{{ . }}" rel="me" target="_blank"><i class="fas fa-comment fa-fw"></i>GNU social</a>
</li>
{{ end }}
{{ with .Site.Social.facebook }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://facebook.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-facebook-square fa-fw"></i>Facebook</a>
</li>
{{ end }}
{{ with .Site.Social.weibo }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="http://weibo.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-weibo fa-fw"></i>Weibo</a>
</li>
{{ end }}
{{ with .Site.Social.tumblr }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://{{ . }}.tumblr.com/" rel="me" target="_blank"><i class="fab fa-tumblr-square fa-fw"></i>Tumblr</a>
</li>
{{ end }}
<!-- SNS photo/video sharing -->
{{ with .Site.Social.instagram }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://instagram.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-instagram fa-fw"></i>Instagram</a>
</li>
{{ end }}
{{ with .Site.Social.flickr }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://flickr.com/photos/{{ . }}" rel="me" target="_blank"><i class="fab fa-flickr fa-fw"></i>Flickr</a>
</li>
{{ end }}
{{ with .Site.Social.photo500px }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://500px.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-500px fa-fw"></i>500px</a>
</li>
{{ end }}
{{ with .Site.Social.pinterest }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://pinterest.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-pinterest-square fa-fw"></i>Pinterest</a>
</li>
{{ end }}
{{ with .Site.Social.youtube }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://youtube.com/user/{{ . }}" rel="me" target="_blank"><i class="fab fa-youtube-square fa-fw"></i>YouTube</a>
</li>
{{ end }}
{{ with .Site.Social.vimeo }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://vimeo.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-vimeo-square fa-fw"></i>Vimeo</a>
</li>
{{ end }}
{{ with .Site.Social.vine }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://vine.co/{{ . }}" rel="me" target="_blank"><i class="fab fa-vine fa-fw"></i>Vine</a>
</li>
{{ end }}
{{ with .Site.Social.slideshare }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="http://slideshare.net/{{ . }}" rel="me" target="_blank"><i class="fab fa-slideshare fa-fw"></i>SlideShare</a>
</li>
{{ end }}
<!-- SNS career oriented -->
{{ with .Site.Social.linkedin }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://linkedin.com/in/{{ . }}" rel="me" target="_blank"><i class="fab fa-linkedin fa-fw"></i>LinkedIn</a>
</li>
{{ end }}
{{ with .Site.Social.xing }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://xing.com/profile/{{ . }}" rel="me" target="_blank"><i class="fab fa-xing-square fa-fw"></i>Xing</a>
</li>
{{ end }}
<!-- SNS news -->
{{ with .Site.Social.reddit }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://reddit.com/user/{{ . }}" rel="me" target="_blank"><i class="fab fa-reddit-square fa-fw"></i>Reddit</a>
</li>
{{ end }}
{{ with .Site.Social.hackernews }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://news.ycombinator.com/user?id={{ . }}" rel="me" target="_blank"><i class="fab fa-hacker-news fa-fw"></i>Hacker News</a>
</li>
{{ end }}
<!-- Techie -->
{{ with .Site.Social.github }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://github.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-github-square fa-fw"></i>GitHub</a>
</li>
{{ end }}
{{ with .Site.Social.gitlab }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://gitlab.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-gitlab fa-fw"></i>GitLab</a>
</li>
{{ end }}
{{ with .Site.Social.bitbucket }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://bitbucket.org/{{ . }}" rel="me" target="_blank"><i class="fab fa-bitbucket fa-fw"></i>Bitbucket</a>
</li>
{{ end }}
{{ with .Site.Social.stackoverflow }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://stackoverflow.com/users/{{ . }}" rel="me" target="_blank"><i class="fab fa-stack-overflow fa-fw"></i>Stack Overflow</a>
</li>
{{ end }}
{{ with .Site.Social.serverfault }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://serverfault.com/users/{{ . }}" rel="me" target="_blank"><i class="fab fa-server fa-fw"></i>Server Fault</a>
</li>
{{ end }}
<!-- Gaming -->
{{ with .Site.Social.steam }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://steamcommunity.com/id/{{ . }}" rel="me" target="_blank"><i class="fab fa-steam-square fa-fw"></i>Steam</a>
</li>
{{ end }}
{{ with .Site.Social.mobygames }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://www.mobygames.com/developer/sheet/view/developerId,{{ . }}" rel="me" target="_blank"><i class="fas fa-gamepad fa-fw"></i>MobyGames</a>
</li>
{{ end }}
<!-- Music -->
{{ with .Site.Social.lastfm }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="http://last.fm/user/{{ . }}" rel="me" target="_blank"><i class="fab fa-lastfm-square fa-fw"></i>Last.fm</a>
</li>
{{ end }}
{{ with .Site.Social.discogs }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://www.discogs.com/user/{{ . }}" rel="me" target="_blank"><i class="fab fa-music fa-fw"></i>Discogs</a>
</li>
{{ end }}
<!-- Other -->
{{ with .Site.Social.keybase }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://keybase.io/{{ . }}" rel="me" target="_blank"><i class="fas fa-key fa-fw"></i>Keybase</a>
</li>
{{ end }}
</ul>
</div>

View File

@ -0,0 +1,5 @@
{{ if or (.Site.Params.Telegram.siteID) (.Site.Params.Telegram.limit) }}
<!-- Telegram DiscussBot -->
<div id="telegram_thread"></div>
<script async src="https://comments.app/js/widget.js?2" data-comments-app-website='{{ .Site.Params.Telegram.siteID }}' data-limit='{{ .Site.Params.Telegram.limit }}'></script>
{{ end }}

View File

@ -0,0 +1,17 @@
{{ partial "header.html" . }}
<div class="header">
<h1>{{ .Title }}</h1>
</div>
<div class="content">
{{ range .Data.Pages.GroupByDate "2006" }}
<h2>{{ .Key }}</h2>
<ul>
{{ range .Pages }}
{{ .Render "li" }}
{{ end }}
</ul>
{{ end }}
</div>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,25 @@
{{ partial "header.html" . }}
<div class="header">
<h1>{{ .Title }}</h1>
<h2>{{ .Description }}</h2>
</div>
<div class="content">
{{ partial "post_meta.html" . }}
{{ .Content }}
{{ partial "share.html" . }}
{{ partial "prev_next_post.html" . }}
{{ partial "commento.html" . }}
{{ partial "disqus.html" . }}
{{ partial "telegram.html" . }}
</div>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,7 @@
{{ if .IsNamedParams }}
<div class="{{ if .Get "class" }}{{ .Get "class" }}{{ else }}pure-u-1{{ end }}">
<img class="pure-img" src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }}>
</div>
{{ else }}
<img class="pure-img" src="{{ index .Params 0 }}" alt="">
{{ end }}

View File

@ -0,0 +1,21 @@
{{ $paramCount := len .Params }}
{{ if gt $paramCount 0 }}
<div class="pure-g">
{{ range $param := .Params }}
{{ $items := split $param "|" }}
{{ $itemCount := len $items }}
<!-- Item count must be at least 2 as
"class" and "src" must be specified -->
{{ if ge $itemCount 2 }}
<div class="{{ index $items 0 }}">
<div style="padding: 0 .2em">
<img
class="pure-img-responsive"
src="{{ index $items 1 }}"
alt="{{ if ge $itemCount 3 }}{{ index $items 2 }}{{ else }}{{ "" }}{{ end }}">
</div>
</div>
{{ end }}
{{ end }}
</div>
{{ end }}

View File

@ -0,0 +1,20 @@
{{ $fields := (index .Params 0) }}
{{ $data := after 1 .Params }}
<table class="pure-table pure-table-striped">
<thead><tr>
{{ range split $fields "|"}}
<th>{{ . }}</th>
{{ end }}
</thead></tr>
<tbody>
{{ range $data}}
<tr>
{{ $items := split . "|" }}
{{ range $items }}
<td>{{ . }}</td>
{{ end }}
</tr>
{{ end }}
</tbody>
</table>

View File

@ -0,0 +1,13 @@
{{ partial "header.html" . }}
<div class="header">
<h1>{{ .Title }}</h1>
</div>
<div class="content">
{{ range .Data.Pages }}
{{ .Render "summary"}}
{{ end }}
</div>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,13 @@
{{ partial "header.html" . }}
<div class="header">
<h1>{{ .Title }}</h1>
</div>
<div class="content">
{{ range .Data.Pages }}
{{ .Render "summary"}}
{{ end }}
</div>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,89 @@
.header {
font-family: "Raleway", Helvetica, Arial, sans-serif
}
a {
color: #3b8bba;
text-decoration: none;
}
a:hover,
a:focus {
text-decoration: underline;
}
a:visited {
color: #265778;
}
.small-print {
font-size: 0.8em;
margin: 0.6em;
}
.post-meta {
font-size: 90%;
}
article > footer {
text-align: right;
}
.prev-next-post {
margin-top: 2em;
padding-top: 2em;
padding-bottom: 2em;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
}
.prev-next-post .prev {
float: left;
text-align: left;
overflow: hidden;
}
.prev-next-post .next {
float: right;
text-align: right;
overflow: hidden;
}
#menu {
overflow-y: visible;
}
#menu a {
padding: 0.6em;
}
#menu .brand {
font-family: Raleway;
font-weight: bold;
font-size: 1em;
letter-spacing: 0.1em;
text-transform: none;
background: transparent;
text-decoration: none;
margin: 0.5em 0;
}
#menu .pure-menu {
font-size: 0.9em;
}
#menu .pure-menu ul.pure-menu-children {
border-top: none;
}
i {
display: inline-block;
margin-right: 0.2em;
}
.pagination {
text-align: center;
margin-top: 3em;
}
.pagination a {
color: #265778;
}

View File

@ -0,0 +1,255 @@
body {
color: #777;
}
.pure-img-responsive {
max-width: 100%;
height: auto;
}
/*
Add transition to containers so they can push in and out.
*/
#layout,
#menu,
.menu-link {
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
-ms-transition: all 0.2s ease-out;
-o-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
/*
This is the parent `<div>` that contains the menu and the content area.
*/
#layout {
position: relative;
left: 0;
padding-left: 0;
}
#layout.active #menu {
left: 150px;
width: 150px;
}
#layout.active .menu-link {
left: 150px;
}
/*
The content `<div>` is where all your content goes.
*/
.content {
margin: 0 auto;
padding: 0 2em;
max-width: 800px;
margin-bottom: 50px;
line-height: 1.6em;
}
.header {
margin: 0;
color: #333;
text-align: center;
padding: 2.5em 2em 0;
border-bottom: 1px solid #eee;
}
.header h1 {
margin: 0.2em 0;
font-size: 3em;
font-weight: 300;
}
.header h2 {
font-weight: 300;
color: #ccc;
padding: 0;
margin-top: 0;
}
.content-subhead {
margin: 50px 0 20px 0;
font-weight: 300;
color: #888;
}
/*
The `#menu` `<div>` is the parent `<div>` that contains the `.pure-menu` that
appears on the left side of the page.
*/
#menu {
margin-left: -150px;
/* "#menu" width */
width: 150px;
position: fixed;
top: 0;
left: 0;
bottom: 0;
z-index: 1000;
/* so the menu or its navicon stays above all content */
background: #191818;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
/*
All anchors inside the menu should be styled like this.
*/
#menu a {
color: #999;
border: none;
padding: 0.6em 0 0.6em 0.6em;
}
/*
Remove all background/borders, since we are applying them to #menu.
*/
#menu .pure-menu,
#menu .pure-menu ul {
border: none;
background: transparent;
}
/*
Add that light border to separate items into groups.
*/
#menu .pure-menu ul,
#menu .pure-menu .menu-item-divided {
border-top: 1px solid #333;
}
/*
Change color of the anchor links on hover/focus.
*/
#menu .pure-menu li a:hover,
#menu .pure-menu li a:focus {
background: #333;
}
/*
This styles the selected menu item `<li>`.
*/
#menu .pure-menu-selected,
#menu .pure-menu-heading {
background: #1f8dd6;
}
/*
This styles a link within a selected menu item `<li>`.
*/
#menu .pure-menu-selected a {
color: #fff;
}
/*
This styles the menu heading.
*/
#menu .pure-menu-heading {
font-size: 110%;
color: #fff;
margin: 0;
}
/* -- Dynamic Button For Responsive Menu -------------------------------------*/
/*
The button to open/close the Menu is custom-made and not part of Pure. Here's
how it works:
*/
/*
`.menu-link` represents the responsive menu toggle that shows/hides on
small screens.
*/
.menu-link {
position: fixed;
display: block;
/* show this only on small screens */
top: 0;
left: 0;
/* "#menu width" */
background: #000;
background: rgba(0,0,0,0.7);
font-size: 10px;
/* change this value to increase/decrease button size */
z-index: 10;
width: 2em;
height: auto;
padding: 2.1em 1.6em;
}
.menu-link:hover,
.menu-link:focus {
background: #000;
}
.menu-link span {
position: relative;
display: block;
}
.menu-link span,
.menu-link span:before,
.menu-link span:after {
background-color: #fff;
width: 100%;
height: 0.2em;
}
.menu-link span:before,
.menu-link span:after {
position: absolute;
margin-top: -0.6em;
content: " ";
}
.menu-link span:after {
margin-top: 0.6em;
}
/* -- Responsive Styles (Media Queries) ------------------------------------- */
/*
Hides the menu at `48em`, but modify this based on your app's needs.
*/
.header,
.content {
padding-left: 2em;
padding-right: 2em;
}
#layout {
padding-left: 150px;
/* left col width "#menu" */
left: 0;
}
#menu {
left: 150px;
}
.menu-link {
position: fixed;
left: 150px;
display: none;
}
#layout.active .menu-link {
left: 150px;
}

View File

@ -0,0 +1,248 @@
body {
color: #777;
}
.pure-img-responsive {
max-width: 100%;
height: auto;
}
/*
Add transition to containers so they can push in and out.
*/
#layout,
#menu,
.menu-link {
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
-ms-transition: all 0.2s ease-out;
-o-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
/*
This is the parent `<div>` that contains the menu and the content area.
*/
#layout {
position: relative;
left: 0;
padding-left: 0;
}
#layout.active #menu {
left: 150px;
width: 150px;
}
#layout.active .menu-link {
left: 150px;
}
/*
The content `<div>` is where all your content goes.
*/
.content {
margin: 0 auto;
padding: 0 2em;
max-width: 800px;
margin-bottom: 50px;
line-height: 1.6em;
}
.header {
margin: 0;
color: #333;
text-align: center;
padding: 2.5em 2em 0;
border-bottom: 1px solid #eee;
}
.header h1 {
margin: 0.2em 0;
font-size: 3em;
font-weight: 300;
}
.header h2 {
font-weight: 300;
color: #ccc;
padding: 0;
margin-top: 0;
}
.content-subhead {
margin: 50px 0 20px 0;
font-weight: 300;
color: #888;
}
/*
The `#menu` `<div>` is the parent `<div>` that contains the `.pure-menu` that
appears on the left side of the page.
*/
#menu {
margin-left: -150px; /* "#menu" width */
width: 150px;
position: fixed;
top: 0;
left: 0;
bottom: 0;
z-index: 1000; /* so the menu or its navicon stays above all content */
background: #191818;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
/*
All anchors inside the menu should be styled like this.
*/
#menu a {
color: #999;
border: none;
padding: 0.6em 0 0.6em 0.6em;
}
/*
Remove all background/borders, since we are applying them to #menu.
*/
#menu .pure-menu,
#menu .pure-menu ul {
border: none;
background: transparent;
}
/*
Add that light border to separate items into groups.
*/
#menu .pure-menu ul,
#menu .pure-menu .menu-item-divided {
border-top: 1px solid #333;
}
/*
Change color of the anchor links on hover/focus.
*/
#menu .pure-menu li a:hover,
#menu .pure-menu li a:focus {
background: #333;
}
/*
This styles the selected menu item `<li>`.
*/
#menu .pure-menu-selected,
#menu .pure-menu-heading {
background: #1f8dd6;
}
/*
This styles a link within a selected menu item `<li>`.
*/
#menu .pure-menu-selected a {
color: #fff;
}
/*
This styles the menu heading.
*/
#menu .pure-menu-heading {
font-size: 110%;
color: #fff;
margin: 0;
}
/* -- Dynamic Button For Responsive Menu -------------------------------------*/
/*
The button to open/close the Menu is custom-made and not part of Pure. Here's
how it works:
*/
/*
`.menu-link` represents the responsive menu toggle that shows/hides on
small screens.
*/
.menu-link {
position: fixed;
display: block; /* show this only on small screens */
top: 0;
left: 0; /* "#menu width" */
background: #000;
background: rgba(0,0,0,0.7);
font-size: 10px; /* change this value to increase/decrease button size */
z-index: 10;
width: 2em;
height: auto;
padding: 2.1em 1.6em;
}
.menu-link:hover,
.menu-link:focus {
background: #000;
}
.menu-link span {
position: relative;
display: block;
}
.menu-link span,
.menu-link span:before,
.menu-link span:after {
background-color: #fff;
width: 100%;
height: 0.2em;
}
.menu-link span:before,
.menu-link span:after {
position: absolute;
margin-top: -0.6em;
content: " ";
}
.menu-link span:after {
margin-top: 0.6em;
}
/* -- Responsive Styles (Media Queries) ------------------------------------- */
/*
Hides the menu at `48em`, but modify this based on your app's needs.
*/
@media (min-width: 48em) {
.header,
.content {
padding-left: 2em;
padding-right: 2em;
}
#layout {
padding-left: 150px; /* left col width "#menu" */
left: 0;
}
#menu {
left: 150px;
}
.menu-link {
position: fixed;
left: 150px;
display: none;
}
#layout.active .menu-link {
left: 150px;
}
}
@media (max-width: 48em) {
/* Only apply this when the window is small. Otherwise, the following
case results in extra padding on the left:
* Make the window small.
* Tap the menu to trigger the active state.
* Make the window large again.
*/
#layout.active {
position: relative;
left: 150px;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

@ -0,0 +1,172 @@
(function (window, document) {
'use strict';
// Enable drop-down menus in Pure
// Inspired by YUI3 gallery-simple-menu by Julien LeComte
// [https://github.com/yui/yui3-gallery/blob/master/src/gallery-simple-menu/js/simple-menu.js]
function PureDropdown(dropdownParent) {
var PREFIX = 'pure-',
ACTIVE_CLASS_NAME = PREFIX + 'menu-active',
ARIA_ROLE = 'role',
ARIA_HIDDEN = 'aria-hidden',
MENU_OPEN = 0,
MENU_CLOSED = 1,
MENU_PARENT_CLASS_NAME = 'pure-menu-has-children',
MENU_ACTIVE_SELECTOR = '.pure-menu-active',
MENU_LINK_SELECTOR = '.pure-menu-link',
MENU_SELECTOR = '.pure-menu-children',
DISMISS_EVENT = (window.hasOwnProperty &&
window.hasOwnProperty('ontouchstart')) ?
'touchstart' : 'mousedown',
ARROW_KEYS_ENABLED = true,
ddm = this; // drop down menu
this._state = MENU_CLOSED;
this.show = function () {
if (this._state !== MENU_OPEN) {
this._dropdownParent.classList.add(ACTIVE_CLASS_NAME);
this._menu.setAttribute(ARIA_HIDDEN, false);
this._state = MENU_OPEN;
}
};
this.hide = function () {
if (this._state !== MENU_CLOSED) {
this._dropdownParent.classList.remove(ACTIVE_CLASS_NAME);
this._menu.setAttribute(ARIA_HIDDEN, true);
this._link.focus();
this._state = MENU_CLOSED;
}
};
this.toggle = function () {
this[this._state === MENU_CLOSED ? 'show' : 'hide']();
};
this.halt = function (e) {
e.stopPropagation();
e.preventDefault();
};
this._dropdownParent = dropdownParent;
this._link = this._dropdownParent.querySelector(MENU_LINK_SELECTOR);
this._menu = this._dropdownParent.querySelector(MENU_SELECTOR);
this._firstMenuLink = this._menu.querySelector(MENU_LINK_SELECTOR);
// Set ARIA attributes
this._link.setAttribute('aria-haspopup', 'true');
this._menu.setAttribute(ARIA_ROLE, 'menu');
this._menu.setAttribute('aria-labelledby', this._link.getAttribute('id'));
this._menu.setAttribute('aria-hidden', 'true');
[].forEach.call(
this._menu.querySelectorAll('li'),
function(el){
el.setAttribute(ARIA_ROLE, 'presentation');
}
);
[].forEach.call(
this._menu.querySelectorAll('a'),
function(el){
el.setAttribute(ARIA_ROLE, 'menuitem');
}
);
// Toggle on click
this._link.addEventListener('click', function (e) {
e.stopPropagation();
e.preventDefault();
ddm.toggle();
});
// Keyboard navigation
document.addEventListener('keydown', function (e) {
var currentLink,
previousSibling,
nextSibling,
previousLink,
nextLink;
// if the menu isn't active, ignore
if (ddm._state !== MENU_OPEN) {
return;
}
// if the menu is the parent of an open, active submenu, ignore
if (ddm._menu.querySelector(MENU_ACTIVE_SELECTOR)) {
return;
}
currentLink = ddm._menu.querySelector(':focus');
// Dismiss an open menu on ESC
if (e.keyCode === 27) {
/* Esc */
ddm.halt(e);
ddm.hide();
}
// Go to the next link on down arrow
else if (ARROW_KEYS_ENABLED && e.keyCode === 40) {
/* Down arrow */
ddm.halt(e);
// get the nextSibling (an LI) of the current link's LI
nextSibling = (currentLink) ? currentLink.parentNode.nextSibling : null;
// if the nextSibling is a text node (not an element), go to the next one
while (nextSibling && nextSibling.nodeType !== 1) {
nextSibling = nextSibling.nextSibling;
}
nextLink = (nextSibling) ? nextSibling.querySelector('.pure-menu-link') : null;
// if there is no currently focused link, focus the first one
if (!currentLink) {
ddm._menu.querySelector('.pure-menu-link').focus();
}
else if (nextLink) {
nextLink.focus();
}
}
// Go to the previous link on up arrow
else if (ARROW_KEYS_ENABLED && e.keyCode === 38) {
/* Up arrow */
ddm.halt(e);
// get the currently focused link
previousSibling = (currentLink) ? currentLink.parentNode.previousSibling : null;
while (previousSibling && previousSibling.nodeType !== 1) {
previousSibling = previousSibling.previousSibling;
}
previousLink = (previousSibling) ? previousSibling.querySelector('.pure-menu-link') : null;
// if there is no currently focused link, focus the last link
if (!currentLink) {
ddm._menu.querySelector('.pure-menu-item:last-child .pure-menu-link').focus();
}
// else if there is a previous item, go to the previous item
else if (previousLink) {
previousLink.focus();
}
}
});
// Dismiss an open menu on outside event
document.addEventListener(DISMISS_EVENT, function (e) {
var target = e.target;
if (target !== ddm._link && !ddm._menu.contains(target)) {
ddm.hide();
ddm._link.blur();
}
});
}
function initDropdowns() {
var dropdownParents = document.querySelectorAll('.pure-menu-has-children');
for (var i = 0; i < dropdownParents.length; i++) {
var ddm = new PureDropdown(dropdownParents[i]);
}
}
initDropdowns();
}(this, this.document));

View File

@ -0,0 +1,46 @@
(function (window, document) {
var layout = document.getElementById('layout'),
menu = document.getElementById('menu'),
menuLink = document.getElementById('menuLink'),
content = document.getElementById('main');
function toggleClass(element, className) {
var classes = element.className.split(/\s+/),
length = classes.length,
i = 0;
for(; i < length; i++) {
if (classes[i] === className) {
classes.splice(i, 1);
break;
}
}
// The className is not found
if (length === classes.length) {
classes.push(className);
}
element.className = classes.join(' ');
}
function toggleAll(e) {
var active = 'active';
e.preventDefault();
toggleClass(layout, active);
toggleClass(menu, active);
toggleClass(menuLink, active);
}
menuLink.onclick = function (e) {
toggleAll(e);
};
content.onclick = function(e) {
if (menu.className.indexOf('active') !== -1) {
toggleAll(e);
}
};
}(this, this.document));

View File

@ -0,0 +1,18 @@
name = "Blackburn"
license = "MIT"
licenselink = "https://github.com/yoshiharuyamashita/blackburn/blob/master/LICENSE.md"
description = "A clear, responsive theme constructed using Pure CSS from Yahoo"
homepage = "https://github.com/yoshiharuyamashita/blackburn"
tags = ["blog", "personal", "purecss", "responsive"]
features = ["blog", "personal", "purecss", "responsive"]
min_version = 0.15
[author]
name = "Yoshiharu Yamashita"
homepage = "http://yoshiharuyamashita.com"
# If porting an existing theme
[original]
name = "Responsive side menu"
homepage = "http://purecss.io/layouts/"
repo = "https://github.com/yahoo/pure"