├── static
├── robots.txt
├── favicon.ico
├── icons
│ ├── icon-16x16.png
│ ├── icon-32x32.png
│ ├── icon-128x128.png
│ ├── icon-144x144.png
│ ├── icon-152x152.png
│ ├── icon-192x192.png
│ ├── icon-256x256.png
│ └── icon-512x512.png
└── manifest.json
├── images
├── tn.png
└── screenshot.png
├── assets
├── images
│ ├── avatar.png
│ ├── poster.jpg
│ ├── qrcode.jpg
│ └── grey-prism.svg
├── styles
│ ├── custom.scss
│ ├── main.scss
│ └── partials
│ │ ├── _paginator.scss
│ │ ├── _links.scss
│ │ ├── _resume.scss
│ │ ├── _terms.scss
│ │ ├── _shortcodes.scss
│ │ ├── _misc.scss
│ │ ├── _summary.scss
│ │ ├── _posts.scss
│ │ ├── _table.scss
│ │ ├── _icons.scss
│ │ ├── _variables.scss
│ │ ├── _skeleton.scss
│ │ ├── _header.scss
│ │ ├── _syntax.scss
│ │ ├── _content.scss
│ │ └── _reset.scss
├── scripts
│ └── index.js
└── service-worker-template.js
├── .prettierrc
├── exampleSite
├── content
│ ├── media
│ │ ├── cover.jpg
│ │ ├── links
│ │ │ ├── chekun.jpg
│ │ │ ├── wangbo.jpg
│ │ │ ├── kandisheng.jpg
│ │ │ └── yuanxuxu.jpg
│ │ └── posts
│ │ │ └── hugo-nuo-post-preview
│ │ │ ├── 01.jpg
│ │ │ ├── videojs.mp4
│ │ │ ├── videojs.ogv
│ │ │ └── videojs.webm
│ ├── resume.md
│ ├── links.md
│ ├── about.md
│ └── post
│ │ ├── hugoisforlovers.md
│ │ ├── hugo-nuo-post-preview.md
│ │ ├── migrate-from-jekyll.md
│ │ └── goisforlovers.md
├── data
│ ├── links.toml
│ └── resume.toml
└── config.toml
├── .gitignore
├── resources
└── _gen
│ └── assets
│ ├── scss
│ └── styles
│ │ ├── main.scss_b95b077eb505d5c0aff8055eaced30ad.json
│ │ └── main.scss_b95b077eb505d5c0aff8055eaced30ad.content
│ └── js
│ └── scripts
│ ├── index.js_d3f53f09220d597dac26fe7840c31fc9.json
│ └── index.js_d3f53f09220d597dac26fe7840c31fc9.content
├── .editorconfig
├── archetypes
└── post.md
├── layouts
├── 404.html
├── partials
│ ├── polyfill.html
│ ├── gitment.html
│ ├── footer.html
│ ├── head.html
│ └── header.html
├── post
│ ├── summary.html
│ └── single.html
├── _default
│ ├── archives.html
│ ├── links.html
│ ├── terms.html
│ ├── list.html
│ ├── baseof.html
│ ├── about.html
│ └── resume.html
├── index.html
└── shortcodes
│ ├── shengxiang.html
│ ├── music.html
│ ├── jsfiddle.html
│ ├── codepen.html
│ ├── video.html
│ └── asciinema.html
├── theme.toml
├── LICENSE.md
└── README.md
/static/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Allow: /
3 |
--------------------------------------------------------------------------------
/images/tn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/images/tn.png
--------------------------------------------------------------------------------
/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/static/favicon.ico
--------------------------------------------------------------------------------
/images/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/images/screenshot.png
--------------------------------------------------------------------------------
/assets/images/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/assets/images/avatar.png
--------------------------------------------------------------------------------
/assets/images/poster.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/assets/images/poster.jpg
--------------------------------------------------------------------------------
/assets/images/qrcode.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/assets/images/qrcode.jpg
--------------------------------------------------------------------------------
/assets/styles/custom.scss:
--------------------------------------------------------------------------------
1 | @import 'partials/variables';
2 |
3 | /* Override theme styles here */
4 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 100,
3 | "singleQuote": true,
4 | "trailingComma": "all"
5 | }
6 |
--------------------------------------------------------------------------------
/static/icons/icon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/static/icons/icon-16x16.png
--------------------------------------------------------------------------------
/static/icons/icon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/static/icons/icon-32x32.png
--------------------------------------------------------------------------------
/static/icons/icon-128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/static/icons/icon-128x128.png
--------------------------------------------------------------------------------
/static/icons/icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/static/icons/icon-144x144.png
--------------------------------------------------------------------------------
/static/icons/icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/static/icons/icon-152x152.png
--------------------------------------------------------------------------------
/static/icons/icon-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/static/icons/icon-192x192.png
--------------------------------------------------------------------------------
/static/icons/icon-256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/static/icons/icon-256x256.png
--------------------------------------------------------------------------------
/static/icons/icon-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/static/icons/icon-512x512.png
--------------------------------------------------------------------------------
/exampleSite/content/media/cover.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/exampleSite/content/media/cover.jpg
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | npm-debug.log*
3 | yarn-error.log
4 | yarn.lock
5 | package-lock.json
6 | /.vscode
7 | /node_modules
8 |
--------------------------------------------------------------------------------
/exampleSite/content/media/links/chekun.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/exampleSite/content/media/links/chekun.jpg
--------------------------------------------------------------------------------
/exampleSite/content/media/links/wangbo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/exampleSite/content/media/links/wangbo.jpg
--------------------------------------------------------------------------------
/exampleSite/content/resume.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Resume"
3 | date: 2017-12-01
4 | layout: "resume"
5 | ---
6 |
7 | This is my resume.
8 |
--------------------------------------------------------------------------------
/exampleSite/content/media/links/kandisheng.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/exampleSite/content/media/links/kandisheng.jpg
--------------------------------------------------------------------------------
/exampleSite/content/media/links/yuanxuxu.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/exampleSite/content/media/links/yuanxuxu.jpg
--------------------------------------------------------------------------------
/resources/_gen/assets/scss/styles/main.scss_b95b077eb505d5c0aff8055eaced30ad.json:
--------------------------------------------------------------------------------
1 | {"Target":"styles/main.min.css","MediaType":"text/css","Data":{}}
--------------------------------------------------------------------------------
/resources/_gen/assets/js/scripts/index.js_d3f53f09220d597dac26fe7840c31fc9.json:
--------------------------------------------------------------------------------
1 | {"Target":"scripts/index.min.js","MediaType":"application/javascript","Data":{}}
--------------------------------------------------------------------------------
/exampleSite/content/media/posts/hugo-nuo-post-preview/01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/exampleSite/content/media/posts/hugo-nuo-post-preview/01.jpg
--------------------------------------------------------------------------------
/exampleSite/content/links.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Links"
3 | date: "2014-04-09"
4 | layout: "links"
5 | menu: "main"
6 | weight: 40
7 | ---
8 |
9 | Ritchie and his friends.
10 |
--------------------------------------------------------------------------------
/exampleSite/content/media/posts/hugo-nuo-post-preview/videojs.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/exampleSite/content/media/posts/hugo-nuo-post-preview/videojs.mp4
--------------------------------------------------------------------------------
/exampleSite/content/media/posts/hugo-nuo-post-preview/videojs.ogv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/exampleSite/content/media/posts/hugo-nuo-post-preview/videojs.ogv
--------------------------------------------------------------------------------
/exampleSite/content/media/posts/hugo-nuo-post-preview/videojs.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laozhu/hugo-nuo/HEAD/exampleSite/content/media/posts/hugo-nuo-post-preview/videojs.webm
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
--------------------------------------------------------------------------------
/archetypes/post.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "{{ replace .TranslationBaseName "-" " " | title }}"
3 | author: "Author Name"
4 | cover: "/images/cover.jpg"
5 | tags: ["tagA", "tagB"]
6 | date: {{ .Date }}
7 | draft: true
8 | ---
9 |
10 | Cut out summary from your post content here.
11 |
12 |
13 |
14 | The remaining content of your post.
15 |
--------------------------------------------------------------------------------
/layouts/404.html:
--------------------------------------------------------------------------------
1 | {{ define "title" }}Page not found{{ end }}
2 |
3 | {{ define "main" }}
4 | {{ $script := resources.Get "scripts/index.js" | resources.Minify }}
5 |
10 |
11 | {{ end }}
12 |
--------------------------------------------------------------------------------
/exampleSite/content/about.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "About"
3 | date: "2014-04-09"
4 | layout: "about"
5 | menu: "main"
6 | weight: 50
7 | ---
8 |
9 | Hugo is a static site engine written in Go.
10 |
11 |
12 | It makes use of a variety of open source projects including:
13 |
14 | * [Cobra](https://github.com/spf13/cobra)
15 | * [Viper](https://github.com/spf13/viper)
16 | * [J Walter Weatherman](https://github.com/spf13/jWalterWeatherman)
17 | * [Cast](https://github.com/spf13/cast)
18 |
19 | Learn more and contribute on [GitHub](https://github.com/gohugoio).
20 |
21 |
--------------------------------------------------------------------------------
/layouts/partials/polyfill.html:
--------------------------------------------------------------------------------
1 |
2 | {{ `` | safeHTML }}
7 |
8 | {{ `` | safeHTML }}
11 |
--------------------------------------------------------------------------------
/assets/styles/main.scss:
--------------------------------------------------------------------------------
1 | @import 'partials/reset';
2 | @import 'partials/variables';
3 | {{- with .Site.Params.fontAwesome -}}
4 | {{- else -}}
5 | @import 'partials/icons';
6 | {{- end -}}
7 | @import 'partials/skeleton';
8 | @import 'partials/header';
9 | @import 'partials/summary';
10 | @import 'partials/paginator';
11 | @import 'partials/posts';
12 | @import 'partials/content';
13 | @import 'partials/shortcodes';
14 | @import 'partials/table';
15 | @import 'partials/syntax';
16 | @import 'partials/links';
17 | @import 'partials/misc';
18 | @import 'partials/terms';
19 | @import 'partials/resume';
20 |
--------------------------------------------------------------------------------
/theme.toml:
--------------------------------------------------------------------------------
1 | # theme.toml template for a Hugo theme
2 | # See https://github.com/gohugoio/hugoThemes#themetoml for an example
3 |
4 | name = "Hugo Nuo"
5 | license = "MIT"
6 | licenselink = "https://github.com/laozhu/hugo-nuo/blob/master/LICENSE"
7 | description = "An responsive light & clean hugo theme for blogger."
8 | homepage = "http://github.com/laozhu/hugo-nuo"
9 | tags = ["Responsive", "Lightweight", "Clean", "Customizable"]
10 | features = ["Blog", "Works", "Gallery", "Tags", "Portfolio"]
11 | min_version = "0.50"
12 |
13 | [author]
14 | name = "Ritchie Zhu"
15 | homepage = "https://laozhu.me"
16 |
--------------------------------------------------------------------------------
/exampleSite/data/links.toml:
--------------------------------------------------------------------------------
1 | [chekun]
2 | title = "chekun's blog"
3 | link = "https://chekun.me"
4 | avatar = "/media/links/chekun.jpg"
5 | description = "A full-stack developer"
6 |
7 | [wangbo]
8 | title = "Boof Wang"
9 | link = "http://boof.wang"
10 | avatar = "/media/links/wangbo.jpg"
11 | description = "Another full-stack developer"
12 |
13 | [yuanxuxu]
14 | title = "Ryan's blog"
15 | link = "https://yuanxuxu.com/"
16 | avatar = "/media/links/yuanxuxu.jpg"
17 | description = "A interesting developer"
18 |
19 | [candisheng]
20 | title = "Kan Disheng"
21 | link = "http://www.kandisheng.com/"
22 | avatar = "/media/links/kandisheng.jpg"
23 | description = "A crazy developer"
24 |
--------------------------------------------------------------------------------
/layouts/post/summary.html:
--------------------------------------------------------------------------------
1 |
2 |
6 | {{ if isset .Params "cover" }}
7 |
8 | {{ end }}
9 | {{ .Summary | plainify | htmlUnescape }}
10 |
13 |
14 |
--------------------------------------------------------------------------------
/assets/styles/partials/_paginator.scss:
--------------------------------------------------------------------------------
1 | .pagination {
2 | position: relative;
3 | height: calc(2.9rem + 2px);
4 |
5 | & a {
6 | color: $text;
7 | }
8 |
9 | & .pagination-previous,
10 | & .pagination-next {
11 | position: absolute;
12 | padding: 1rem;
13 | background-color: $white;
14 | border: 1px solid $border;
15 | font-size: 0.8rem;
16 | line-height: 1;
17 | text-transform: uppercase;
18 |
19 | &:focus,
20 | &:hover {
21 | color: $white;
22 | background-color: $primary;
23 | border-color: $primary;
24 | }
25 | }
26 |
27 | & .pagination-previous {
28 | top: 0;
29 | left: 0;
30 | }
31 |
32 | & .pagination-next {
33 | top: 0;
34 | right: 0;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/layouts/_default/archives.html:
--------------------------------------------------------------------------------
1 | {{ define "title" -}}
2 | {{ .Title }} | {{ .Site.Params.seotitle | default .Site.Title }}
3 | {{- end }}
4 |
5 | {{ define "main" }}
6 | {{ partial "header.html" . }}
7 |
8 |
11 | {{ range (where .Site.RegularPages "Type" "post").GroupByDate "Jan 2006" -}}
12 | {{ .Key }}
13 |
14 | {{ range .Pages -}}
15 | {{ .Title }} ({{ .Date.Format "Jan 2, 2006" }})
16 | {{ end -}}
17 |
18 | {{ end -}}
19 |
20 | {{ partial "footer.html" . }}
21 | {{ end }}
22 |
--------------------------------------------------------------------------------
/layouts/_default/links.html:
--------------------------------------------------------------------------------
1 | {{ define "title" }}
2 | {{ .Title }} | {{ if isset .Site.Params "seotitle" }}{{ .Site.Params.seotitle }}{{ else }}{{ .Site.Title }}{{ end }}
3 | {{ end }}
4 |
5 | {{ define "main" }}
6 | {{ partial "header.html" . }}
7 |
8 |
11 | {{ range $.Site.Data.links }}
12 |
13 |
14 | {{ .title }}
15 | {{ .description }}
16 |
17 | {{ end }}
18 |
19 | {{ partial "footer.html" . }}
20 | {{ end }}
21 |
--------------------------------------------------------------------------------
/layouts/_default/terms.html:
--------------------------------------------------------------------------------
1 | {{ define "title" }}
2 | Tags | {{ if isset .Site.Params "seotitle" }}{{ .Site.Params.seotitle }}{{ else }}{{ .Site.Title }}{{ end }}
3 | {{ end }}
4 |
5 | {{ define "main" }}
6 | {{ partial "header.html" . }}
7 |
19 | {{ partial "footer.html" . }}
20 | {{ end }}
21 |
--------------------------------------------------------------------------------
/static/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Ritchie Pub.",
3 | "short_name": "ritchie",
4 | "display": "standalone",
5 | "orientation": "any",
6 | "start_url": "./?utm_source=homescreen",
7 | "theme_color": "#02b875",
8 | "background_color": "#fafafa",
9 | "icons": [
10 | {
11 | "src": "icons/icon-128x128.png",
12 | "sizes": "128x128",
13 | "type": "image/png"
14 | },
15 | {
16 | "src": "icons/icon-144x144.png",
17 | "sizes": "144x144",
18 | "type": "image/png"
19 | },
20 | {
21 | "src": "icons/icon-152x152.png",
22 | "sizes": "152x152",
23 | "type": "image/png"
24 | },
25 | {
26 | "src": "icons/icon-192x192.png",
27 | "sizes": "192x192",
28 | "type": "image/png"
29 | },
30 | {
31 | "src": "icons/icon-256x256.png",
32 | "sizes": "256x256",
33 | "type": "image/png"
34 | },
35 | {
36 | "src": "icons/icon-512x512.png",
37 | "sizes": "512x512",
38 | "type": "image/png"
39 | }
40 | ]
41 | }
42 |
--------------------------------------------------------------------------------
/assets/styles/partials/_links.scss:
--------------------------------------------------------------------------------
1 | .links-list {
2 | font-size: 0;
3 | text-align: center;
4 |
5 | & .link-item {
6 | margin: 1.5rem auto;
7 | display: inline-block;
8 | width: 25%;
9 | box-sizing: border-box;
10 |
11 | & + .link-item {
12 | padding-left: 1rem;
13 | }
14 |
15 | & .link-avatar {
16 | width: 100px;
17 | height: 100px;
18 | border-radius: 50%;
19 | border: 2px solid $media-border;
20 | box-shadow: 0 1px 4px $box-shadow-darker;
21 | transition: transform $easing $speed;
22 |
23 | &:hover {
24 | transform: rotate(45deg);
25 | }
26 | }
27 |
28 | & .link-title {
29 | font-size: $size-6;
30 | text-overflow: ellipsis;
31 | overflow: hidden;
32 | white-space: nowrap;
33 | min-width: 100px;
34 | }
35 |
36 | & .link-description {
37 | font-size: $size-7;
38 | text-overflow: ellipsis;
39 | overflow: hidden;
40 | white-space: nowrap;
41 | min-width: 100px;
42 | }
43 |
44 | @media screen and (max-width: $tablet) {
45 | width: 50%;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 Ritchie Zhu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/layouts/index.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }} {{ partial "header.html" . }}
2 |
3 |
6 | {{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") (index .Site.Params "paginate" | default 10) }}
7 | {{ if ne $paginator.TotalPages 0 }}
8 | {{ range $paginator.Pages.ByDate.Reverse }} {{ .Render "summary" }} {{ end }}
9 | {{ else }}
10 | There's nothing here. Create an interesting post with the command:
11 | $ hugo new post/hello-world.md
12 | {{ end }} {{ if gt $paginator.TotalPages 1 }}
13 |
23 | {{ end }}
24 |
25 | {{ partial "footer.html" . }} {{ end }}
26 |
--------------------------------------------------------------------------------
/assets/styles/partials/_resume.scss:
--------------------------------------------------------------------------------
1 | .resume {
2 | font-family: $family-sans-serif !important;
3 |
4 | & h2 {
5 | text-align: center;
6 | }
7 |
8 | & ul.contact {
9 | display: flex;
10 | flex-wrap: wrap;
11 | align-items: center;
12 | justify-content: space-around;
13 | text-align: center;
14 | }
15 |
16 | & ul.contact li {
17 | list-style-type: none;
18 | }
19 |
20 | & h3 {
21 | border-bottom: 1px solid $border;
22 | width: 100%;
23 | text-transform: uppercase;
24 | color: $green;
25 | }
26 |
27 | & .upper-row {
28 | display: flex;
29 | flex-wrap: wrap;
30 | align-items: center;
31 | justify-content: space-between;
32 | width: 100%;
33 |
34 | & h4 {
35 | margin-top: 0;
36 | margin-bottom: 0;
37 | }
38 | }
39 |
40 | & .job-title {
41 | color: $text-strong;
42 | font-weight: $weight-bold;
43 | }
44 |
45 | & .year {
46 | color: $text-light;
47 | }
48 |
49 | & .school {
50 | color: $text-light;
51 | }
52 |
53 | & .company {
54 | color: $text-light;
55 | font-size: 0.8em;
56 | }
57 |
58 | @media print, screen and (max-width: $tablet) {
59 | width: 100%;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/assets/styles/partials/_terms.scss:
--------------------------------------------------------------------------------
1 | .terms-list {
2 | & .tags-cloud {
3 | margin: 2em auto;
4 |
5 | & a {
6 | display: inline-block;
7 | position: relative;
8 | text-decoration: none;
9 | opacity: 1;
10 | border-radius: 5px;
11 |
12 | &.tag-s {
13 | color: $grey;
14 | font-size: 1rem;
15 | line-height: 2rem;
16 | padding: 0 0.5rem;
17 | opacity: 0.8;
18 | }
19 |
20 | &.tag-m {
21 | color: $grey-dark;
22 | font-size: 1.25rem;
23 | line-height: 2.5rem;
24 | padding: 0 0.75rem;
25 | opacity: 0.9;
26 | }
27 |
28 | &.tag-l {
29 | color: $grey-darker;
30 | font-size: 1.5rem;
31 | line-height: 3rem;
32 | padding: 0 1rem;
33 | }
34 |
35 | &.tag-xl {
36 | color: $black-ter;
37 | font-size: 1.75rem;
38 | line-height: 3.25rem;
39 | padding: 0 1.25rem;
40 | }
41 |
42 | &.tag-xxl {
43 | color: $primary;
44 | font-size: 2rem;
45 | line-height: 3.5rem;
46 | padding: 0 1.5rem;
47 | }
48 |
49 | &:hover {
50 | color: $white;
51 | background-color: $primary;
52 | opacity: 0.8;
53 | }
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/layouts/partials/gitment.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
--------------------------------------------------------------------------------
/layouts/shortcodes/shengxiang.html:
--------------------------------------------------------------------------------
1 | {{/*
2 |
3 | ## Sheng Xiang PPT
4 |
5 | ### Params:
6 |
7 | - `id`
8 |
9 | required param
10 | you can extract from shengxiang url
11 | url format "https://ppt.baomitu.com/d/a8a49a00#/"
12 |
13 | - Fiddle `style`
14 |
15 | optional param
16 | default value "light"
17 | you can overwrite it with "dark"
18 |
19 | ### Examples:
20 |
21 | - Simple
22 |
23 | {{% shengxiang "a8a49a00" %}}
24 | {{% shengxiang "a8a49a00" "dark" %}}
25 |
26 | - Named Params
27 |
28 | {{% shengxiang id="a8a49a00" %}}
29 | {{% shengxiang id="a8a49a00" style="dark" %}}
30 |
31 | */}}
32 |
33 | {{/* DEFAULTS */}}
34 | {{ $style := "light" }}
35 |
36 | {{ if .IsNamedParams }}
37 |
38 |
47 |
48 | {{ else }}
49 |
50 |
59 |
60 | {{ end }}
61 |
--------------------------------------------------------------------------------
/layouts/shortcodes/music.html:
--------------------------------------------------------------------------------
1 | {{/*
2 |
3 | ## Music 163
4 |
5 | ### Because of music copyright issue, this shortcode is invalid now.
6 | ### 由于音乐版权问题,该插件已经无法继续正常使用。
7 |
8 | ### Params:
9 |
10 | - `id`
11 |
12 | required param
13 | you can extract from music url
14 | url format "http://music.163.com/#/song?id=3950552"
15 |
16 | - Fiddle `auto`
17 |
18 | optional param
19 | default value 0
20 | you can overwrite it with 1
21 |
22 | ### Examples:
23 |
24 | - Simple
25 |
26 | {{% music "3950552" %}}
27 | {{% music "3950552" "1" %}}
28 |
29 | - Named Params
30 |
31 | {{% music id="3950552" %}}
32 | {{% music id="3950552" auto="1" %}}
33 |
34 | */}}
35 |
36 | {{/* DEFAULTS */}}
37 | {{ $auto := "0" }}
38 |
39 | {{ if .IsNamedParams }}
40 |
41 |
51 |
52 | {{ else }}
53 |
54 |
64 |
65 | {{ end }}
66 |
--------------------------------------------------------------------------------
/layouts/shortcodes/jsfiddle.html:
--------------------------------------------------------------------------------
1 | {{/*
2 |
3 | ## jsFiddle Code Demo
4 |
5 | ### Params:
6 |
7 | - `fiddle`
8 |
9 | required param
10 | you can extract from fiddle url
11 | url format "https://jsfiddle.net/laozhu/L479wueo/3/"
12 |
13 | - Fiddle `tabs`
14 |
15 | optional param
16 | default value "js,html,css,result"
17 | you can overwrite it with subset of "js,html,css,result"
18 |
19 | - Fiddle `style`
20 |
21 | optional param
22 | default value "light"
23 | you can overwrite it with "dark"
24 |
25 | ### Examples:
26 |
27 | - Simple
28 |
29 | {{% jsfiddle "laozhu/L479wueo" %}}
30 | {{% jsfiddle "laozhu/L479wueo" "html,css,result" %}}
31 | {{% jsfiddle "laozhu/L479wueo" "html,css,result" "light" %}}
32 |
33 | - Named Params
34 |
35 | {{% jsfiddle fiddle="laozhu/L479wueo/3" %}}
36 | {{% jsfiddle fiddle="laozhu/L479wueo/3" tabs="html,css,result" %}}
37 | {{% jsfiddle fiddle="laozhu/L479wueo/3" tabs="html,css,result" style="light" %}}
38 |
39 | */}}
40 |
41 | {{/* DEFAULTS */}}
42 | {{ $tabs := "js,html,css,result" }}
43 | {{ $style := "light" }}
44 |
45 | {{ if .IsNamedParams }}
46 |
47 |
48 |
49 | {{ else }}
50 |
51 |
52 |
53 | {{ end }}
54 |
--------------------------------------------------------------------------------
/layouts/_default/list.html:
--------------------------------------------------------------------------------
1 | {{ define "title" }}
2 | {{ if eq .Data.Singular "tag" }}Tag → {{ .Data.Term }}
3 | {{ else if eq .Data.Singular "category" }}Category → {{ .Data.Term }}
4 | {{ else }}Posts{{ end }}
5 | {{ if isset .Site.Params "seotitle" }} | {{ .Site.Params.seotitle }}{{ else }} | {{ .Site.Title }}{{ end }}
6 | {{ end }}
7 |
8 | {{ define "main" }}
9 | {{ partial "header.html" . }}
10 |
11 |
14 | {{ $paginator := .Paginate (where .Data.Pages "Type" "post") (index .Site.Params "paginate" | default 10) }}
15 | {{ if ne $paginator.TotalPages 0 }}
16 | {{ range $paginator.Pages.ByDate.Reverse }}
17 | {{ .Render "summary" }}
18 | {{ end }}
19 | {{ else }}
20 | There's nothing here. Create an interesting post with the command:
21 | $ hugo new post/hello-world.md
22 | {{ end }}
23 | {{ if gt $paginator.TotalPages 1 }}
24 |
35 | {{ end }}
36 |
37 | {{ partial "footer.html" . }}
38 | {{ end }}
39 |
--------------------------------------------------------------------------------
/resources/_gen/assets/js/scripts/index.js_d3f53f09220d597dac26fe7840c31fc9.content:
--------------------------------------------------------------------------------
1 | var html=document.querySelector('html');var body=document.querySelector('body');var menuToggle=document.querySelector('.menu-toggle');var menuIcon=document.querySelector('.icon-menu');var siteMenu=document.querySelector('.site-menu');var socialMenu=document.querySelector('.social-menu');var toTopBtn=document.querySelector('.to-top');menuToggle&&menuToggle.addEventListener('click',function(){siteMenu.classList.toggle('collapsed');socialMenu.classList.toggle('collapsed');menuIcon.classList.toggle('icon-menu');menuIcon.classList.toggle('icon-close');var expandStatus=menuToggle.getAttribute('aria-expanded');if(expandStatus==='false')menuToggle.setAttribute('aria-expanded','true');else menuToggle.setAttribute('aria-expanded','false');});var zoomables=document.querySelectorAll('.zoomable > img, img.zoomable');zoomables.length&&mediumZoom(zoomables);function randomErrorEmoji(){var error=document.getElementsByClassName('error-emoji')[0];var emojiArray=['\\(o_o)/','(o^^)o','(˚Δ˚)b','(^-^*)','(≥o≤)','(^_^)b','(·_·)',"(='X'=)",'(>_<)','(;-;)','\\(^Д^)/',];if(error){var errorEmoji=emojiArray[Math.floor(Math.random()*emojiArray.length)];error.appendChild(document.createTextNode(errorEmoji));}};randomErrorEmoji();var lastPosition=0;var ticking=false;window.addEventListener('scroll',function(){lastPosition=body.scrollTop===0?html.scrollTop:body.scrollTop;if(!ticking){window.requestAnimationFrame(function(){if(lastPosition>=600){toTopBtn.classList.remove('is-hide');}else{toTopBtn.classList.add('is-hide');}
2 | ticking=false;});}
3 | ticking=true;});var scroll=new SmoothScroll('a[href*="#"]');toTopBtn&&toTopBtn.addEventListener('click',function(){scroll.animateScroll(0);});
--------------------------------------------------------------------------------
/assets/styles/partials/_shortcodes.scss:
--------------------------------------------------------------------------------
1 | /* asciinema shortcode */
2 | .asciicast {
3 | margin: 2rem auto !important;
4 | text-align: center;
5 |
6 | @media screen and (max-width: 1170px) {
7 | & iframe {
8 | width: 100% !important;
9 | }
10 | }
11 | }
12 |
13 | /* jsfiddle shortcode */
14 | .jsfiddle {
15 | margin: 2rem auto;
16 | width: 100%;
17 | }
18 |
19 | .cp_embed_wrapper {
20 | margin: 2rem auto;
21 |
22 | @media screen and (max-width: $tablet) {
23 | & iframe {
24 | height: 265px;
25 | }
26 | }
27 | }
28 |
29 | /* shengxiang shortcode */
30 | .shengxiang {
31 | display: block;
32 | margin: 2rem auto;
33 | width: 1054px;
34 | height: 768px;
35 |
36 | @media screen and (max-width: $widescreen) {
37 | width: 100%;
38 | height: calc((100vw - 24rem) * 0.729);
39 | }
40 |
41 | @media screen and (max-width: $tablet) {
42 | width: 100%;
43 | height: calc((100vw - 2rem) * 0.729);
44 | }
45 | }
46 |
47 | /* video.js shortcode */
48 | .video-js {
49 | margin: 2rem auto;
50 | width: 100%;
51 | height: 0;
52 | padding-top: 56.25%;
53 |
54 | &.my-player-dimensions {
55 | margin: 2rem auto;
56 | width: 100%;
57 | height: 0;
58 | padding-top: 56.25%;
59 | }
60 |
61 | &:focus {
62 | outline: none;
63 | }
64 |
65 | & .vjs-control,
66 | & .vjs-big-play-button {
67 | &:focus {
68 | outline: none;
69 | }
70 | }
71 |
72 | & .vjs-poster {
73 | background-size: cover;
74 | }
75 | }
76 |
77 | /* music 163 */
78 | .music163 {
79 | margin: 2rem auto;
80 | max-width: 100%;
81 | }
82 |
83 | /* gist shortcode */
84 | .gist {
85 | margin: 2rem auto;
86 |
87 | & td,
88 | & th {
89 | border: none;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/assets/styles/partials/_misc.scss:
--------------------------------------------------------------------------------
1 | .offscreen {
2 | position: absolute;
3 | left: -1024rem;
4 | }
5 |
6 | .suspension {
7 | position: fixed;
8 | bottom: 3rem;
9 | right: 2rem;
10 | z-index: 1000;
11 |
12 | & a {
13 | display: block;
14 | width: 2.5rem;
15 | height: 2.5rem;
16 | line-height: 2.5rem;
17 | border-radius: 50%;
18 | background-color: $white-bis;
19 | border: 1px solid $media-border;
20 | box-shadow: 0 1px 4px $box-shadow-darker;
21 | text-align: center;
22 | opacity: 1;
23 | cursor: pointer;
24 |
25 | & + a {
26 | margin-top: 1rem;
27 | }
28 |
29 | &.to-top {
30 | color: $grey;
31 | transition: all $easing $speed;
32 |
33 | &:hover {
34 | color: $white;
35 | background-color: $grey;
36 | border-color: $grey;
37 | }
38 | }
39 |
40 | &.to-comment {
41 | color: $primary;
42 | transition: all $easing $speed;
43 |
44 | &:hover {
45 | color: $white;
46 | background-color: $primary;
47 | border-color: $primary;
48 | }
49 | }
50 | }
51 |
52 | & .is-hide {
53 | display: none;
54 | }
55 | }
56 |
57 | .not-found {
58 | position: absolute;
59 | top: 0;
60 | right: 0;
61 | bottom: 0;
62 | left: 0;
63 | margin: auto;
64 | width: 100%;
65 | height: 15.5rem;
66 | font-family: $family-monospace;
67 | text-align: center;
68 |
69 | & .error-emoji {
70 | color: $text-strong;
71 | font-size: $size-1;
72 | }
73 |
74 | & .error-text {
75 | color: $text-light;
76 | font-size: $size-5;
77 | }
78 |
79 | & .error-link {
80 | margin-top: 2rem;
81 |
82 | & a {
83 | font-size: $size-6;
84 | color: $primary;
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/assets/styles/partials/_summary.scss:
--------------------------------------------------------------------------------
1 | .post-entry {
2 | position: relative;
3 | line-height: 1.8;
4 | border-top: 1px solid transparent;
5 |
6 | & a {
7 | color: $text;
8 |
9 | &:focus,
10 | &:hover {
11 | color: $primary;
12 | }
13 | }
14 |
15 | & + .post-entry {
16 | border-color: $white-ter;
17 | }
18 |
19 | & .post-title {
20 | margin-top: 1.5rem;
21 | margin-bottom: 0.5rem;
22 | font-size: 1.3rem;
23 | line-height: 1.3;
24 | font-weight: $weight-bold;
25 |
26 | & a {
27 | opacity: 1;
28 | }
29 | }
30 |
31 | & .post-meta {
32 | margin-top: 0.5rem;
33 | margin-bottom: 1rem;
34 | font-size: $size-7;
35 | letter-spacing: 1px;
36 | text-transform: uppercase;
37 | }
38 |
39 | & .post-cover {
40 | position: absolute;
41 | top: 4.6rem;
42 | right: 0;
43 | width: 8rem;
44 | height: 8rem;
45 | object-fit: cover;
46 | font-family: 'object-fit: cover;'; // Polyfill for object-fit
47 | border-radius: $radius;
48 |
49 | & + .post-summary {
50 | padding-right: 9rem;
51 | }
52 |
53 | @media screen and (max-width: $tablet) {
54 | position: static;
55 | width: 100vw;
56 | height: 56.25vw;
57 | border-radius: 0;
58 | margin: 0 -1rem;
59 |
60 | & + .post-summary {
61 | padding-right: 0;
62 | }
63 | }
64 | }
65 |
66 | & .post-summary {
67 | margin-top: 1rem;
68 | margin-bottom: 1rem;
69 | font-size: 0.9rem;
70 | text-align: justify;
71 | opacity: 0.8;
72 | }
73 |
74 | & .post-footer {
75 | margin-top: 1rem;
76 | margin-bottom: 1.5rem;
77 |
78 | & .read-more {
79 | font-size: $size-7;
80 | letter-spacing: 1px;
81 | text-transform: uppercase;
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/assets/styles/partials/_posts.scss:
--------------------------------------------------------------------------------
1 | .post-detail {
2 | & .post-header {
3 | margin-bottom: 2.5rem;
4 |
5 | & .post-title {
6 | font-size: $size-3;
7 | line-height: 1.5;
8 | font-weight: $weight-bold;
9 | margin-top: 1.5rem;
10 | margin-bottom: 0.5rem;
11 | }
12 |
13 | & .post-meta {
14 | font-size: $size-7;
15 | letter-spacing: 1px;
16 | margin-top: 0.5rem;
17 | margin-bottom: 1rem;
18 | text-transform: uppercase;
19 | }
20 | }
21 |
22 | & .post-footer {
23 | margin: 2rem 0;
24 | line-height: 1.8;
25 |
26 | & .post-tags {
27 | margin-top: 0;
28 | margin-bottom: 1rem;
29 | padding-left: 0;
30 |
31 | & li {
32 | display: inline-block;
33 | margin-bottom: 0.5rem;
34 | border-radius: $radius;
35 | padding: 5px 10px;
36 | background: $background;
37 | font-size: $size-7;
38 |
39 | & + li {
40 | margin-left: 0.5rem;
41 | }
42 | }
43 | }
44 |
45 | & .post-copyright {
46 | color: $text;
47 | margin-top: 1rem;
48 | margin-bottom: 0;
49 | border-radius: $radius;
50 | font-size: 0.9rem;
51 | opacity: 0.5;
52 |
53 | &:hover {
54 | opacity: 1;
55 | }
56 |
57 | & a {
58 | opacity: 1;
59 | }
60 |
61 | & strong {
62 | color: $text-strong;
63 | }
64 | }
65 | }
66 |
67 | & #cyReward > #cy-reward-click {
68 | display: block;
69 | margin: 3rem auto;
70 | }
71 |
72 | & #SOHUCS {
73 | margin: 2rem auto;
74 |
75 | & .invalidity {
76 | box-sizing: border-box;
77 | }
78 | }
79 |
80 | & #disqus_thread {
81 | margin: 2rem auto;
82 | }
83 |
84 | & #gitment-container {
85 | margin: 2rem auto;
86 | }
87 |
88 | & .dsq-brlink {
89 | display: none;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/layouts/_default/baseof.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{- block "title" . -}}
10 | {{ if eq .Kind "page" }}{{ .Title }}{{ else if isset .Site.Params "seotitle" }}{{ .Site.Params.seotitle }}{{ else }}{{ .Site.Title }}{{ end }}
11 | {{- end -}}
12 |
13 |
14 |
15 | {{ partial "head.html" . }}
16 |
17 |
18 | {{ partial "polyfill.html" . }}
19 |
20 |
21 |
22 | {{ if ne .Kind "404" }}
23 | {{- $upIcon := "icon icon-up" -}}
24 | {{- $commentIcon := "icon icon-comment" -}}
25 | {{- with .Site.Params.fontAwesome -}}
26 | {{- $upIcon = "fas fa-caret-up" -}}
27 | {{- $commentIcon = "fas fa-comment-dots" -}}
28 | {{- end -}}
29 |
30 |
31 | {{ if and (eq .Type "post") (eq .Kind "page") }}
32 | {{ if .Site.Params.changyan }}
33 |
34 | {{ else if .Site.DisqusShortname }}
35 |
36 | {{ else if .Site.Params.Gitment }}
37 |
38 | {{ else }}{{ end }}
39 | {{ end }}
40 |
41 | {{ end }}
42 | {{ block "main" . }}{{ end }}
43 |
44 |
45 |
--------------------------------------------------------------------------------
/layouts/_default/about.html:
--------------------------------------------------------------------------------
1 | {{ define "title" }}
2 | {{ .Title }} | {{ if isset .Site.Params "seotitle" }}{{ .Site.Params.seotitle }}{{ else }}{{ .Site.Title }}{{ end }}
3 | {{ end }}
4 |
5 | {{ define "main" }}
6 | {{ partial "header.html" . }}
7 |
8 |
11 | {{ .Content }}
12 | {{ if ne .Params.comments false }}
13 | {{ if .Site.Params.changyan }}
14 |
15 |
22 | {{ else if .Site.Params.Gitment }}{{ partial "gitment.html" . }}
23 | {{ else if .Site.DisqusShortname }}{{ template "_internal/disqus.html" . }}
24 | {{ else }}{{ end }}
25 | {{ end }}
26 |
27 | {{ partial "footer.html" . }}
28 | {{ end }}
29 |
--------------------------------------------------------------------------------
/assets/styles/partials/_table.scss:
--------------------------------------------------------------------------------
1 | table {
2 | color: $table;
3 | margin: 2rem auto;
4 | width: 100%;
5 | border-collapse: collapse;
6 |
7 | & td,
8 | & th {
9 | border: 1px solid $table-border;
10 | border-width: 0 0 1px;
11 | padding: 0.5em 0.75em;
12 | vertical-align: middle;
13 | // Modifiers
14 | &.is-narrow {
15 | white-space: nowrap;
16 | width: 1%;
17 | }
18 | }
19 |
20 | & th {
21 | color: $text-strong;
22 | }
23 |
24 | & tr {
25 | &:hover {
26 | background-color: $table-row-hover-background;
27 | }
28 |
29 | &.is-selected {
30 | background-color: $table-row-active-background;
31 | color: $table-row-active;
32 |
33 | & a,
34 | & strong {
35 | color: currentColor;
36 | }
37 |
38 | & td,
39 | & th {
40 | border-color: $table-row-active;
41 | color: currentColor;
42 | }
43 | }
44 | }
45 |
46 | & thead {
47 | & td,
48 | & th {
49 | border-width: 0 0 2px;
50 | color: $table-head;
51 | }
52 | }
53 |
54 | & tfoot {
55 | & td,
56 | & th {
57 | border-width: 2px 0 0;
58 | color: $table-head;
59 | }
60 | }
61 |
62 | & tbody {
63 | & tr {
64 | &:last-child {
65 | & td,
66 | & th {
67 | border-bottom-width: 0;
68 | }
69 | }
70 | }
71 | }
72 |
73 | // Modifiers
74 | &.is-bordered {
75 | & td,
76 | & th {
77 | border-width: 1px;
78 | }
79 |
80 | & tr {
81 | &:last-child {
82 | & td,
83 | & th {
84 | border-bottom-width: 1px;
85 | }
86 | }
87 | }
88 | }
89 |
90 | &.is-narrow {
91 | & td,
92 | & th {
93 | padding: 0.25em 0.5em;
94 | }
95 | }
96 |
97 | &.is-centered {
98 | & td,
99 | & th,
100 | & tr {
101 | text-align: center;
102 | }
103 | }
104 |
105 | &.is-striped {
106 | & tbody {
107 | & tr:not(.is-selected) {
108 | &:nth-child(even) {
109 | background-color: $table-row-even-background;
110 |
111 | &:hover {
112 | background-color: $table-row-even-hover-background;
113 | }
114 | }
115 | }
116 | }
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/assets/styles/partials/_icons.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'icon'; /* project id 174169 */
3 | font-display: 'swap';
4 | src: url('https://at.alicdn.com/t/font_174169_qmgvd10zwbf.eot');
5 | src: url('https://at.alicdn.com/t/font_174169_qmgvd10zwbf.eot?#iefix') format('embedded-opentype'),
6 | url('https://at.alicdn.com/t/font_174169_qmgvd10zwbf.woff') format('woff'),
7 | url('https://at.alicdn.com/t/font_174169_qmgvd10zwbf.ttf') format('truetype'),
8 | url('https://at.alicdn.com/t/font_174169_qmgvd10zwbf.svg#iconfont') format('svg');
9 | }
10 |
11 | .icon {
12 | font-family: 'icon' !important;
13 | font-size: 1rem;
14 | font-style: normal;
15 | -webkit-font-smoothing: antialiased;
16 | -moz-osx-font-smoothing: grayscale;
17 |
18 | @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
19 | -webkit-font-smoothing: subpixel-antialiased;
20 | }
21 | }
22 |
23 | .icon-facebook::before { content: "\e600"; }
24 |
25 | .icon-close::before { content: "\e646"; }
26 |
27 | .icon-reddit::before { content: "\ebcf"; }
28 |
29 | .icon-stackoverflow::before { content: "\e85a"; }
30 |
31 | .icon-twitter::before { content: "\e89d"; }
32 |
33 | .icon-comment::before { content: "\e66f"; }
34 |
35 | .icon-menu::before { content: "\e692"; }
36 |
37 | .icon-jsfiddle::before { content: "\e753"; }
38 |
39 | .icon-weibo::before { content: "\e892"; }
40 |
41 | .icon-wechat::before { content: "\e628"; }
42 |
43 | .icon-dribbble::before { content: "\e696"; }
44 |
45 | .icon-rss::before { content: "\e6ee"; }
46 |
47 | .icon-github::before { content: "\e629"; }
48 |
49 | .icon-up::before { content: "\e734"; }
50 |
51 | .icon-behance::before { content: "\e601"; }
52 |
53 | .icon-douban::before { content: "\e613"; }
54 |
55 | .icon-quora::before { content: "\e61b"; }
56 |
57 | .icon-email::before { content: "\e664"; }
58 |
59 | .icon-bilibili::before { content: "\e64e"; }
60 |
61 | .icon-codepen::before { content: "\e9eb"; }
62 |
63 | .icon-pinterest::before { content: "\e60a"; }
64 |
65 | .icon-codesandbox::before { content: "\e87e"; }
66 |
67 | .icon-google::before { content: "\e886"; }
68 |
69 | .icon-zhihu::before { content: "\e88b"; }
70 |
71 | .icon-instagram::before { content: "\e88f"; }
72 |
73 | .icon-linkedin::before { content: "\f1e7"; }
74 |
75 | .icon-medium::before { content: "\f1ef"; }
76 |
77 | .icon-npm::before { content: "\f1fe"; }
78 |
79 | .icon-vimeo::before { content: "\f25a"; }
80 |
81 | .icon-youtube::before { content: "\f274"; }
82 |
--------------------------------------------------------------------------------
/assets/scripts/index.js:
--------------------------------------------------------------------------------
1 | // Selected DOM elements
2 | var html = document.querySelector('html');
3 | var body = document.querySelector('body');
4 | var menuToggle = document.querySelector('.menu-toggle');
5 | var menuIcon = document.querySelector('.icon-menu');
6 | var siteMenu = document.querySelector('.site-menu');
7 | var socialMenu = document.querySelector('.social-menu');
8 | var toTopBtn = document.querySelector('.to-top');
9 |
10 | // Site and social menu toggle
11 | menuToggle &&
12 | menuToggle.addEventListener('click', function() {
13 | siteMenu.classList.toggle('collapsed');
14 | socialMenu.classList.toggle('collapsed');
15 | menuIcon.classList.toggle('icon-menu');
16 | menuIcon.classList.toggle('icon-close');
17 | var expandStatus = menuToggle.getAttribute('aria-expanded');
18 | if (expandStatus === 'false') menuToggle.setAttribute('aria-expanded', 'true');
19 | else menuToggle.setAttribute('aria-expanded', 'false');
20 | });
21 |
22 | // Medium zoom init
23 | var zoomables = document.querySelectorAll('.zoomable > img, img.zoomable');
24 | zoomables.length && mediumZoom(zoomables);
25 |
26 | // Random emoji for 404 error message.
27 | function randomErrorEmoji() {
28 | var error = document.getElementsByClassName('error-emoji')[0];
29 | var emojiArray = [
30 | '\\(o_o)/',
31 | '(o^^)o',
32 | '(˚Δ˚)b',
33 | '(^-^*)',
34 | '(≥o≤)',
35 | '(^_^)b',
36 | '(·_·)',
37 | "(='X'=)",
38 | '(>_<)',
39 | '(;-;)',
40 | '\\(^Д^)/',
41 | ];
42 | if (error) {
43 | var errorEmoji = emojiArray[Math.floor(Math.random() * emojiArray.length)];
44 | error.appendChild(document.createTextNode(errorEmoji));
45 | }
46 | };
47 | randomErrorEmoji();
48 |
49 | // Show toTopBtn when scroll to 600px
50 | /* eslint-disable no-undef */
51 | var lastPosition = 0;
52 | var ticking = false;
53 | window.addEventListener('scroll', function() {
54 | lastPosition = body.scrollTop === 0 ? html.scrollTop : body.scrollTop;
55 | if (!ticking) {
56 | window.requestAnimationFrame(function() {
57 | if (lastPosition >= 600) {
58 | toTopBtn.classList.remove('is-hide');
59 | } else {
60 | toTopBtn.classList.add('is-hide');
61 | }
62 | ticking = false;
63 | });
64 | }
65 | ticking = true;
66 | });
67 |
68 | // Smooth Scroll to top when click toTopBtn
69 | var scroll = new SmoothScroll('a[href*="#"]');
70 | toTopBtn &&
71 | toTopBtn.addEventListener('click', function() {
72 | scroll.animateScroll(0);
73 | });
74 |
--------------------------------------------------------------------------------
/assets/styles/partials/_variables.scss:
--------------------------------------------------------------------------------
1 | /* Colors */
2 | $black: rgb(10, 10, 10);
3 | $black-bis: rgb(18, 18, 18);
4 | $black-ter: rgb(36, 36, 36);
5 | $grey-darker: rgb(54, 54, 54);
6 | $grey-dark: rgb(74, 74, 74);
7 | $grey: rgb(121, 121, 121);
8 | $grey-light: rgb(181, 181, 181);
9 | $grey-lighter: rgb(219, 219, 219);
10 | $white-ter: rgb(244, 243, 241);
11 | $white-bis: rgb(250, 250, 250);
12 | $white: rgb(255, 255, 255);
13 | $green: rgb(0, 171, 107);
14 | $green-light: rgba(0, 171, 107, 0.5);
15 | $green-invert: $green;
16 |
17 | /* Theme colors */
18 | $primary: $green;
19 | $primary-invert: $green-invert;
20 | $light: $white-ter;
21 | $dark: $grey-darker;
22 | $background: $white-ter;
23 | $code-background: rgb(246, 248, 250);
24 | $main-background: $white;
25 |
26 | /* Text colors */
27 | $text: $grey-dark;
28 | $text-invert: $text;
29 | $text-light: $grey;
30 | $text-strong: $grey-darker;
31 |
32 | /* Border colors */
33 | $border: $grey-lighter;
34 | $border-hover: $grey-light;
35 | $main-border: rgba(0, 0, 0, 0.09);
36 | $media-border: $white;
37 |
38 | /* Box shadow colors */
39 | $box-shadow: rgba(0, 0, 0, 0.04);
40 | $box-shadow-dark: rgba(0, 0, 0, 0.15);
41 | $box-shadow-darker: rgba(0, 0, 0, 0.3);
42 |
43 | /* Typography */
44 | $family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", "Helvetica Neue", sans-serif;
45 | $family-monospace: "Fira Code", "Roboto Mono", Menlo, Monaco, Consolas, "Courier New", Courier, monospace;
46 | $family-lobster: 'Lobster', cursive, $family-sans-serif;
47 | $size-1: 3rem;
48 | $size-2: 2.5rem;
49 | $size-3: 2rem;
50 | $size-4: 1.5rem;
51 | $size-5: 1.25rem;
52 | $size-6: 1rem;
53 | $size-7: 0.8rem;
54 | $weight-light: 300;
55 | $weight-normal: 400;
56 | $weight-semibold: 500;
57 | $weight-bold: 700;
58 |
59 | /* Radius */
60 | $radius-small: 2px;
61 | $radius: 3px;
62 | $radius-large: 5px;
63 |
64 | /* Responsiveness */
65 | $phone: 640px;
66 | $tablet: 800px;
67 | $desktop: 960px;
68 | $widescreen: 1440px;
69 | $min-height: 720px;
70 |
71 | /* Table */
72 | $table: $grey-darker;
73 | $table-background: $white;
74 | $table-border: $grey-lighter;
75 | $table-head: $grey;
76 | $table-row-hover-background: $white-bis;
77 | $table-row-active-background: $primary;
78 | $table-row-active: $primary-invert;
79 | $table-row-even-background: $white-bis;
80 | $table-row-even-hover-background: $white-ter;
81 |
82 | /* Miscellaneous */
83 | $easing: ease-out;
84 | $speed: 0.5s;
85 |
--------------------------------------------------------------------------------
/assets/styles/partials/_skeleton.scss:
--------------------------------------------------------------------------------
1 | html {
2 | line-height: 1.618;
3 | font-family: $family-sans-serif;
4 | font-size: 16px;
5 | }
6 |
7 | body {
8 | text-rendering: optimizeLegibility;
9 | color: $text;
10 | -webkit-font-smoothing: antialiased;
11 | -moz-osx-font-smoothing: grayscale;
12 | -webkit-tap-highlight-color: transparent;
13 | -webkit-overflow-scrolling: touch;
14 |
15 | @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
16 | -webkit-font-smoothing: subpixel-antialiased;
17 | }
18 | }
19 |
20 | a {
21 | opacity: 0.8;
22 | text-decoration: none;
23 | color: $text-strong;
24 |
25 | &:focus,
26 | &:hover {
27 | opacity: 1;
28 | outline: none;
29 | color: $black-ter;
30 | }
31 | }
32 |
33 | .site-header {
34 | box-sizing: border-box;
35 | position: fixed;
36 | top: 0;
37 | bottom: 0;
38 | left: 0;
39 | padding: 1rem;
40 | width: 20rem;
41 | text-align: center;
42 |
43 | & .is-active {
44 | & a {
45 | opacity: 1;
46 | color: $text-strong;
47 | font-weight: $weight-bold;
48 | }
49 | }
50 |
51 | & a {
52 | opacity: 0.5;
53 | color: $black-ter;
54 |
55 | &:focus,
56 | &:hover {
57 | opacity: 1;
58 | color: $text-strong;
59 | }
60 | }
61 |
62 | @media screen and (max-width: $tablet) {
63 | position: relative;
64 | width: 100%;
65 | }
66 |
67 | @media print {
68 | display: none;
69 | }
70 | }
71 |
72 | .main {
73 | box-sizing: border-box;
74 | position: relative;
75 | margin-left: 20rem;
76 | border-right: 1px solid $main-border;
77 | border-left: 1px solid $main-border;
78 | box-shadow: 0 1px 4px $box-shadow;
79 | background: $main-background;
80 | padding: 1rem 2rem;
81 | width: calc(100% - 20rem);
82 | max-width: 70rem;
83 | min-height: 100vh;
84 |
85 | & .list-footer {
86 | padding: 1.5rem 0;
87 | }
88 |
89 | @media print, screen and (max-width: $tablet) {
90 | margin-left: 0;
91 | border-top: 1px solid $main-border;
92 | border-right: none;
93 | border-bottom: 1px solid $main-border;
94 | border-left: none;
95 | padding: 0 1rem;
96 | width: 100%;
97 | min-height: initial;
98 | }
99 | }
100 |
101 | .site-footer {
102 | display: none;
103 |
104 | @media screen and (max-width: $tablet) {
105 | display: block;
106 | padding: 2rem 1rem;
107 | text-align: center;
108 | color: $text;
109 | font-family: $family-monospace;
110 | font-size: $size-7;
111 |
112 | & a {
113 | opacity: 0.7;
114 | color: $text;
115 |
116 | &:focus,
117 | &:hover {
118 | opacity: 1;
119 | }
120 | }
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/exampleSite/content/post/hugoisforlovers.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Getting Started with Hugo
3 | cover: /media/cover.jpg
4 | tags: ["go", "golang", "hugo", "development"]
5 | date: "2014-04-02"
6 | ---
7 |
8 | ## Step 1. Install Hugo
9 |
10 | Goto [hugo releases](https://github.com/spf13/hugo/releases) and download the
11 | appropriate version for your os and architecture.
12 |
13 | Save it somewhere specific as we will be using it in the next step.
14 |
15 | More complete instructions are available at [installing hugo](/overview/installing/)
16 |
17 | ## Step 2. Build the Docs
18 |
19 | Hugo has its own example site which happens to also be the documentation site
20 | you are reading right now.
21 |
22 | Follow the following steps:
23 |
24 | 1. Clone the [hugo repository](http://github.com/spf13/hugo)
25 | 2. Go into the repo
26 | 3. Run hugo in server mode and build the docs
27 | 4. Open your browser to http://localhost:1313
28 |
29 | Corresponding pseudo commands:
30 |
31 | git clone https://github.com/spf13/hugo
32 | cd hugo
33 | /path/to/where/you/installed/hugo server --source=./docs
34 | > 29 pages created
35 | > 0 tags index created
36 | > in 27 ms
37 | > Web Server is available at http://localhost:1313
38 | > Press ctrl+c to stop
39 |
40 | Once you've gotten here, follow along the rest of this page on your local build.
41 |
42 | ## Step 3. Change the docs site
43 |
44 | Stop the Hugo process by hitting ctrl+c.
45 |
46 | Now we are going to run hugo again, but this time with hugo in watch mode.
47 |
48 | /path/to/hugo/from/step/1/hugo server --source=./docs --watch
49 | > 29 pages created
50 | > 0 tags index created
51 | > in 27 ms
52 | > Web Server is available at http://localhost:1313
53 | > Watching for changes in /Users/spf13/Code/hugo/docs/content
54 | > Press ctrl+c to stop
55 |
56 |
57 | Open your [favorite editor](http://vim.spf13.com) and change one of the source
58 | content pages. How about changing this very file to *fix the typo*. How about changing this very file to *fix the typo*.
59 |
60 | Content files are found in `docs/content/`. Unless otherwise specified, files
61 | are located at the same relative location as the url, in our case
62 | `docs/content/overview/quickstart.md`.
63 |
64 | Change and save this file.. Notice what happened in your terminal.
65 |
66 | > Change detected, rebuilding site
67 |
68 | > 29 pages created
69 | > 0 tags index created
70 | > in 26 ms
71 |
72 | Refresh the browser and observe that the typo is now fixed.
73 |
74 | Notice how quick that was. Try to refresh the site before it's finished building.. I double dare you.
75 | Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.
76 |
77 | ## Step 4. Have fun
78 |
79 | The best way to learn something is to play with it.
80 |
--------------------------------------------------------------------------------
/layouts/_default/resume.html:
--------------------------------------------------------------------------------
1 | {{ define "title" }}
2 | {{ .Title }} |
3 | {{ if isset .Site.Params "seotitle" }}
4 | {{ .Site.Params.seotitle }}
5 | {{ else }}
6 | {{ .Site.Title }}
7 | {{ end }}
8 | {{ end }}
9 |
10 | {{ define "main" }}
11 | {{ partial "header.html" . }}
12 |
13 |
16 |
17 | {{ if (isset $.Site.Data.resume "name") }}
18 |
19 | {{ $.Site.Data.resume.name }}
20 |
21 | {{ end }}
22 |
23 | {{ if (isset $.Site.Data.resume "contact") }}
24 |
29 | {{ end }}
30 |
31 | {{ if (isset $.Site.Data.resume "education") }}
32 |
Education
33 | {{ range $.Site.Data.resume.education.list }}
34 |
41 | {{ end }}
42 | {{ end }}
43 |
44 | {{ if (isset $.Site.Data.resume "experience") }}
45 |
Experiences
46 | {{ range $.Site.Data.resume.experience.list }}
47 |
54 |
55 | {{ if (not (isset . "description")) }}
56 |
57 | {{ range .projects }}
58 | {{ . }}
59 | {{ end }}
60 |
61 | {{ else }}
62 |
{{ .description | markdownify }}
63 | {{ end }}
64 |
65 | {{ end }}
66 | {{ end }}
67 |
68 | {{ if (isset $.Site.Data.resume "skill") }}
69 |
Skills
70 |
71 | {{ range $.Site.Data.resume.skill.list }}
72 | {{ .name }} : {{ .level }}%
73 | {{ end }}
74 |
75 | {{ end }}
76 |
77 | {{ if (isset $.Site.Data.resume "languages") }}
78 |
Languages
79 |
80 | {{ range $.Site.Data.resume.languages }}
81 | {{ . }}
82 | {{ end }}
83 |
84 | {{ end }}
85 |
86 | {{ if (isset $.Site.Data.resume "interests") }}
87 |
Interests
88 |
89 | {{ range $.Site.Data.resume.interests }}
90 | {{ . }}
91 | {{ end }}
92 |
93 | {{ end }}
94 |
95 |
96 | {{ partial "footer.html" . }}
97 | {{ end }}
98 |
--------------------------------------------------------------------------------
/layouts/post/single.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }}
2 | {{ partial "header.html" . }}
3 |
4 |
8 | {{ .Content }}
9 |
21 | {{ if ne .Params.comments false }}
22 | {{ if .Site.Params.changyan }}
23 |
24 |
25 |
26 |
27 |
34 | {{ else if .Site.Params.Gitment }}{{ partial "gitment.html" . }}
35 | {{ else if .Site.DisqusShortname }}{{ template "_internal/disqus.html" . }}
36 | {{ else }}{{ end }}
37 | {{ end }}
38 |
39 | {{ partial "footer.html" . }}
40 | {{ end }}
41 |
--------------------------------------------------------------------------------
/assets/styles/partials/_header.scss:
--------------------------------------------------------------------------------
1 | .avatar {
2 | margin-top: 3rem;
3 | width: 8rem;
4 | height: 8rem;
5 | border-radius: 50%;
6 | border: 4px solid $media-border;
7 | box-shadow: 0 1px 4px $box-shadow-darker;
8 | transition: all $easing $speed;
9 |
10 | &:hover {
11 | transform: rotate(360deg);
12 | }
13 |
14 | @media screen and (max-width: $tablet) {
15 | position: absolute;
16 | top: 1rem;
17 | left: 1rem;
18 | width: 2rem;
19 | height: 2rem;
20 | margin-top: 0;
21 | border: 2px solid $media-border;
22 | }
23 | }
24 |
25 | .title {
26 | font-size: $size-4;
27 | font-family: $family-lobster;
28 | font-weight: $weight-bold;
29 | margin: 1rem auto;
30 |
31 | @media screen and (max-width: $tablet) {
32 | margin-top: 3rem;
33 | }
34 | }
35 |
36 | .subtitle {
37 | margin-bottom: 3rem;
38 | opacity: 0.7;
39 | }
40 |
41 | .menu-toggle {
42 | display: none;
43 | border: none;
44 | outline: none;
45 | width: 2rem;
46 | height: 2rem;
47 | font-size: $size-4;
48 | background-color: transparent;
49 | transition: all $easing $speed;
50 |
51 | @media screen and (max-width: $tablet) {
52 | position: absolute;
53 | top: 1rem;
54 | right: 1rem;
55 | display: block;
56 | }
57 | }
58 |
59 | .site-menu {
60 | text-transform: capitalize;
61 |
62 | & .menu-list {
63 | list-style: none;
64 | padding: 0;
65 | }
66 |
67 | & .menu-item {
68 | padding: 1rem 0;
69 |
70 | & a {
71 | display: inline-block;
72 | height: 1.5rem;
73 | line-height: 1.5;
74 | }
75 | }
76 |
77 | &.collapsed {
78 | @media screen and (max-width: $tablet) {
79 | max-height: 0;
80 | }
81 | }
82 |
83 | @media screen and (max-width: $tablet) {
84 | overflow-y: hidden;
85 | max-height: 1000px;
86 | transition: max-height $easing $speed;
87 | }
88 | }
89 |
90 | .social-menu {
91 | position: absolute;
92 | left: 1rem;
93 | right: 1rem;
94 | bottom: 1rem;
95 | font-size: 0;
96 |
97 | & .social-list {
98 | padding: 0;
99 | list-style: none;
100 | line-height: 2;
101 | }
102 |
103 | & .social-item {
104 | display: inline-block;
105 | font-size: 1rem;
106 | }
107 |
108 | & li + li {
109 | padding-left: 1rem;
110 | }
111 |
112 | &.collapsed {
113 | @media screen and (max-width: $tablet) {
114 | margin: 0 auto;
115 | max-height: 0;
116 | }
117 | }
118 |
119 | @media screen and (max-width: $tablet) {
120 | position: relative;
121 | left: 0;
122 | right: 0;
123 | bottom: 0;
124 | margin: 2rem auto;
125 | max-height: 125px;
126 | overflow-y: hidden;
127 | transition: all $easing $speed;
128 | }
129 |
130 | @media screen and (min-width: $tablet) and (max-height: $min-height) {
131 | display: none;
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/exampleSite/data/resume.toml:
--------------------------------------------------------------------------------
1 | name = "John Doe"
2 |
3 | # These two variable definitions need to go before [contact], etc.
4 | languages = [
5 | "English (native)",
6 | "Chinese (conversational)"
7 | ]
8 |
9 | interests = [
10 | "Photography",
11 | "Web development"
12 | ]
13 |
14 | [contact]
15 |
16 | [[contact.list]]
17 | class = "email"
18 | url = "mailto:example@domain.com"
19 | title = "example@domain.com"
20 |
21 | [[contact.list]]
22 | class = "phone"
23 | url = "tel:123-456-7890"
24 | title = "+1 (123) 456-7890"
25 |
26 | [[contact.list]]
27 | class = "github"
28 | url = "//github.com/username"
29 | title = "github.com/username"
30 |
31 | [[contact.list]]
32 | class = "website"
33 | url = "//domain.com"
34 | title = "domain.com"
35 |
36 | [education]
37 |
38 | [[education.list]]
39 | degree = "M.Sc. Computer Science"
40 | school = "University of Universe"
41 | year = "2006 - 2008"
42 | description = "Thesis: Automatic Peeling Bananas."
43 |
44 | [[education.list]]
45 | degree = "B.S. Computer Science"
46 | school = "University of Universe"
47 | year = "2002 - 2006"
48 | description = "Courses: Algorithms, Computer Architecture."
49 |
50 |
51 | [experience]
52 |
53 | [[experience.list]]
54 | name = "Google Cloud"
55 | company = "Google, Inc."
56 | location = "Mountain View, CA, USA"
57 | title = "Software Engineer"
58 | year = "01/2016 - now"
59 | description = """Lorem ipsum dolor sit amet, consectetur adipiscing elit.
60 | Suspendisse elit quam, maximus eget ex eget, vehicula ultricies nunc.
61 | Nam sodales eu ipsum non ultricies."""
62 |
63 | [[experience.list]]
64 | name = "Amazon Web Services"
65 | company = "Amazon"
66 | location = "Seattle, WA, USA"
67 | title = "Software Engineer"
68 | year = "09/2014 - 12/2015"
69 | projects = [
70 | """Lorem ipsum dolor sit amet, consectetur adipiscing elit.
71 | Suspendisse elit quam""",
72 | """Lorem ipsum dolor sit amet, consectetur adipiscing elit.
73 | Suspendisse elit quam""",
74 | """Lorem ipsum dolor sit amet, consectetur adipiscing elit.
75 | Suspendisse elit quam""",
76 | ]
77 |
78 | [[experience.list]]
79 | name = "Aliyun"
80 | company = "Alibaba, Inc."
81 | location = "Hangzhou, Zhejiang, China"
82 | title = "Software Engineer"
83 | year = "01/2009 - 08/2014"
84 | projects = [
85 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
86 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
87 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
88 | ]
89 |
90 | [skill]
91 |
92 | [[skill.list]]
93 | name = "C/C++"
94 | level = "80"
95 |
96 | [[skill.list]]
97 | name = "Python"
98 | level = "80"
99 |
100 | [[skill.list]]
101 | name = "HTML"
102 | level = "80"
103 |
--------------------------------------------------------------------------------
/layouts/partials/footer.html:
--------------------------------------------------------------------------------
1 | {{- $script := resources.Get "scripts/index.js" | resources.Minify -}}
2 | {{- $serviceWorker := resources.Get "service-worker-template.js" | resources.ExecuteAsTemplate "service-worker.js" . -}}
3 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 | {{ if and (eq .Kind "page") (eq .Type "post") }}
18 |
19 | {{ end }}
20 |
21 |
22 | {{ if and (eq .Kind "page") (eq .Type "post") }}
23 |
24 |
37 |
45 | {{ end }}
46 |
47 |
48 |
49 |
50 |
57 |
58 |
59 | {{ if .Site.GoogleAnalytics }}
60 | {{ template "_internal/google_analytics_async.html" . }}
61 | {{ end }}
62 |
63 |
64 | {{ with .Site.Params.baidutongji }}
65 |
74 | {{ end }}
75 |
--------------------------------------------------------------------------------
/layouts/shortcodes/codepen.html:
--------------------------------------------------------------------------------
1 | {{/*
2 |
3 | ## Code Pen Demo
4 |
5 | ### Params:
6 |
7 | - `pen`
8 |
9 | required param
10 | you can extract from pen url
11 | url format "https://codepen.io/laozhu/pen/RoaWdE"
12 |
13 | - Pen `user`
14 |
15 | required param
16 | you can extract from pen url
17 | url format "https://codepen.io/laozhu/pen/RoaWdE"
18 |
19 | - Pen user `fullname`
20 |
21 | required param
22 | you can get from pen page
23 | pen page url "https://codepen.io/laozhu/pen/RoaWdE"
24 |
25 | - Pen `height`
26 |
27 | required param
28 | set height for pen result
29 |
30 | - Pen `style`
31 |
32 | optional param
33 | default value "light"
34 | you can overwrite it with "dark"
35 |
36 | - Pen `tabs`
37 |
38 | optional param
39 | default value "result"
40 | you can choose two from "js,html,css,result", for example "js,result"
41 |
42 | - Preview prefs
43 |
44 | optional param
45 | default value "true"
46 | you can set "false"
47 |
48 | ### Examples:
49 |
50 | - Simple
51 |
52 | {{% codepen "RoaWdE" "🐍 Snake Rush" "laozhu" "Ritchie Zhu" %}}
53 | {{% codepen "RoaWdE" "🐍 Snake Rush" "laozhu" "Ritchie Zhu" "600" "dark" "css,result" "false" %}}
54 |
55 | - Named Params
56 |
57 | {{% codepen pen="RoaWdE" title="🐍 Snake Rush" user="laozhu" fullname="Ritchie Zhu" %}}
58 | {{% codepen pen="RoaWdE" title="🐍 Snake Rush" user="laozhu" fullname="Ritchie Zhu" height="600" style="dark" tabs="css,result" preview="false" %}}
59 |
60 | */}}
61 |
62 | {{/* DEFAULTS */}}
63 | {{ $height := "265" }}
64 | {{ $style := "light" }}
65 | {{ $tabs := "result" }}
66 | {{ $preview := "true" }}
67 |
68 | {{ if .IsNamedParams }}
69 |
70 |
72 | See the Pen {{ .Get "title" }} by {{ .Get "fullname" }} (@{{ .Get "user" }} ) on CodePen .
73 |
74 |
75 |
76 | {{ else }}
77 |
78 |
80 | See the Pen {{ .Get 1 }} by {{ .Get 3 }} (@{{ .Get 2 }} ) on CodePen .
81 |
82 |
83 |
84 | {{ end }}
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/layouts/shortcodes/video.html:
--------------------------------------------------------------------------------
1 | {{/*
2 |
3 | ## Video.js Player
4 |
5 | ### Params:
6 |
7 | - Video `mp4`
8 |
9 | required param
10 | mp4 video url or path
11 | url format "//vjs.zencdn.net/v/oceans.mp4"
12 | path format "/media/posts/hugo-nuo-post-preview/videojs.mp4"
13 |
14 | - Video `webm`
15 |
16 | required param
17 | mp4 video url or path
18 | url format "//vjs.zencdn.net/v/oceans.webm"
19 | path format "/media/posts/hugo-nuo-post-preview/videojs.webm"
20 |
21 | - Video `ogv`
22 |
23 | required param
24 | ogv video url or path
25 | url format "//vjs.zencdn.net/v/oceans.ogv"
26 | path format "/media/posts/hugo-nuo-post-preview/videojs.ogv"
27 |
28 | - Video `poster`
29 |
30 | optional param
31 | default value "/images/poster.jpg"
32 | you can overwrite it with your photo (16:9)
33 |
34 | ### Examples:
35 |
36 | - Simple
37 |
38 | {{% video
39 | "/media/posts/hugo-nuo-post-preview/videojs.mp4"
40 | "/media/posts/hugo-nuo-post-preview/videojs.webm"
41 | "/media/posts/hugo-nuo-post-preview/videojs.ogv"
42 | %}}
43 |
44 | {{% video
45 | "/media/posts/hugo-nuo-post-preview/videojs.mp4"
46 | "/media/posts/hugo-nuo-post-preview/videojs.webm"
47 | "/media/posts/hugo-nuo-post-preview/videojs.ogv"
48 | "/images/poster.jpg"
49 | %}}
50 |
51 | - Named Params
52 |
53 | {{%
54 | video mp4="/media/posts/hugo-nuo-post-preview/videojs.mp4"
55 | webm="/media/posts/hugo-nuo-post-preview/videojs.webm"
56 | ogv="/media/posts/hugo-nuo-post-preview/videojs.ogv"
57 | %}}
58 |
59 | {{%
60 | video mp4="/media/posts/hugo-nuo-post-preview/videojs.mp4"
61 | webm="/media/posts/hugo-nuo-post-preview/videojs.webm"
62 | ogv="/media/posts/hugo-nuo-post-preview/videojs.ogv"
63 | poster="/images/poster.jpg"
64 | %}}
65 |
66 | */}}
67 |
68 | {{/* DEFAULTS */}}
69 | {{- $poster := resources.Get (.Site.Params.poster | default "images/poster.jpg") -}}
70 |
71 | {{ if .IsNamedParams }}
72 |
73 |
74 |
75 |
76 |
77 | To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video
78 |
79 |
80 | {{ else }}
81 |
82 |
83 |
84 |
85 |
86 | To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video
87 |
88 |
89 | {{ end }}
90 |
--------------------------------------------------------------------------------
/exampleSite/config.toml:
--------------------------------------------------------------------------------
1 | baseURL = ""
2 | languageCode = "en"
3 | title = "Hugo Blog"
4 | theme = "hugo-nuo"
5 | enableRobotsTXT = true
6 | PygmentsCodeFences = true
7 | canonifyurls = true
8 |
9 | # Disqus Username
10 | disqusShortname = "disqus_shortname"
11 |
12 | # Google Analytics UA number
13 | googleAnalytics = "UA-XXXXXXXX-X"
14 |
15 | # Copyright of your post
16 | copyright = "© This post is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License,please give source if you wish to quote or reproduce."
17 |
18 | # Initial site menu, you can extend menu with content.
19 | [[menu.main]]
20 | name = "Home"
21 | weight = 10
22 | identifier = "home"
23 | url = "/"
24 |
25 | [[menu.main]]
26 | name = "Works"
27 | weight = 20
28 | identifier = "works"
29 | url = "https://github.com/laozhu"
30 |
31 | [[menu.main]]
32 | name = "Tags"
33 | weight = 30
34 | identifier = "tags"
35 | url = "/tags/"
36 |
37 | # Add your own params here
38 | [params]
39 | author = "Ritchie Zhu"
40 | bg = "images/grey-prism.svg"
41 | avatar = "images/avatar.png"
42 | seotitle = "Hugo Blog (SEO Version)"
43 | subtitle = "~ Keep It Simple & Stupid ~"
44 | description = "Hugo is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again."
45 | paginate = 10
46 |
47 | # Choose your social networks
48 | email = "name@domain.com"
49 | github = "github_username"
50 | twitter = "twitter_username"
51 | linkedin = "linkedin_username"
52 | weibo = "weibo_username"
53 | wechat= "images/qrcode.jpg" # Replace with your wechat qrcode image
54 | # facebook = "facebook_username"
55 | # google = "googlplus_id_number"
56 | # instagram = "instagram_username"
57 | # youtube = "youtube_username"
58 | # vimeo = "vimeo_username"
59 | # medium = "medium_username"
60 | # quora = "quora_username"
61 | # pinterest = "pinterest_username"
62 | # dribbble = "dribbble_username"
63 | # behance = "behance_username"
64 | # jsfiddle = "jsfiddle_username"
65 | # codepen = "codepen_username"
66 | # zhihu = "zhihu_username"
67 | # douban = "douban_username"
68 | # bilibili = "bilibili_id_number"
69 | # stackoverflow = "laozhu"
70 | # codesandbox = "melaozhu"
71 | # npm = "laozhu"
72 | # reddit = "melaozhu"
73 |
74 | # Overrid theme styles in this file
75 | # customStyle = "styles/custom.scss"
76 |
77 | # Changyan Comments (China Only)
78 | changyan = false
79 | changyanId = "cyt3toRiB"
80 | changyanConf = "prod_0908b1cb9a581501753cce1ed074dbe3"
81 |
82 | # Google Webmaster
83 | # https://www.google.com/webmasters/
84 | googleSiteVerification = "_moDmnnBNVLBN1rzNxyGUGdPHE20YgbmrtzLIbxaWFc"
85 |
86 | # Bing Webmaster
87 | # https://www.bing.com/toolbox/webmaster/
88 | msValidate = "22596E34341DD1D17D6022C44647E587"
89 |
90 | # Baidu Webmaster (China Only)
91 | # https://zhanzhang.baidu.com/
92 | # baiduSiteVerification = "MZ23SPxxfa"
93 |
94 | # Sogou Webmaster (China Only)
95 | # http://zhanzhang.sogou.com/
96 | # sogouSiteVerification = "m2jktMQTZm"
97 |
98 | # 360 Webmaster (China Only)
99 | # http://zhanzhang.so.com/
100 | # soSiteVerification = "b7ab3b4c2edbc856642004d1b8c27a91"
101 |
102 | # Baidu Tongji (China Only)
103 | # https://tongji.baidu.com/
104 | # baiduTongji = "e21dc1e8a592188271b615159dc88af7"
105 |
106 | # ICP Number (China Only)
107 | # ICP = "苏ICP备16005986号-2"
108 |
--------------------------------------------------------------------------------
/assets/styles/partials/_syntax.scss:
--------------------------------------------------------------------------------
1 | /* Background */ .chroma { color: #f8f8f2; background-color: #272822 }
2 | /* Error */ .chroma .err { color: #960050; background-color: #1e0010 }
3 | /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
4 | /* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
5 | /* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc }
6 | /* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; }
7 | /* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; }
8 | /* Keyword */ .chroma .k { color: #66d9ef }
9 | /* KeywordConstant */ .chroma .kc { color: #66d9ef }
10 | /* KeywordDeclaration */ .chroma .kd { color: #66d9ef }
11 | /* KeywordNamespace */ .chroma .kn { color: #f92672 }
12 | /* KeywordPseudo */ .chroma .kp { color: #66d9ef }
13 | /* KeywordReserved */ .chroma .kr { color: #66d9ef }
14 | /* KeywordType */ .chroma .kt { color: #66d9ef }
15 | /* NameAttribute */ .chroma .na { color: #a6e22e }
16 | /* NameClass */ .chroma .nc { color: #a6e22e }
17 | /* NameConstant */ .chroma .no { color: #66d9ef }
18 | /* NameDecorator */ .chroma .nd { color: #a6e22e }
19 | /* NameException */ .chroma .ne { color: #a6e22e }
20 | /* NameFunction */ .chroma .nf { color: #a6e22e }
21 | /* NameOther */ .chroma .nx { color: #a6e22e }
22 | /* NameTag */ .chroma .nt { color: #f92672 }
23 | /* Literal */ .chroma .l { color: #ae81ff }
24 | /* LiteralDate */ .chroma .ld { color: #e6db74 }
25 | /* LiteralString */ .chroma .s { color: #e6db74 }
26 | /* LiteralStringAffix */ .chroma .sa { color: #e6db74 }
27 | /* LiteralStringBacktick */ .chroma .sb { color: #e6db74 }
28 | /* LiteralStringChar */ .chroma .sc { color: #e6db74 }
29 | /* LiteralStringDelimiter */ .chroma .dl { color: #e6db74 }
30 | /* LiteralStringDoc */ .chroma .sd { color: #e6db74 }
31 | /* LiteralStringDouble */ .chroma .s2 { color: #e6db74 }
32 | /* LiteralStringEscape */ .chroma .se { color: #ae81ff }
33 | /* LiteralStringHeredoc */ .chroma .sh { color: #e6db74 }
34 | /* LiteralStringInterpol */ .chroma .si { color: #e6db74 }
35 | /* LiteralStringOther */ .chroma .sx { color: #e6db74 }
36 | /* LiteralStringRegex */ .chroma .sr { color: #e6db74 }
37 | /* LiteralStringSingle */ .chroma .s1 { color: #e6db74 }
38 | /* LiteralStringSymbol */ .chroma .ss { color: #e6db74 }
39 | /* LiteralNumber */ .chroma .m { color: #ae81ff }
40 | /* LiteralNumberBin */ .chroma .mb { color: #ae81ff }
41 | /* LiteralNumberFloat */ .chroma .mf { color: #ae81ff }
42 | /* LiteralNumberHex */ .chroma .mh { color: #ae81ff }
43 | /* LiteralNumberInteger */ .chroma .mi { color: #ae81ff }
44 | /* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff }
45 | /* LiteralNumberOct */ .chroma .mo { color: #ae81ff }
46 | /* Operator */ .chroma .o { color: #f92672 }
47 | /* OperatorWord */ .chroma .ow { color: #f92672 }
48 | /* Comment */ .chroma .c { color: #75715e }
49 | /* CommentHashbang */ .chroma .ch { color: #75715e }
50 | /* CommentMultiline */ .chroma .cm { color: #75715e }
51 | /* CommentSingle */ .chroma .c1 { color: #75715e }
52 | /* CommentSpecial */ .chroma .cs { color: #75715e }
53 | /* CommentPreproc */ .chroma .cp { color: #75715e }
54 | /* CommentPreprocFile */ .chroma .cpf { color: #75715e }
55 | /* GenericDeleted */ .chroma .gd { color: #f92672 }
56 | /* GenericEmph */ .chroma .ge { font-style: italic }
57 | /* GenericInserted */ .chroma .gi { color: #a6e22e }
58 | /* GenericStrong */ .chroma .gs { font-weight: bold }
59 | /* GenericSubheading */ .chroma .gu { color: #75715e }
60 |
--------------------------------------------------------------------------------
/assets/service-worker-template.js:
--------------------------------------------------------------------------------
1 | var cacheName = 'hugo-nuo-v5';
2 | var filesToCache = [
3 | '404.html',
4 | 'favicon.ico',
5 | 'manifest.json',
6 | 'icons/icon-16x16.png',
7 | 'icons/icon-32x32.png',
8 | 'icons/icon-128x128.png',
9 | 'icons/icon-144x144.png',
10 | 'icons/icon-152x152.png',
11 | 'icons/icon-192x192.png',
12 | 'icons/icon-256x256.png',
13 | 'icons/icon-512x512.png',
14 | 'images/avatar.png',
15 | 'images/grey-prism.svg',
16 | 'images/qrcode.jpg',
17 | 'styles/main-rendered.min.css',
18 | {{ with .Site.Params.customStyle }}'styles/custom.min.css',{{ end }}
19 | 'scripts/index.min.js',
20 |
21 | // Google fonts
22 | 'https://fonts.googleapis.com/css?family=Lobster',
23 | 'https://fonts.gstatic.com/s/lobster/v20/neILzCirqoswsqX9zoKmM4MwWJU.woff2',
24 |
25 | {{ with .Site.Params.fontAwesome }}
26 | // FontAwesome
27 | 'https://use.fontawesome.com/releases/v5.7.2/css/all.css',
28 | {{ else }}
29 | // Iconfont
30 | 'https://at.alicdn.com/t/font_174169_qmgvd10zwbf.woff',
31 | {{ end }}
32 | // smooth-scroll
33 | 'https://cdn.jsdelivr.net/npm/smooth-scroll@15.0.0/dist/smooth-scroll.min.js',
34 |
35 | // medium-zoom
36 | 'https://cdn.jsdelivr.net/npm/medium-zoom@1.0.2/dist/medium-zoom.min.js',
37 |
38 | // Video.js
39 | 'https://cdn.jsdelivr.net/npm/video.js@7.3.0/dist/video-js.min.css',
40 | 'https://cdn.jsdelivr.net/npm/video.js@7.3.0/dist/video.min.js',
41 |
42 | // MathJax
43 | 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML',
44 | 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js?V=2.7.5',
45 | ];
46 |
47 | // Cache the application assets
48 | self.addEventListener('install', event => {
49 | event.waitUntil(caches.open(cacheName).then(cache => cache.addAll(filesToCache)));
50 | });
51 |
52 | // network first
53 | self.addEventListener('fetch', event => {
54 | event.respondWith(
55 | caches.open(cacheName).then(function(cache) {
56 | return fetch(event.request)
57 | .then(function(response) {
58 | if (response.status === 404) return caches.match('404.html');
59 | cache.put(event.request, response.clone());
60 | return response;
61 | })
62 | .catch(function() {
63 | return caches.match(event.request);
64 | });
65 | }),
66 | );
67 | });
68 |
69 | // cache-first
70 | // If you want to use cache first, you should change cacheName manually
71 |
72 | // self.addEventListener('fetch', event => {
73 | // event.respondWith(
74 | // caches
75 | // .match(event.request)
76 | // .then(response => {
77 | // if (response) return response;
78 | // return fetch(event.request);
79 | // })
80 | // .then(response => {
81 | // if (response.status === 404) return caches.match('404.html');
82 | // return caches.open(cacheName).then(cache => {
83 | // cache.put(event.request.url, response.clone());
84 | // return response;
85 | // });
86 | // })
87 | // .catch(error => console.log('Error, ', error)),
88 | // );
89 | // });
90 |
91 | // Delete outdated caches
92 | self.addEventListener('activate', event => {
93 | const cacheWhitelist = [cacheName];
94 | event.waitUntil(
95 | caches.keys().then(cacheNames => {
96 | return Promise.all(
97 | cacheNames.map(cacheName => {
98 | if (cacheWhitelist.indexOf(cacheName) === -1) {
99 | return caches.delete(cacheName);
100 | }
101 | }),
102 | );
103 | }),
104 | );
105 | });
106 |
--------------------------------------------------------------------------------
/exampleSite/content/post/hugo-nuo-post-preview.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Hugo 主题 Nuo 文章样式预览"
3 | tags: ["Markdown", "Theme", "Hugo"]
4 | date: 2014-07-17
5 | draft: false
6 | ---
7 |
8 | 这篇文章集中说明本人博客主题所支持的 Markdown 语法和 Hugo Shortcodes 插件,你也可以在这里预览到他们的样子。如果你不喜欢某些部分的样式,可以去修改 `content.scss` 和 `shortcodes.scss` 这两个文件。预告一下,我所用的这个名为 `Nuo` 的 `Hugo` 也将于近期发布,敬请期待。
9 |
10 |
11 |
12 | ## 1. 标题
13 |
14 | # H1
15 | ## H2
16 | ### H3
17 | #### H4
18 | ##### H5
19 | ###### H6
20 |
21 | ## 2. 段落
22 |
23 | 使用单引号 `*` 或者单下划线 `_` 标记 *斜体强调* 或者 _斜体强调_
24 |
25 | 使用两个引号 `**` 或者两个下划线 `__` 标记 **加粗强调** 或者 __加粗强调__
26 |
27 | 引号和下划线可叠加使用 → **只是加粗 _斜体并加粗_**
28 |
29 | 使用两个波浪线 `~~` 标记 ~~已删除文字~~
30 |
31 | 插入文字暂无 `Markdown` 标记,直接使用 `HTML` 标签 `` 标记 插入文字
32 |
33 | 行内代码使用反引号标记 → `print("hello world")`
34 |
35 | 上标 X2 / 下标 X2
36 |
37 | 按键 Ctrl
38 |
39 | 外链 [chekun's blog](https://chekun.me)
40 |
41 | 页面内段落 [图片](#section-07)
42 |
43 | *注意:你可以通过 `{#section-id}` 方式自定义段落锚点*
44 |
45 | 参考资料 [[1]](#ref01) [[2]](#ref02)
46 |
47 | 数字引用 [编号为 1 的链接](1)
48 |
49 | ## 3. 列表
50 |
51 | 以下的无序、有序和任务列表均支持二级嵌套,不建议使用二级以上嵌套。
52 |
53 | ### 3.1 无序列表
54 |
55 | * 无序列表
56 | - 嵌套的无序列表
57 | - 嵌套的无序列表
58 | * 无序列表
59 | 1. 嵌套的有序列表
60 | 2. 嵌套的有序列表
61 | * 无序列表
62 |
63 | ### 3.2 有序列表
64 |
65 | 1. 有序列表
66 | 1. 嵌套的有序列表
67 | 2. 嵌套的有序列表
68 | 2. 有序列表
69 | - 嵌套的无序列表
70 | - 嵌套的无序列表
71 | 3. 有序列表
72 |
73 | ### 3.3 定义列表
74 |
75 | CSS
76 | : 层叠样式表
77 |
78 | ### 3.4 任务列表
79 |
80 | - [ ] Cmd Markdown 开发
81 | - [ ] 改进 Cmd 渲染算法,使用局部渲染技术提高渲染效率
82 | - [ ] 支持以 PDF 格式导出文稿
83 | - [x] 新增Todo列表功能 [语法参考](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments)
84 | - [x] 改进 LaTex 功能
85 | - [x] 修复 LaTex 公式渲染问题
86 | - [x] 新增 LaTex 公式编号功能 [语法参考](http://docs.mathjax.org/en/latest/tex.html#tex-eq-numbers)
87 | - [ ] 七月旅行准备
88 | - [ ] 准备邮轮上需要携带的物品
89 | - [ ] 浏览日本免税店的物品
90 | - [x] 购买蓝宝石公主号七月一日的船票
91 |
92 | ## 4. 引用
93 |
94 | > 野火烧不尽,春风吹又生。
95 | >
96 | > -- 白居易《赋得古原草送别》
97 |
98 | ## 5. 代码
99 |
100 | 以本站的一段 `JavaScript` 代码做演示。
101 |
102 | ```javascript
103 | // Initialize video.js player
104 | if (document.getElementById('my-player') !== null) {
105 | /* eslint-disable no-undef */
106 | videojs('#my-player', {
107 | aspectRatio: '16:9',
108 | fluid: true,
109 | });
110 | }
111 | ```
112 |
113 | ## 6. 分割线
114 |
115 | ---
116 |
117 | 中间能写字的分割线,如果你修改了分割线中字的内容,请配合修改 `CSS` 样式。
118 |
119 | ## 7. 图片 {#section-07}
120 |
121 | 不带标题的图片,如下图👇
122 |
123 | 
124 |
125 | 带标题的图片(zoomable),如下图👇
126 |
127 | {{% figure src="/media/posts/hugo-nuo-post-preview/01.jpg" alt="这是一只梅花鹿" title="显然,这是一只梅花鹿" class="zoomable" %}}
128 |
129 | ## 8. 表格
130 |
131 | 使用 `Markdown` 画的表格,如下表👇
132 |
133 | | Tables | Are | Cool |
134 | | :------------ |:-------------:| -----:|
135 | | col 3 is | right-aligned | $1600 |
136 | | col 2 is | centered | $12 |
137 | | zebra stripes | are neat | $1 |
138 |
139 | 使用 `HTML` 画的表格,如下表👇
140 |
141 | *注意:下表叠加应用了 `is-centered` `is-striped` `is-bordered` `is-narrow` 四种表格样式。*
142 |
143 |
144 |
145 | 值班人员
146 | 星期一
147 | 星期二
148 | 星期三
149 |
150 |
151 | 李强
152 | 张明
153 | 王平
154 |
155 |
156 |
157 | ## 9. 数学公式
158 |
159 | 主题使用了 [MathJax](https://www.mathjax.org/) 开源库来实现对数学公式的支持,使用 `$$` 标记。
160 |
161 | $$
162 | \left\{
163 | \begin{aligned}
164 | N & = pq \\
165 | \varphi(n) & = (p-1)(q-1)\\
166 | \end{aligned}
167 | \right.
168 | \Rightarrow
169 | N - \varphi(n) + 1 = p + q
170 | $$
171 |
172 | ## 10. JSFiddle
173 |
174 | 引入 [JSFiddle](https://jsfiddle.net/) 网站的代码范例,在主题目录 `layouts/shortcodes` 文件夹下的 `jsfiddle.html` 对该标签进行定义。
175 |
176 | {{% jsfiddle "laozhu/L479wueo" "html,css,result" %}}
177 |
178 | ## 11. Codepen
179 |
180 | 引入 [Code Pen](https://codepen.io/) 网站的代码演示,在主题目录 `layouts/shortcodes` 文件夹下的 `codepen.html` 对该标签进行定义。
181 |
182 | {{% codepen "RoaWdE" "🐍 Snake Rush" "laozhu" "Ritchie Zhu" "600" %}}
183 |
184 | ## 12. 声享 PPT
185 |
186 | 引入 [声享](https://ppt.baomitu.com/) PPT 演示文稿,在主题目录 `layouts/shortcodes` 文件夹下的 `shengxiang.html` 对该标签进行定义。
187 |
188 | {{% shengxiang "a8a49a00" %}}
189 |
190 | ## 13. 本地视频
191 |
192 | 主题使用了 [video.js](http://videojs.com/) 播放视频文件,你还可以自己定义视频的封面,在主题目录 `layouts/shortcodes` 文件夹下的 `video.html` 对该标签进行定义。
193 |
194 | {{% video
195 | "/media/posts/hugo-nuo-post-preview/videojs.mp4"
196 | "/media/posts/hugo-nuo-post-preview/videojs.webm"
197 | "/media/posts/hugo-nuo-post-preview/videojs.ogv" %}}
198 |
199 | ## 14. 网易云音乐
200 |
201 | 主题文章中可以轻松插入 [网易云音乐](https://music.163.com/) 的指定音乐,你可以根据需要将音乐设置为自动播放,在主题目录 `layouts/shortcodes` 文件夹下的 `music.html` 对该标签进行定义。
202 |
203 | **注意:由于版权问题,网易已经禁止外站分享版权音乐,该 shortcode 已经无法正常使用。**
204 |
205 | ## 15. Gist 代码片段
206 |
207 | 除了本地的代码片段,主题中可使用 [GitHub](https://github.com/) 的 [Gist](https://gist.github.com/) 服务轻松插入代码片段。
208 |
209 | {{% gist "laozhu" "8285349" %}}
210 |
211 | ## 16. Tweet
212 |
213 | 由于不明原因可能无法访问。
214 |
215 | ## 17. YouTube
216 |
217 | 由于不明原因可能无法播放。
218 |
219 | {{% youtube "w7Ft2ymGmfc" %}}
220 |
221 | ## 18. Instagram
222 |
223 | 由于不明原因可能无法访问。
224 |
225 | ## 文章更新
226 |
227 | ### [2017年9月8日](#inline-mathjax)
228 |
229 | 支持行内的数学公式,使用标记 `$` 包裹公式,如下:
230 |
231 | When `\(a \ne 0\)`, there are two solutions to `$ax^2 + bx + c = 0$` and they are
232 | $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
233 |
234 | ## 参考资料
235 |
236 | 1. [Markdown Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)
237 | 2. [Markdown 语法手册](https://www.zybuluo.com/EncyKe/note/120103)
238 |
--------------------------------------------------------------------------------
/layouts/shortcodes/asciinema.html:
--------------------------------------------------------------------------------
1 | {{/*
2 |
3 | ## Asciinema Cast
4 |
5 | ### This shortcode is not mobile friendly :(
6 | ### You can embed image for mobile
7 | ### Or you can set rows and cols to make player small for mobile.
8 |
9 | ### Params:
10 |
11 | - Cast `id`
12 |
13 | required param
14 | you can extract from asciicast url
15 | url format "https://asciinema.org/a/107960"
16 |
17 | - Cast Embed `type`
18 |
19 | optional param
20 | Embed image link or the player
21 | default value "player"
22 | you can set "image" or "player"
23 |
24 | - Cast `started`
25 |
26 | optional param
27 | Append ?t=30 to start the playback at 30s, ?t=3:20 to start the playback at 3m 20s.
28 |
29 | - Cast `speed`
30 |
31 | optional param
32 | The speed option alters the playback speed.
33 | The default speed is 1 which means it plays at the unaltered, original speed.
34 |
35 | - Cast `size`
36 |
37 | optional param
38 | The size option alters the size of the terminal font. There are 3 available sizes:
39 |
40 | * small (default)
41 | * medium
42 | * big
43 |
44 | - Cast `theme`
45 |
46 | optional param
47 | The theme option allows overriding a theme used for the terminal.
48 | It defaults to a theme set by the asciicast author, The available themes are:
49 |
50 | * asciinema,
51 | * tango
52 | * solarized-dark
53 | * solarized-light
54 | * monokai
55 |
56 | - Cast `cols`
57 |
58 | optional param
59 | The cols option allows overriding width (in characters) of the emulated terminal.
60 | By default the recorded terminal’s width is used.
61 |
62 | - Cast `rows`
63 |
64 | optional param
65 | The rows option allows overriding height (in lines) of the emulated terminal.
66 | By default the recorded terminal’s height is used.
67 |
68 | - Cast `autoplay`
69 |
70 | optional param
71 | The autoplay option controls whether the playback should automatically start when the player loads.
72 | default value "0"
73 | you can set "0" or "1"
74 |
75 | - Cast `loop`
76 |
77 | optional param
78 | The loop option allows for looping the playback. This option is usually combined with autoplay option.
79 | default value "0"
80 | you can set "0" or "1"
81 |
82 | - Cast `preload`
83 |
84 | optional param
85 | The preload option controls whether the player should immediately start fetching the recording.
86 | default value "1"
87 | you can set "0" or "1"
88 |
89 | ### Examples:
90 |
91 | - Simple
92 |
93 | {{% asciinema "107960" %}}
94 | {{% asciinema "107960" "image" "30" %}}
95 | {{% asciinema "107960" "30" "3" "small" "monokai" "80" "20" "1" "1" "1" %}}
96 |
97 | - Named Params
98 |
99 | {{% asciinema id="107960" %}}
100 | {{% asciinema id="107960" type="image" started="30" %}}
101 | {{% asciinema id="107960" started="30" speed="3" size="small" theme="monokai" cols="80" rows="20" autoplay="1" loop="1" preload="1" %}}
102 |
103 | */}}
104 |
105 | {{/* DEFAULTS */}}
106 | {{ $type := "player" }}
107 | {{ $size := "small" }}
108 | {{ $theme := "asciinema" }}
109 | {{ $preload := "1" }}
110 |
111 | {{ if .IsNamedParams }}
112 |
113 | {{ if eq (.Get "type") "image" }}
114 |
115 | {{ else }}
116 |
117 | {{ end }}
118 |
119 | {{ else }}
120 |
121 | {{ if isset .Params 1 }}
122 | {{ if eq (.Get 1) "image" }}
123 |
124 | {{ else if eq (.Get 1) $type }}
125 |
126 | {{ else }}
127 |
128 | {{ end }}
129 | {{ else }}
130 |
131 | {{ end }}
132 |
133 | {{ end }}
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/assets/styles/partials/_content.scss:
--------------------------------------------------------------------------------
1 | .post-content {
2 | position: relative;
3 | color: $text;
4 | line-height: 1.8;
5 | word-wrap: break-word;
6 | word-break: break-word;
7 |
8 | & li + li {
9 | margin-top: 0.5rem;
10 | }
11 |
12 | & a {
13 | padding-bottom: 0.1em;
14 | border-bottom: 1px dashed $green-light;
15 | color: $primary;
16 | opacity: 1;
17 |
18 | &:focus,
19 | &:hover {
20 | border-bottom: 1px solid $green-light;
21 | }
22 | }
23 |
24 | & em {
25 | color: $text-light;
26 | font-style: italic;
27 | }
28 |
29 | & strong {
30 | color: $text-strong;
31 | }
32 |
33 | & del {
34 | color: $text-light;
35 | text-decoration: line-through;
36 | }
37 |
38 | & ins {
39 | color: $text-strong;
40 | text-decoration: underline;
41 | }
42 |
43 | & hr {
44 | position: relative;
45 | margin: 2rem auto;
46 | border-top: 1px dashed $grey-lighter;
47 | border-bottom: none;
48 |
49 | &::before {
50 | content: "sep line";
51 | position: absolute;
52 | top: -12px;
53 | left: calc(50% - 40px);
54 | padding: 0 0.5rem;
55 | background-color: $white;
56 | color: $grey-lighter;
57 | font-size: $size-7;
58 | font-family: $family-monospace;
59 | }
60 | }
61 |
62 | & h1,
63 | & h2,
64 | & h3,
65 | & h4,
66 | & h5,
67 | & h6 {
68 | color: $text-strong;
69 | font-weight: $weight-semibold;
70 | line-height: 1.125;
71 | text-align: left;
72 | }
73 |
74 | & h1 {
75 | margin-top: 2rem;
76 | margin-bottom: 1rem;
77 | font-size: $size-2;
78 | }
79 |
80 | & h2 {
81 | margin-top: 1.75rem;
82 | margin-bottom: 0.75rem;
83 | font-size: $size-3;
84 | }
85 |
86 | & h3 {
87 | margin-top: 1.5rem;
88 | margin-bottom: 0.5rem;
89 | font-size: $size-4;
90 | }
91 |
92 | & h4 {
93 | margin-top: 1.25rem;
94 | margin-bottom: 0.25rem;
95 | font-size: $size-5;
96 | }
97 |
98 | & h5 {
99 | margin-top: 1rem;
100 | margin-bottom: 0;
101 | font-size: $size-6;
102 | }
103 |
104 | & h6 {
105 | margin-top: 1rem;
106 | margin-bottom: 0;
107 | font-size: $size-7;
108 | }
109 |
110 | & p {
111 | margin-top: 1.5rem;
112 | margin-bottom: 1.5rem;
113 | }
114 |
115 | & blockquote {
116 | background-color: $background;
117 | border-left: 5px solid $border;
118 | padding: 0.5rem 1rem;
119 | margin: 2rem 0;
120 |
121 | & p {
122 | margin-top: 0.5rem;
123 | margin-bottom: 0.5rem;
124 | }
125 |
126 | & cite {
127 | margin-top: 1.5rem;
128 | color: $text-light;
129 | font-size: 0.9rem;
130 | }
131 | }
132 |
133 | & tt,
134 | & code {
135 | padding: 0;
136 | padding-top: 0.2em;
137 | padding-bottom: 0.2em;
138 | margin: 0;
139 | font-size: 0.9em;
140 | background-color: $code-background;
141 | font-family: $family-monospace;
142 |
143 | &::before,
144 | &::after {
145 | letter-spacing: -0.2em;
146 | content: "\00a0";
147 | }
148 |
149 | &.has-jax {
150 | padding: 0;
151 | font-size: 1em;
152 | background-color: transparent;
153 | }
154 | }
155 |
156 | & kbd {
157 | display: inline-block;
158 | padding: 0.25em;
159 | background-color: $white-bis;
160 | border: 1px solid $grey-lighter;
161 | border-bottom-color: $grey-light;
162 | border-radius: $radius;
163 | box-shadow: inset 0 -1px 0 $grey-light;
164 | font-size: 0.8em;
165 | line-height: 1.25;
166 | font-family: $family-monospace;
167 | color: $text;
168 | }
169 |
170 | & .highlight {
171 | margin: 2rem auto;
172 | border-radius: $radius;
173 | overflow: hidden;
174 |
175 | & pre {
176 | margin: 0 auto;
177 | }
178 |
179 | & td:first-child {
180 | & pre {
181 | padding-right: 0;
182 | }
183 | }
184 |
185 | & td:last-child {
186 | & pre {
187 | padding-left: 0;
188 | }
189 | }
190 | }
191 |
192 | & pre {
193 | margin: 2rem auto;
194 | padding: 1rem;
195 | overflow-x: auto;
196 | font-size: 0.9rem;
197 | line-height: 1.618;
198 | white-space: pre;
199 | word-wrap: normal;
200 | word-break: normal;
201 |
202 | & code {
203 | font-size: 0.9rem;
204 | background-color: transparent;
205 |
206 | &::before,
207 | &::after {
208 | content: none;
209 | }
210 | }
211 | }
212 |
213 | & sup,
214 | & sub {
215 | font-size: $size-7;
216 |
217 | & a {
218 | border-bottom: none;
219 |
220 | &:focus,
221 | &:hover {
222 | border-bottom: none;
223 | }
224 | }
225 | }
226 |
227 | & ol {
228 | margin-left: 0;
229 | margin-top: 2rem;
230 | margin-bottom: 2rem;
231 | padding-left: 1.5rem;
232 | list-style: decimal outside;
233 |
234 | & ol {
235 | margin-top: 0.5rem;
236 | margin-bottom: 0.5rem;
237 | list-style: lower-roman outside;
238 | }
239 |
240 | & ul {
241 | margin-top: 0.5rem;
242 | margin-bottom: 0.5rem;
243 | list-style: disc outside;
244 | }
245 | }
246 |
247 | & ul {
248 | margin-left: 0;
249 | margin-top: 2rem;
250 | margin-bottom: 2rem;
251 | padding-left: 1.5rem;
252 | list-style: disc outside;
253 |
254 | & ul {
255 | margin-top: 0.5rem;
256 | margin-bottom: 0.5rem;
257 | list-style: circle outside;
258 | }
259 |
260 | & ol {
261 | margin-top: 0.5rem;
262 | margin-bottom: 0.5rem;
263 | list-style: decimal outside;
264 | }
265 | }
266 |
267 | & .task-list {
268 | margin-top: 2rem;
269 | margin-bottom: 2rem;
270 | list-style: none;
271 | padding-left: 0;
272 |
273 | & .task-list {
274 | margin-top: 0.5rem;
275 | margin-bottom: 0.5rem;
276 | padding-left: 1.5rem;
277 | }
278 | }
279 |
280 | & dl {
281 | margin-top: 2rem;
282 | margin-bottom: 2rem;
283 |
284 | & dt {
285 | color: $primary;
286 | margin-top: 1rem;
287 |
288 | &::after {
289 | content: ':';
290 | }
291 | }
292 |
293 | & dd {
294 | text-indent: 2rem;
295 | margin-left: 0;
296 | margin-top: 0.25rem;
297 | }
298 | }
299 |
300 | & figure {
301 | display: block;
302 | margin: 2rem auto;
303 |
304 | & img {
305 | max-width: 100%;
306 | box-shadow: 2px 20px 40px 10px $box-shadow-dark;
307 |
308 | @media screen and (max-width: $tablet) {
309 | box-shadow: none;
310 | }
311 | }
312 |
313 | & figcaption {
314 | & h4 {
315 | color: $grey-light;
316 | font-size: 0.9rem;
317 | text-align: center;
318 | }
319 | }
320 | }
321 |
322 | & img {
323 | display: block;
324 | margin: 2rem auto;
325 | max-width: 100%;
326 | box-shadow: 2px 20px 40px 10px $box-shadow-dark;
327 |
328 | @media screen and (max-width: $tablet) {
329 | box-shadow: none;
330 | }
331 | }
332 |
333 | & div.has-jax {
334 | margin: 2rem auto;
335 | overflow-x: auto;
336 | }
337 |
338 | & .MathJax_Display,
339 | & .MathJax {
340 | &:focus {
341 | outline: none;
342 | }
343 | }
344 | }
345 |
--------------------------------------------------------------------------------
/assets/images/grey-prism.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/exampleSite/content/post/migrate-from-jekyll.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Migrate to Hugo from Jekyll
3 | date: 2014-03-10
4 | ---
5 |
6 | ## Move static content to `static`
7 | 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.
8 | With Jekyll, something that looked like
9 |
10 | ▾ /
11 | ▾ images/
12 | logo.png
13 |
14 | should become
15 |
16 | ▾ /
17 | ▾ static/
18 | ▾ images/
19 | logo.png
20 |
21 | Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`.
22 |
23 | ## Create your Hugo configuration file
24 | 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.
25 |
26 | ## Set your configuration publish folder to `_site`
27 | 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:
28 |
29 | 1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended).
30 |
31 | git submodule deinit _site
32 | git rm _site
33 | git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
34 |
35 | 2. Or, change the Hugo configuration to use `_site` instead of `public`.
36 |
37 | {
38 | ..
39 | "publishdir": "_site",
40 | ..
41 | }
42 |
43 | ## Convert Jekyll templates to Hugo templates
44 | 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.
45 |
46 | As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours.
47 |
48 | ## Convert Jekyll plugins to Hugo shortcodes
49 | Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port.
50 |
51 | ### Implementation
52 | 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.
53 |
54 | Jekyll's plugin:
55 |
56 | module Jekyll
57 | class ImageTag < Liquid::Tag
58 | @url = nil
59 | @caption = nil
60 | @class = nil
61 | @link = nil
62 | // Patterns
63 | IMAGE_URL_WITH_CLASS_AND_CAPTION =
64 | IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i
65 | IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i
66 | IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
67 | IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
68 | def initialize(tag_name, markup, tokens)
69 | super
70 | if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
71 | @class = $1
72 | @url = $3
73 | @caption = $7
74 | @link = $9
75 | elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
76 | @class = $1
77 | @url = $3
78 | @caption = $7
79 | elsif markup =~ IMAGE_URL_WITH_CAPTION
80 | @url = $1
81 | @caption = $5
82 | elsif markup =~ IMAGE_URL_WITH_CLASS
83 | @class = $1
84 | @url = $3
85 | elsif markup =~ IMAGE_URL
86 | @url = $1
87 | end
88 | end
89 | def render(context)
90 | if @class
91 | source = ""
92 | else
93 | source = ""
94 | end
95 | if @link
96 | source += ""
97 | end
98 | source += " "
99 | if @link
100 | source += " "
101 | end
102 | source += "#{@caption} " if @caption
103 | source += " "
104 | source
105 | end
106 | end
107 | end
108 | Liquid::Template.register_tag('image', Jekyll::ImageTag)
109 |
110 | is written as this Hugo shortcode:
111 |
112 |
113 |
114 | {{ with .Get "link"}}{{ end }}
115 |
116 | {{ if .Get "link"}} {{ end }}
117 | {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
118 | {{ if isset .Params "title" }}
119 | {{ .Get "title" }}{{ end }}
120 | {{ if or (.Get "caption") (.Get "attr")}}
121 | {{ .Get "caption" }}
122 | {{ with .Get "attrlink"}} {{ end }}
123 | {{ .Get "attr" }}
124 | {{ if .Get "attrlink"}} {{ end }}
125 |
{{ end }}
126 |
127 | {{ end }}
128 |
129 |
130 |
131 | ### Usage
132 | I simply changed:
133 |
134 | {% 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/ %}
135 |
136 | to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`):
137 |
138 | {{%/* 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/" */%}}
139 |
140 | As a bonus, the shortcode named parameters are, arguably, more readable.
141 |
142 | ## Finishing touches
143 | ### Fix content
144 | 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.
145 |
146 | ### Clean up
147 | You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it.
148 |
149 | ## A practical example in a diff
150 | [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).
151 |
--------------------------------------------------------------------------------
/assets/styles/partials/_reset.scss:
--------------------------------------------------------------------------------
1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
2 |
3 | /* Document
4 | ========================================================================== */
5 |
6 | /**
7 | * 1. Correct the line height in all browsers.
8 | * 2. Prevent adjustments of font size after orientation changes in iOS.
9 | */
10 |
11 | html {
12 | line-height: 1.15; /* 1 */
13 | -webkit-text-size-adjust: 100%; /* 2 */
14 | }
15 |
16 | /* Sections
17 | ========================================================================== */
18 |
19 | /**
20 | * Remove the margin in all browsers.
21 | */
22 |
23 | body {
24 | margin: 0;
25 | }
26 |
27 | /**
28 | * Render the `main` element consistently in IE.
29 | */
30 |
31 | main {
32 | display: block;
33 | }
34 |
35 | /**
36 | * Correct the font size and margin on `h1` elements within `section` and
37 | * `article` contexts in Chrome, Firefox, and Safari.
38 | */
39 |
40 | h1 {
41 | font-size: 2em;
42 | margin: 0.67em 0;
43 | }
44 |
45 | /* Grouping content
46 | ========================================================================== */
47 |
48 | /**
49 | * 1. Add the correct box sizing in Firefox.
50 | * 2. Show the overflow in Edge and IE.
51 | */
52 |
53 | hr {
54 | box-sizing: content-box; /* 1 */
55 | height: 0; /* 1 */
56 | overflow: visible; /* 2 */
57 | }
58 |
59 | /**
60 | * 1. Correct the inheritance and scaling of font size in all browsers.
61 | * 2. Correct the odd `em` font sizing in all browsers.
62 | */
63 |
64 | pre {
65 | font-family: monospace, monospace; /* 1 */
66 | font-size: 1em; /* 2 */
67 | }
68 |
69 | /* Text-level semantics
70 | ========================================================================== */
71 |
72 | /**
73 | * Remove the gray background on active links in IE 10.
74 | */
75 |
76 | a {
77 | background-color: transparent;
78 | }
79 |
80 | /**
81 | * 1. Remove the bottom border in Chrome 57-
82 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
83 | */
84 |
85 | abbr[title] {
86 | border-bottom: none; /* 1 */
87 | text-decoration: underline; /* 2 */
88 | text-decoration: underline dotted; /* 2 */
89 | }
90 |
91 | /**
92 | * Add the correct font weight in Chrome, Edge, and Safari.
93 | */
94 |
95 | b,
96 | strong {
97 | font-weight: bolder;
98 | }
99 |
100 | /**
101 | * 1. Correct the inheritance and scaling of font size in all browsers.
102 | * 2. Correct the odd `em` font sizing in all browsers.
103 | */
104 |
105 | code,
106 | kbd,
107 | samp {
108 | font-family: monospace, monospace; /* 1 */
109 | font-size: 1em; /* 2 */
110 | }
111 |
112 | /**
113 | * Add the correct font size in all browsers.
114 | */
115 |
116 | small {
117 | font-size: 80%;
118 | }
119 |
120 | /**
121 | * Prevent `sub` and `sup` elements from affecting the line height in
122 | * all browsers.
123 | */
124 |
125 | sub,
126 | sup {
127 | font-size: 75%;
128 | line-height: 0;
129 | position: relative;
130 | vertical-align: baseline;
131 | }
132 |
133 | sub {
134 | bottom: -0.25em;
135 | }
136 |
137 | sup {
138 | top: -0.5em;
139 | }
140 |
141 | /* Embedded content
142 | ========================================================================== */
143 |
144 | /**
145 | * Remove the border on images inside links in IE 10.
146 | */
147 |
148 | img {
149 | border-style: none;
150 | }
151 |
152 | /* Forms
153 | ========================================================================== */
154 |
155 | /**
156 | * 1. Change the font styles in all browsers.
157 | * 2. Remove the margin in Firefox and Safari.
158 | */
159 |
160 | button,
161 | input,
162 | optgroup,
163 | select,
164 | textarea {
165 | font-family: inherit; /* 1 */
166 | font-size: 100%; /* 1 */
167 | line-height: 1.15; /* 1 */
168 | margin: 0; /* 2 */
169 | }
170 |
171 | /**
172 | * Show the overflow in IE.
173 | * 1. Show the overflow in Edge.
174 | */
175 |
176 | button,
177 | input { /* 1 */
178 | overflow: visible;
179 | }
180 |
181 | /**
182 | * Remove the inheritance of text transform in Edge, Firefox, and IE.
183 | * 1. Remove the inheritance of text transform in Firefox.
184 | */
185 |
186 | button,
187 | select { /* 1 */
188 | text-transform: none;
189 | }
190 |
191 | /**
192 | * Correct the inability to style clickable types in iOS and Safari.
193 | */
194 |
195 | button,
196 | [type="button"],
197 | [type="reset"],
198 | [type="submit"] {
199 | -webkit-appearance: button;
200 | }
201 |
202 | /**
203 | * Remove the inner border and padding in Firefox.
204 | */
205 |
206 | button::-moz-focus-inner,
207 | [type="button"]::-moz-focus-inner,
208 | [type="reset"]::-moz-focus-inner,
209 | [type="submit"]::-moz-focus-inner {
210 | border-style: none;
211 | padding: 0;
212 | }
213 |
214 | /**
215 | * Restore the focus styles unset by the previous rule.
216 | */
217 |
218 | button:-moz-focusring,
219 | [type="button"]:-moz-focusring,
220 | [type="reset"]:-moz-focusring,
221 | [type="submit"]:-moz-focusring {
222 | outline: 1px dotted ButtonText;
223 | }
224 |
225 | /**
226 | * Correct the padding in Firefox.
227 | */
228 |
229 | fieldset {
230 | padding: 0.35em 0.75em 0.625em;
231 | }
232 |
233 | /**
234 | * 1. Correct the text wrapping in Edge and IE.
235 | * 2. Correct the color inheritance from `fieldset` elements in IE.
236 | * 3. Remove the padding so developers are not caught out when they zero out
237 | * `fieldset` elements in all browsers.
238 | */
239 |
240 | legend {
241 | box-sizing: border-box; /* 1 */
242 | color: inherit; /* 2 */
243 | display: table; /* 1 */
244 | max-width: 100%; /* 1 */
245 | padding: 0; /* 3 */
246 | white-space: normal; /* 1 */
247 | }
248 |
249 | /**
250 | * Add the correct vertical alignment in Chrome, Firefox, and Opera.
251 | */
252 |
253 | progress {
254 | vertical-align: baseline;
255 | }
256 |
257 | /**
258 | * Remove the default vertical scrollbar in IE 10+.
259 | */
260 |
261 | textarea {
262 | overflow: auto;
263 | }
264 |
265 | /**
266 | * 1. Add the correct box sizing in IE 10.
267 | * 2. Remove the padding in IE 10.
268 | */
269 |
270 | [type="checkbox"],
271 | [type="radio"] {
272 | box-sizing: border-box; /* 1 */
273 | padding: 0; /* 2 */
274 | }
275 |
276 | /**
277 | * Correct the cursor style of increment and decrement buttons in Chrome.
278 | */
279 |
280 | [type="number"]::-webkit-inner-spin-button,
281 | [type="number"]::-webkit-outer-spin-button {
282 | height: auto;
283 | }
284 |
285 | /**
286 | * 1. Correct the odd appearance in Chrome and Safari.
287 | * 2. Correct the outline style in Safari.
288 | */
289 |
290 | [type="search"] {
291 | -webkit-appearance: textfield; /* 1 */
292 | outline-offset: -2px; /* 2 */
293 | }
294 |
295 | /**
296 | * Remove the inner padding in Chrome and Safari on macOS.
297 | */
298 |
299 | [type="search"]::-webkit-search-decoration {
300 | -webkit-appearance: none;
301 | }
302 |
303 | /**
304 | * 1. Correct the inability to style clickable types in iOS and Safari.
305 | * 2. Change font properties to `inherit` in Safari.
306 | */
307 |
308 | ::-webkit-file-upload-button {
309 | -webkit-appearance: button; /* 1 */
310 | font: inherit; /* 2 */
311 | }
312 |
313 | /* Interactive
314 | ========================================================================== */
315 |
316 | /*
317 | * Add the correct display in Edge, IE 10+, and Firefox.
318 | */
319 |
320 | details {
321 | display: block;
322 | }
323 |
324 | /*
325 | * Add the correct display in all browsers.
326 | */
327 |
328 | summary {
329 | display: list-item;
330 | }
331 |
332 | /* Misc
333 | ========================================================================== */
334 |
335 | /**
336 | * Add the correct display in IE 10+.
337 | */
338 |
339 | template {
340 | display: none;
341 | }
342 |
343 | /**
344 | * Add the correct display in IE 10.
345 | */
346 |
347 | [hidden] {
348 | display: none;
349 | }
350 |
--------------------------------------------------------------------------------
/layouts/partials/head.html:
--------------------------------------------------------------------------------
1 |
2 | {{- $gohugoio := "gohugoio" -}}
3 | {{- $themeColor := "#02b875" -}}
4 | {{- $favicon := "favicon.ico" -}}
5 | {{- $icon16 := "icons/icon-16x16.png" -}}
6 | {{- $icon32 := "icons/icon-32x32.png" -}}
7 | {{- $icon144 := "icons/icon-144x144.png" -}}
8 | {{- $icon152 := "icons/icon-152x152.png" -}}
9 | {{- $icon192 := "icons/icon-192x192.png" -}}
10 | {{- $manifest := "manifest.json" -}}
11 | {{- $bg := resources.Get (.Site.Params.bg | default "images/grey-prism.svg") -}}
12 | {{- $avatar := resources.Get (.Site.Params.avatar | default "images/avatar.png") -}}
13 | {{- $style := resources.Get "styles/main.scss" | resources.ExecuteAsTemplate "styles/main-rendered.scss" . | resources.ToCSS | resources.Minify -}}
14 | {{- $customStyle := resources.Get (.Site.Params.customStyle | default "styles/custom.scss") | resources.ToCSS | resources.Minify -}}
15 | {{- $fontAwesome := "https://use.fontawesome.com/releases/v5.8.1/css/all.css" -}}
16 | {{- $fontAwesomeIntegrity := "sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" -}}
17 |
18 |
19 |
20 | {{ with .Site.Params.fontAwesome }}
21 |
22 | {{ else }}
23 |
24 | {{ end }}
25 |
26 |
27 | {{ with .Site.DisqusShortname }} {{ end }}
28 | {{ with .Site.DisqusShortname }} {{ end }}
29 | {{ with .Site.Params.Gitment }} {{ end }}
30 | {{ with .Site.GoogleAnalytics }} {{ end }}
31 | {{ with .Site.Params.baidutongji }} {{ end }}
32 |
33 | {{ if and (eq .Kind "page") (eq .Type "post") }}
34 |
35 |
36 | {{ with .Params.author }} {{ end }}
37 |
38 |
39 |
40 | {{ if isset .Params "cover" }}
41 |
42 |
43 |
44 |
45 |
46 | {{ else }}
47 |
48 |
49 |
50 |
51 |
52 | {{ end }}
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | {{ else }}
62 |
63 |
64 | {{ with .Site.Params.author }} {{ end }}
65 | {{ with .Site.Params.description }} {{ end }}
66 |
67 |
68 |
69 |
70 |
71 | {{ with .Site.Params.description }} {{ end }}
72 |
73 |
74 |
75 |
76 |
77 | {{ with .Site.Params.description }} {{ end }}
78 |
79 |
80 |
81 | {{ end }}
82 |
83 |
84 |
85 |
86 |
87 |
88 | {{ range .AlternativeOutputFormats -}}
89 | {{ printf ` ` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
90 | {{ end -}}
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | {{ with .Site.Params.googlesiteverification }} {{ end }}
102 | {{ with .Site.Params.msvalidate }} {{ end }}
103 | {{ with .Site.Params.baidusiteverification }} {{ end }}
104 | {{ with .Site.Params.sogousiteverification }} {{ end }}
105 | {{ with .Site.Params.sositeverification }} {{ end }}
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 | {{ with .Site.Params.customStyle }} {{ end }}
127 |
128 |
129 |
130 |
131 |
132 |
137 |
138 | {{ with .Site.Params.fontAwesome }}
139 |
140 | {{ end }}
141 | {{ with .Site.Params.customStyle }} {{ end }}
142 |
143 |
144 |
145 | {{ if and (eq .Kind "page") (eq .Type "post") }}
146 |
147 | {{ end }}
148 |
149 |
150 | {{ if and (eq .Kind "page") (eq .Type "post") }}
151 |
152 | {{ end }}
153 |
--------------------------------------------------------------------------------
/exampleSite/content/post/goisforlovers.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: (Hu)go Template Primer
3 | tags: ["go", "golang", "templates", "themes", "development"]
4 | date: 2014-07-28
5 | ---
6 |
7 | Hugo uses the excellent [go][] [html/template][gohtmltemplate] library for
8 | its template engine. It is an extremely lightweight engine that provides a very
9 | small amount of logic. In our experience that it is just the right amount of
10 | logic to be able to create a good static website. If you have used other
11 | template systems from different languages or frameworks you will find a lot of
12 | similarities in go templates.
13 |
14 | This document is a brief primer on using go templates. The [go docs][gohtmltemplate]
15 | provide more details.
16 |
17 | ## Introduction to Go Templates
18 |
19 | Go templates provide an extremely simple template language. It adheres to the
20 | belief that only the most basic of logic belongs in the template or view layer.
21 | One consequence of this simplicity is that go templates parse very quickly.
22 |
23 | A unique characteristic of go templates is they are content aware. Variables and
24 | content will be sanitized depending on the context of where they are used. More
25 | details can be found in the [go docs][gohtmltemplate].
26 |
27 | ## Basic Syntax
28 |
29 | Go lang templates are html files with the addition of variables and
30 | functions.
31 |
32 | **Go variables and functions are accessible within {{ }}**
33 |
34 | Accessing a predefined variable "foo":
35 |
36 | {{ foo }}
37 |
38 | **Parameters are separated using spaces**
39 |
40 | Calling the add function with input of 1, 2:
41 |
42 | {{ add 1 2 }}
43 |
44 | **Methods and fields are accessed via dot notation**
45 |
46 | Accessing the Page Parameter "bar"
47 |
48 | {{ .Params.bar }}
49 |
50 | **Parentheses can be used to group items together**
51 |
52 | {{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }}
53 |
54 |
55 | ## Variables
56 |
57 | Each go template has a struct (object) made available to it. In hugo each
58 | template is passed either a page or a node struct depending on which type of
59 | page you are rendering. More details are available on the
60 | [variables](/layout/variables) page.
61 |
62 | A variable is accessed by referencing the variable name.
63 |
64 | {{ .Title }}
65 |
66 | Variables can also be defined and referenced.
67 |
68 | {{ $address := "123 Main St."}}
69 | {{ $address }}
70 |
71 |
72 | ## Functions
73 |
74 | Go template ship with a few functions which provide basic functionality. The go
75 | template system also provides a mechanism for applications to extend the
76 | available functions with their own. [Hugo template
77 | functions](/layout/functions) provide some additional functionality we believe
78 | are useful for building websites. Functions are called by using their name
79 | followed by the required parameters separated by spaces. Template
80 | functions cannot be added without recompiling hugo.
81 |
82 | **Example:**
83 |
84 | {{ add 1 2 }}
85 |
86 | ## Includes
87 |
88 | When including another template you will pass to it the data it will be
89 | able to access. To pass along the current context please remember to
90 | include a trailing dot. The templates location will always be starting at
91 | the /layout/ directory within Hugo.
92 |
93 | **Example:**
94 |
95 | {{ template "chrome/header.html" . }}
96 |
97 |
98 | ## Logic
99 |
100 | Go templates provide the most basic iteration and conditional logic.
101 |
102 | ### Iteration
103 |
104 | Just like in go, the go templates make heavy use of range to iterate over
105 | a map, array or slice. The following are different examples of how to use
106 | range.
107 |
108 | **Example 1: Using Context**
109 |
110 | {{ range array }}
111 | {{ . }}
112 | {{ end }}
113 |
114 | **Example 2: Declaring value variable name**
115 |
116 | {{range $element := array}}
117 | {{ $element }}
118 | {{ end }}
119 |
120 | **Example 2: Declaring key and value variable name**
121 |
122 | {{range $index, $element := array}}
123 | {{ $index }}
124 | {{ $element }}
125 | {{ end }}
126 |
127 | ### Conditionals
128 |
129 | If, else, with, or, & and provide the framework for handling conditional
130 | logic in Go Templates. Like range, each statement is closed with `end`.
131 |
132 |
133 | Go Templates treat the following values as false:
134 |
135 | * false
136 | * 0
137 | * any array, slice, map, or string of length zero
138 |
139 | **Example 1: If**
140 |
141 | {{ if isset .Params "title" }}{{ index .Params "title" }} {{ end }}
142 |
143 | **Example 2: If -> Else**
144 |
145 | {{ if isset .Params "alt" }}
146 | {{ index .Params "alt" }}
147 | {{else}}
148 | {{ index .Params "caption" }}
149 | {{ end }}
150 |
151 | **Example 3: And & Or**
152 |
153 | {{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
154 |
155 | **Example 4: With**
156 |
157 | An alternative way of writing "if" and then referencing the same value
158 | is to use "with" instead. With rebinds the context `.` within its scope,
159 | and skips the block if the variable is absent.
160 |
161 | The first example above could be simplified as:
162 |
163 | {{ with .Params.title }}{{ . }} {{ end }}
164 |
165 | **Example 5: If -> Else If**
166 |
167 | {{ if isset .Params "alt" }}
168 | {{ index .Params "alt" }}
169 | {{ else if isset .Params "caption" }}
170 | {{ index .Params "caption" }}
171 | {{ end }}
172 |
173 | ## Pipes
174 |
175 | One of the most powerful components of go templates is the ability to
176 | stack actions one after another. This is done by using pipes. Borrowed
177 | from unix pipes, the concept is simple, each pipeline's output becomes the
178 | input of the following pipe.
179 |
180 | Because of the very simple syntax of go templates, the pipe is essential
181 | to being able to chain together function calls. One limitation of the
182 | pipes is that they only can work with a single value and that value
183 | becomes the last parameter of the next pipeline.
184 |
185 | A few simple examples should help convey how to use the pipe.
186 |
187 | **Example 1 :**
188 |
189 | {{ if eq 1 1 }} Same {{ end }}
190 |
191 | is the same as
192 |
193 | {{ eq 1 1 | if }} Same {{ end }}
194 |
195 | It does look odd to place the if at the end, but it does provide a good
196 | illustration of how to use the pipes.
197 |
198 | **Example 2 :**
199 |
200 | {{ index .Params "disqus_url" | html }}
201 |
202 | Access the page parameter called "disqus_url" and escape the HTML.
203 |
204 | **Example 3 :**
205 |
206 | {{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
207 | Stuff Here
208 | {{ end }}
209 |
210 | Could be rewritten as
211 |
212 | {{ isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" | if }}
213 | Stuff Here
214 | {{ end }}
215 |
216 |
217 | ## Context (aka. the dot)
218 |
219 | The most easily overlooked concept to understand about go templates is that {{ . }}
220 | always refers to the current context. In the top level of your template this
221 | will be the data set made available to it. Inside of a iteration it will have
222 | the value of the current item. When inside of a loop the context has changed. .
223 | will no longer refer to the data available to the entire page. If you need to
224 | access this from within the loop you will likely want to set it to a variable
225 | instead of depending on the context.
226 |
227 | **Example:**
228 |
229 | {{ $title := .Site.Title }}
230 | {{ range .Params.tags }}
231 | {{ . }} - {{ $title }}
232 | {{ end }}
233 |
234 | Notice how once we have entered the loop the value of {{ . }} has changed. We
235 | have defined a variable outside of the loop so we have access to it from within
236 | the loop.
237 |
238 | # Hugo Parameters
239 |
240 | Hugo provides the option of passing values to the template language
241 | through the site configuration (for sitewide values), or through the meta
242 | data of each specific piece of content. You can define any values of any
243 | type (supported by your front matter/config format) and use them however
244 | you want to inside of your templates.
245 |
246 |
247 | ## Using Content (page) Parameters
248 |
249 | In each piece of content you can provide variables to be used by the
250 | templates. This happens in the [front matter](/content/front-matter).
251 |
252 | An example of this is used in this documentation site. Most of the pages
253 | benefit from having the table of contents provided. Sometimes the TOC just
254 | doesn't make a lot of sense. We've defined a variable in our front matter
255 | of some pages to turn off the TOC from being displayed.
256 |
257 | Here is the example front matter:
258 |
259 | ```
260 | ---
261 | title: "Permalinks"
262 | date: "2013-11-18"
263 | aliases:
264 | - "/doc/permalinks/"
265 | groups: ["extras"]
266 | groups_weight: 30
267 | notoc: true
268 | ---
269 | ```
270 |
271 | Here is the corresponding code inside of the template:
272 |
273 | {{ if not .Params.notoc }}
274 |
275 | {{ .TableOfContents }}
276 |
277 | {{ end }}
278 |
279 |
280 |
281 | ## Using Site (config) Parameters
282 | In your top-level configuration file (eg, `config.yaml`) you can define site
283 | parameters, which are values which will be available to you in chrome.
284 |
285 | For instance, you might declare:
286 |
287 | ```yaml
288 | params:
289 | CopyrightHTML: "Copyright © 2013 John Doe. All Rights Reserved."
290 | TwitterUser: "spf13"
291 | SidebarRecentLimit: 5
292 | ```
293 |
294 | Within a footer layout, you might then declare a `