├── images ├── tn.png ├── screenshot.png └── home_post_mode.jpg ├── exampleSite ├── content │ ├── posts │ │ ├── news │ │ │ ├── _index.md │ │ │ ├── 0.43-relnotes │ │ │ │ ├── featured-hugo-43-poster.png │ │ │ │ └── index.md │ │ │ ├── 0.44-relnotes │ │ │ │ ├── featured-hugo-44-poster.png │ │ │ │ └── index.md │ │ │ ├── 0.45-relnotes │ │ │ │ ├── featured-hugo-45-poster.png │ │ │ │ └── index.md │ │ │ ├── 0.46-relnotes │ │ │ │ ├── featured-hugo-46-poster.png │ │ │ │ └── index.md │ │ │ ├── 0.47-relnotes │ │ │ │ ├── featured-hugo-47-poster.png │ │ │ │ └── index.md │ │ │ ├── 0.48-relnotes │ │ │ │ ├── featured-hugo-48-poster.png │ │ │ │ └── index.md │ │ │ ├── 0.45.1-relnotes │ │ │ │ └── index.md │ │ │ ├── 0.47.1-relnotes │ │ │ │ └── index.md │ │ │ └── http2-server-push-in-hugo.md │ │ ├── hugoisforlovers.md │ │ ├── migrate-from-jekyll.md │ │ └── goisforlovers.md │ └── about.md ├── static │ └── images │ │ └── me │ │ ├── avatar.jpeg │ │ └── wechat.png ├── resources │ └── _gen │ │ └── assets │ │ ├── scss │ │ └── css │ │ │ ├── main.scss_b95b077eb505d5c0aff8055eaced30ad.json │ │ │ └── main.scss_b95b077eb505d5c0aff8055eaced30ad.content │ │ └── js │ │ └── js │ │ ├── vendor_main.js_d3f53f09220d597dac26fe7840c31fc9.json │ │ └── vendor_no_gallery.js_d3f53f09220d597dac26fe7840c31fc9.json └── config.toml ├── static └── font │ ├── FiraCode-Regular.eot │ ├── FiraCode-Regular.ttf │ ├── FiraCode-Regular.woff │ └── FiraCode-Regular.woff2 ├── layouts ├── partials │ ├── css.html │ ├── related.html │ ├── home_profile.html │ ├── wechat.html │ ├── footer.html │ ├── gitalk.html │ ├── social.html │ ├── seo_schema.html │ ├── js.html │ ├── paginator.html │ ├── head.html │ ├── home_post.html │ └── header.html ├── index.html ├── page │ └── single.html ├── shortcodes │ └── friend.html ├── _default │ ├── baseof.html │ ├── posts.html │ ├── list.html │ ├── links.html │ ├── terms.html │ └── single.html ├── 404.html ├── sitemap.xml ├── index.atom.xml ├── robots.txt └── rss.xml ├── archetypes └── default.md ├── assets ├── js │ ├── _custom.js │ ├── dynamic.to.top.min.js │ ├── lightGallery-init.js │ ├── main.js │ ├── lazysizes.min.js │ └── prettify.min.js └── css │ ├── _common │ ├── _section │ │ ├── navbar.scss │ │ ├── pagination.scss │ │ └── footer.scss │ ├── _page │ │ ├── tags.scss │ │ ├── home.scss │ │ ├── home_post.scss │ │ ├── terms.scss │ │ └── post.scss │ ├── _prettyprint │ │ └── default.scss │ └── _core │ │ ├── layout.scss │ │ ├── base.scss │ │ ├── normalize.scss │ │ └── media.scss │ ├── _custom.scss │ ├── main.scss │ └── _variables │ └── default.scss ├── theme.toml ├── LICENSE ├── LICENSE.md └── README.md /images/tn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/images/tn.png -------------------------------------------------------------------------------- /images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/images/screenshot.png -------------------------------------------------------------------------------- /images/home_post_mode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/images/home_post_mode.jpg -------------------------------------------------------------------------------- /exampleSite/content/posts/news/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Hugo News" 3 | aliases: [/release-notes/] 4 | --- 5 | -------------------------------------------------------------------------------- /static/font/FiraCode-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/static/font/FiraCode-Regular.eot -------------------------------------------------------------------------------- /static/font/FiraCode-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/static/font/FiraCode-Regular.ttf -------------------------------------------------------------------------------- /static/font/FiraCode-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/static/font/FiraCode-Regular.woff -------------------------------------------------------------------------------- /static/font/FiraCode-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/static/font/FiraCode-Regular.woff2 -------------------------------------------------------------------------------- /exampleSite/static/images/me/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/exampleSite/static/images/me/avatar.jpeg -------------------------------------------------------------------------------- /exampleSite/static/images/me/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/exampleSite/static/images/me/wechat.png -------------------------------------------------------------------------------- /exampleSite/resources/_gen/assets/scss/css/main.scss_b95b077eb505d5c0aff8055eaced30ad.json: -------------------------------------------------------------------------------- 1 | {"Target":"css/main.min.css","MediaType":"text/css","Data":{}} -------------------------------------------------------------------------------- /exampleSite/resources/_gen/assets/js/js/vendor_main.js_d3f53f09220d597dac26fe7840c31fc9.json: -------------------------------------------------------------------------------- 1 | {"Target":"js/vendor_main.min.js","MediaType":"application/javascript","Data":{}} -------------------------------------------------------------------------------- /layouts/partials/css.html: -------------------------------------------------------------------------------- 1 | {{ $style := resources.Get "css/main.scss" | resources.ToCSS | resources.Minify}} 2 | 3 | 4 | -------------------------------------------------------------------------------- /exampleSite/resources/_gen/assets/js/js/vendor_no_gallery.js_d3f53f09220d597dac26fe7840c31fc9.json: -------------------------------------------------------------------------------- 1 | {"Target":"js/vendor_no_gallery.min.js","MediaType":"application/javascript","Data":{}} -------------------------------------------------------------------------------- /archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .Name "-" " " | title }}" 3 | date: {{ .Date }} 4 | draft: true 5 | categories: 6 | - 7 | tags: 8 | - 9 | featured_image: 10 | --- -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.43-relnotes/featured-hugo-43-poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/exampleSite/content/posts/news/0.43-relnotes/featured-hugo-43-poster.png -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.44-relnotes/featured-hugo-44-poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/exampleSite/content/posts/news/0.44-relnotes/featured-hugo-44-poster.png -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.45-relnotes/featured-hugo-45-poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/exampleSite/content/posts/news/0.45-relnotes/featured-hugo-45-poster.png -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.46-relnotes/featured-hugo-46-poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/exampleSite/content/posts/news/0.46-relnotes/featured-hugo-46-poster.png -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.47-relnotes/featured-hugo-47-poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/exampleSite/content/posts/news/0.47-relnotes/featured-hugo-47-poster.png -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.48-relnotes/featured-hugo-48-poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mogeko/LeaveIt/master/exampleSite/content/posts/news/0.48-relnotes/featured-hugo-48-poster.png -------------------------------------------------------------------------------- /layouts/index.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 | {{ if eq .Site.Params.home_mode "post" }} 3 | {{ partial "home_post.html" . }} 4 | {{ else }} 5 | {{ partial "home_profile.html" . }} 6 | {{ end }} 7 | {{ end }} 8 | -------------------------------------------------------------------------------- /layouts/partials/related.html: -------------------------------------------------------------------------------- 1 | {{ $related := .Site.RegularPages.Related . | first 5 }} 2 | {{ with $related }} 3 |

Similar articles:

4 | 9 | {{ end }} -------------------------------------------------------------------------------- /layouts/page/single.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 |
3 |

{{ .Title }}

4 |
5 | {{ .Content }} 6 |
7 |
8 | {{end }} -------------------------------------------------------------------------------- /layouts/shortcodes/friend.html: -------------------------------------------------------------------------------- 1 | {{ if .IsNamedParams }} 2 |

3 |
4 |
5 | 6 |
7 |
8 | {{ .Get "name" }}
{{ .Get "word" }} 9 |
10 |
11 | {{ end }} 12 | -------------------------------------------------------------------------------- /layouts/_default/baseof.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ partial "head.html" . }} 4 | 5 |
6 | {{ partial "header" . }} 7 |
8 |
9 | {{ block "content" . }}{{ end }} 10 |
11 |
12 | {{ partial "footer.html" . }} 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /assets/js/_custom.js: -------------------------------------------------------------------------------- 1 | // ============================== 2 | // Custom JavaScript 3 | // ============================== 4 | 5 | // 顶部阅读进度条 6 | $(document).ready(function() { 7 | $(window).scroll(function() { 8 | $(".top-scroll-bar").attr( 9 | "style", 10 | "width: " + 11 | ($(this).scrollTop() / ($(document).height() - $(this).height())) * 12 | 100 + 13 | "%; display: block;" 14 | ); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /exampleSite/content/about.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "About Hugo" 3 | date = "2014-04-09" 4 | menu = "main" 5 | +++ 6 | 7 | Hugo is the **world’s fastest framework for building websites**. It is written in Go. 8 | 9 | It makes use of a variety of open source projects including: 10 | 11 | * https://github.com/russross/blackfriday 12 | * https://github.com/alecthomas/chroma 13 | * https://github.com/muesli/smartcrop 14 | * https://github.com/spf13/cobra 15 | * https://github.com/spf13/viper 16 | 17 | Learn more and contribute on [GitHub](https://github.com/gohugoio). 18 | 19 | -------------------------------------------------------------------------------- /layouts/_default/posts.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 |
3 | {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} 4 |

{{ .Key }}

5 | 6 | {{ range .Pages }} 7 |
8 | {{ .Title }} 9 | 10 | {{ .Date.Format "January 2, 2006" }} 11 | 12 |
13 | {{ end }} {{ end }} 14 | {{ partial "paginator.html" . }} 15 |
16 | {{end }} -------------------------------------------------------------------------------- /assets/css/_common/_section/navbar.scss: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | .header-logo a{ 5 | padding: 0 ; 6 | 7 | i{ 8 | line-height: 2em; 9 | } 10 | } 11 | 12 | 13 | .navbar .navbar-right a { 14 | 15 | padding: 0 8px; 16 | } 17 | 18 | .navbar .navbar-right .active{ 19 | font-weight: 900; 20 | color: $light-navbar-active-color; 21 | 22 | .dark-theme &{ 23 | color: $dark-navbar-active-color; 24 | } 25 | } 26 | 27 | .navbar-header a:hover, .navbar .navbar-right a:hover { 28 | 29 | background-color: transparent; 30 | } 31 | -------------------------------------------------------------------------------- /layouts/partials/home_profile.html: -------------------------------------------------------------------------------- 1 |
2 | {{ $cdn_url := .Scratch.Get "cdn_url" }} 3 | {{ with .Site.Params.avatar}} 4 | {{ $avatar := .}} 5 |
6 | 7 |
8 | {{ end }} 9 | {{ with .Site.Params.subtitle}} 10 |

11 | {{ . }} 12 |

13 | {{ end }} 14 | 17 |
18 | 19 | {{ if .IsHome }} 20 | {{ partial "wechat.html" . }} 21 | {{ end }} -------------------------------------------------------------------------------- /assets/css/_custom.scss: -------------------------------------------------------------------------------- 1 | // ============================== 2 | // Custom style 3 | // ============================== 4 | // You can override the variables in _variables.scss to customize the style 5 | 6 | // 隐藏文字 7 | .spoiler { 8 | color: black; 9 | background-color:black; 10 | } 11 | .spoiler:hover{ 12 | color: white; 13 | } 14 | 15 | .post-warp .post-content img { 16 | max-width: 100%; 17 | } 18 | 19 | // 顶部阅读进度条 20 | .top-scroll-bar { 21 | position: fixed; 22 | top: 0; 23 | left: 0; 24 | z-index: 9999; 25 | display: none; 26 | width: 0; 27 | height: 3px; 28 | background: #ef3982; 29 | } -------------------------------------------------------------------------------- /assets/css/main.scss: -------------------------------------------------------------------------------- 1 | @import "_variables/default.scss"; 2 | 3 | @import "_common/_core/normalize.scss"; 4 | @import "_common/_core/base.scss"; 5 | @import "_common/_core/layout.scss"; 6 | 7 | 8 | @import "_common/_page/home.scss"; 9 | @import "_common/_page/terms.scss"; 10 | @import "_common/_page/post.scss"; 11 | @import "_common/_page/tags.scss"; 12 | @import "_common/_page/home_post.scss"; 13 | 14 | @import "_common/_section/navbar.scss"; 15 | @import "_common/_section/footer.scss"; 16 | @import "_common/_section/pagination.scss"; 17 | 18 | 19 | @import "_common/_prettyprint/default.scss"; 20 | 21 | 22 | @import "_common/_core/media.scss"; 23 | @import "custom" -------------------------------------------------------------------------------- /layouts/_default/list.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 | {{ $data := .Data }} 3 |
4 |

- {{ $data.Plural | humanize }} · {{ .Title }} -

5 | {{ range (.Paginate .Pages).Pages }} 6 |
7 | {{ .Title }} 8 | 9 | {{ .Date.Format "January 2, 2006" }} 10 | 11 |
12 | {{ end }} 13 | {{ partial "paginator.html" . }} 14 |
15 | {{end }} -------------------------------------------------------------------------------- /layouts/404.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 |
3 |

4 |

/* 404 page not found. */

5 | 6 |
7 | 16 | {{ end }} 17 | -------------------------------------------------------------------------------- /theme.toml: -------------------------------------------------------------------------------- 1 | # theme.toml template for a Hugo theme 2 | # See https://github.com/gohugoio/hugoThemes#themetoml for an example 3 | 4 | name = "LeaveIt" 5 | license = "MIT" 6 | licenselink = "https://github.com/liuzc/LeaveIt/blob/master/LICENSE" 7 | description = "A simple, clean blog theme for hugo." 8 | homepage = "https://liuzhichao.com/" 9 | tags = [ 10 | "blog", 11 | "minimal", 12 | "clean", 13 | "responsive", 14 | "gallery", 15 | "dark", 16 | "theme" 17 | ] 18 | features = [ 19 | "cover-image", 20 | "favicon", 21 | "multilingual", 22 | "pagination", 23 | "social-menu", 24 | "syntax-highlighting", 25 | ] 26 | min_version = "0.41" 27 | 28 | [author] 29 | name = "LiuZhichao" 30 | homepage = "https://liuzhichao.com/" 31 | -------------------------------------------------------------------------------- /assets/css/_common/_page/tags.scss: -------------------------------------------------------------------------------- 1 | .tag-cloud-tags { 2 | margin: 10px 0; 3 | 4 | a { 5 | display: inline-block; 6 | position: relative; 7 | margin: 5px 10px; 8 | word-wrap: break-word; 9 | transition-duration: .3s; 10 | transition-property: transform; 11 | transition-timing-function: ease-out; 12 | 13 | &:active, 14 | &:focus, 15 | &:hover { 16 | color: $light-global-link-hover-color; 17 | transform: scale(1.1); 18 | 19 | .dark-theme &{ 20 | color: $dark-global-link-hover-color; 21 | } 22 | } 23 | 24 | small { 25 | color: $light-font-secondary-color; 26 | 27 | .dark-theme &{ 28 | color: $dark-global-link-hover-color; 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.45.1-relnotes/index.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | date: 2018-07-25 4 | title: "Hugo 0.45.1: Two Bug Fixes" 5 | description: "Hugo 0.45.1 comes with two bug fixes ... and one enhancement." 6 | categories: ["Releases"] 7 | images: 8 | - images/blog/hugo-bug-poster.png 9 | 10 | --- 11 | 12 | This is a bug-fix release with a couple of important fixes (and one enhancement). 13 | 14 | ## Enhancements 15 | 16 | * Add Page.FirstSection [016dd4a6](https://github.com/gohugoio/hugo/commit/016dd4a69a765061bb3da8490d3cac6ec47a91eb) [@bep](https://github.com/bep) 17 | 18 | ## Fixes 19 | 20 | * Fix .Site.GetPage regression [04d4c08d](https://github.com/gohugoio/hugo/commit/04d4c08dbcac08ff7feeb88863e91799fed0937b) [@bep](https://github.com/bep) [#4989](https://github.com/gohugoio/hugo/issues/4989) 21 | * Fix "borrow content from another language" issue [c6b599a0](https://github.com/gohugoio/hugo/commit/c6b599a06d66b8e3c92343d25bb8043eb4f291f1) [@bep](https://github.com/bep) [#4986](https://github.com/gohugoio/hugo/issues/4986) 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /layouts/partials/wechat.html: -------------------------------------------------------------------------------- 1 | {{ $cdn_url := .Scratch.Get "cdn_url" }} 2 | {{ with .Site.Params.Social.Wechat}} 3 | {{ $wechat := .}} 4 | 37 | 38 | 39 | 45 | 46 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/footer.html: -------------------------------------------------------------------------------- 1 | 20 | 21 | 22 | {{ partial "js.html" . }} 23 | -------------------------------------------------------------------------------- /layouts/sitemap.xml: -------------------------------------------------------------------------------- 1 | 3 | {{ range (where .Data.Pages "Section" "!=" "gallery") }} 4 | 5 | {{ .Permalink }} 6 | {{ if not .Lastmod.IsZero }} 7 | {{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }} 8 | {{ end }} 9 | {{ with .Sitemap.ChangeFreq }} 10 | {{ . }} 11 | {{ end }} 12 | {{ if ge .Sitemap.Priority 0.0 }} 13 | {{ .Sitemap.Priority }} 14 | {{ end }} 15 | {{ if .IsTranslated }} 16 | {{ range .Translations }} 17 | 22 | {{ end }} 23 | 28 | {{ end }} 29 | 30 | {{ end }} 31 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 LIUZHICHAO.COM 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 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 LIUZHICHAO.COM 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/partials/gitalk.html: -------------------------------------------------------------------------------- 1 | {{ if .Site.Params.enableGitalk }} 2 |
3 | 4 | 5 | 24 | {{ end }} 25 | -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.47.1-relnotes/index.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | date: 2018-08-20 4 | title: "Two Bug Fixes" 5 | description: "Hugo 0.47.1: Two Bug Fixes" 6 | categories: ["Releases"] 7 | images: 8 | - images/blog/hugo-bug-poster.png 9 | 10 | --- 11 | 12 | This is a bug-fix release with two fixes. 13 | 14 | # Fixes 15 | 16 | * Fix .Site.Params case regression [fdff0d3a](https://github.com/gohugoio/hugo/commit/fdff0d3af4670f7079e539fef4b92af2a866d02d) [@bep](https://github.com/bep) [#5094](https://github.com/gohugoio/hugo/issues/5094) 17 | * Do not strip IE conditional statements [5a0ee2b9](https://github.com/gohugoio/hugo/commit/5a0ee2b934e38d596da0f9742361f81c1221e3d5) [@bep](https://github.com/bep) [#5089](https://github.com/gohugoio/hugo/issues/5089) 18 | 19 | ## Updates to Linux Snap build 20 | 21 | * Remove unused files from Git, Perl, etc. [834617f9](https://github.com/gohugoio/hugo/commit/834617f9f8d870643b2631fe607471c8e2ef2f47) [@anthonyfok](https://github.com/anthonyfok) 22 | * Add nodejs to allow PostCSS to work [ef20ec1f](https://github.com/gohugoio/hugo/commit/ef20ec1fbaa8f5841b3fbe18978d4d8c19d8fc53) [@anthonyfok](https://github.com/anthonyfok) 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /assets/css/_variables/default.scss: -------------------------------------------------------------------------------- 1 | /** light theme **/ 2 | 3 | $light-background-color: #fff; 4 | 5 | $light-font-color: #161209; 6 | $light-font-secondary-color: #a9a9b3; 7 | 8 | $light-code-notclass-background-color: #eaeaea; 9 | 10 | $light-navbar-active-color: #161209; 11 | $light-navbar-background-color: #fafafa; 12 | 13 | $light-global-link-color: #161209; 14 | $light-global-link-hover-color:#2d96bd; 15 | 16 | $light-post-link-color: #2d96bd; 17 | $light-post-link-hover-color:#ef3982; 18 | 19 | $light-pagination-link-color : #2d96bd; 20 | $light-pagination-link-active-color: #000; 21 | 22 | $light-border-color: #dcdcdc; 23 | 24 | 25 | 26 | /** dark theme **/ 27 | 28 | $dark-background-color: #292a2d; 29 | 30 | $dark-font-color: #a9a9b3; 31 | $dark-font-secondary-color: #87878d; 32 | 33 | $dark-code-notclass-background-color: #3b3d42; 34 | 35 | $dark-navbar-active-color: #fff; 36 | $dark-navbar-background-color: #252627; 37 | 38 | $dark-global-link-color: #a9a9b3; 39 | $dark-global-link-hover-color:#fff; 40 | 41 | $dark-post-link-color: #eee; 42 | $dark-post-link-hover-color:#fff; 43 | 44 | $dark-pagination-link-color : #a9a9b3; 45 | $dark-pagination-link-active-color: #fff; 46 | 47 | $dark-border-color: #4a4b50; 48 | 49 | $dark-blockquote-background-color: #252529; -------------------------------------------------------------------------------- /layouts/index.atom.xml: -------------------------------------------------------------------------------- 1 | 2 | {{ if .IsHome }} 3 | {{ .Title }} 4 | {{ else }} 5 | {{ .Title }} - {{ .Site.Title }} 6 | {{ end }} 7 | 8 | {{ if not .Date.IsZero }} 9 | {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}{{ end }} 10 | {{ .Permalink }}{{ with .Site.Author.name }} 11 | 12 | {{.}}{{ with $.Site.Author.email }} 13 | {{.}}{{end}} 14 | {{end}} 15 | Hugo -- gohugo.io{{ range first 15 (where .Data.Pages "Type" "in" .Site.Params.mainSections) }} 16 | 17 | {{ `<![CDATA[` | safeHTML }}{{ .Title }}]]> 18 | 19 | {{ .Permalink }}{{ with .Site.Params.Author }} 20 | 21 | {{.}} 22 | {{end}} 23 | {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }} 24 | {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }} 25 | {{ ` 26 | {{ end }} 27 | -------------------------------------------------------------------------------- /layouts/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | 3 | Disallow: /images/ 4 | Disallow: /js/ 5 | Disallow: /css/ 6 | 7 | User-agent: MJ12bot 8 | Disallow: / 9 | 10 | User-agent: AhrefsBot 11 | Disallow: / 12 | 13 | User-agent: BLEXBot 14 | Disallow: / 15 | 16 | # Block SISTRIX 17 | User-agent: SISTRIX Crawler 18 | Disallow: / 19 | User-agent: sistrix 20 | Disallow: / 21 | User-agent: 007ac9 22 | Disallow: / 23 | User-agent: 007ac9 Crawler 24 | Disallow: / 25 | 26 | # Block Uptime robot 27 | User-agent: UptimeRobot/2.0 28 | Disallow: / 29 | 30 | # Block Ezooms Robot 31 | User-agent: Ezooms Robot 32 | Disallow: / 33 | 34 | # Block Perl LWP 35 | User-agent: Perl LWP 36 | Disallow: / 37 | 38 | # Block netEstate NE Crawler (+http://www.website-datenbank.de/) 39 | User-agent: netEstate NE Crawler (+http://www.website-datenbank.de/) 40 | Disallow: / 41 | 42 | # Block WiseGuys Robot 43 | User-agent: WiseGuys Robot 44 | Disallow: / 45 | 46 | # Block Turnitin Robot 47 | User-agent: Turnitin Robot 48 | Disallow: / 49 | 50 | # Block Heritrix 51 | User-agent: Heritrix 52 | Disallow: / 53 | 54 | # Block pricepi 55 | User-agent: pimonster 56 | Disallow: / 57 | User-agent: Pimonster 58 | Disallow: / 59 | 60 | User-agent: SurdotlyBot 61 | Disallow: / 62 | 63 | User-agent: ZoominfoBot 64 | Disallow: / 65 | 66 | Sitemap: {{ "sitemap.xml" | absLangURL }} -------------------------------------------------------------------------------- /assets/js/dynamic.to.top.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Dynamic To Top Plugin 3 | * http://www.mattvarone.com 4 | * 5 | * By Matt Varone 6 | * @sksmatt 7 | * 8 | */ 9 | var mv_dynamic_to_top = {"text":"0","version":"0","min":"200","speed":"1000","easing":"easeInOutExpo","margin":"20"}; 10 | (function($,mv_dynamic_to_top){jQuery.fn.DynamicToTop=function(options){var defaults={text:mv_dynamic_to_top.text,min:parseInt(mv_dynamic_to_top.min,10),fade_in:600,fade_out:400,speed:parseInt(mv_dynamic_to_top.speed,10),easing:mv_dynamic_to_top.easing,version:mv_dynamic_to_top.version,id:'dynamic-to-top'},settings=$.extend(defaults,options);if(settings.version===""||settings.version==='0'){settings.text=' ';} 11 | if(!$.isFunction(settings.easing)){settings.easing='linear';} 12 | var $toTop=$('').html(settings.text);$toTop.hide().appendTo('body').click(function(){$('html, body').stop().animate({scrollTop:0},settings.speed,settings.easing);return false;});$(window).scroll(function(){var sd=jQuery(window).scrollTop();if(typeof document.body.style.maxHeight==="undefined"){$toTop.css({'position':'absolute','top':sd+$(window).height()-mv_dynamic_to_top.margin});} 13 | if(sd>settings.min){$toTop.fadeIn(settings.fade_in);}else{$toTop.fadeOut(settings.fade_out);}});};$('body').DynamicToTop();})(jQuery,mv_dynamic_to_top); -------------------------------------------------------------------------------- /assets/css/_common/_prettyprint/default.scss: -------------------------------------------------------------------------------- 1 | /*! Color themes for Google Code Prettify | MIT License | github.com/jmblog/color-themes-for-google-code-prettify */ 2 | 3 | .prettyprint { 4 | background: #2d2d2d; 5 | font-family: Menlo,Bitstream Vera Sans Mono,DejaVu Sans Mono,Monaco,Consolas,monospace; 6 | border: 0 !important; 7 | } 8 | 9 | .pln { 10 | color: #ccc; 11 | } 12 | 13 | ol.linenums { 14 | margin-top: 0; 15 | margin-bottom: 0; 16 | color: #999; 17 | } 18 | 19 | li { 20 | &.L0, &.L1, &.L2, &.L3, &.L4, &.L5, &.L6, &.L7, &.L8, &.L9 { 21 | padding-left: 1em; 22 | background-color: #2d2d2d; 23 | list-style-type: decimal; 24 | } 25 | } 26 | 27 | @media screen { 28 | .str { 29 | color: #9c9; 30 | } 31 | .kwd { 32 | color: #c9c; 33 | } 34 | .com { 35 | color: #999; 36 | } 37 | .typ { 38 | color: #69c; 39 | } 40 | .lit { 41 | color: #f99157; 42 | } 43 | .pun, .opn, .clo { 44 | color: #ccc; 45 | } 46 | .tag { 47 | color: #f2777a; 48 | } 49 | .atn { 50 | color: #f99157; 51 | } 52 | .atv { 53 | color: #6cc; 54 | } 55 | .dec { 56 | color: #f99157; 57 | } 58 | .var { 59 | color: #f2777a; 60 | } 61 | .fun { 62 | color: #69c; 63 | } 64 | } -------------------------------------------------------------------------------- /assets/css/_common/_page/home.scss: -------------------------------------------------------------------------------- 1 | 2 | /** Home **/ 3 | 4 | .intro { 5 | transform: translateY(25vh); 6 | text-align: center; 7 | .avatar { 8 | padding: 10px; 9 | img { 10 | width: 128px; 11 | height: auto; 12 | display: inline-block; 13 | -webkit-border-radius: 100%; 14 | border-radius: 100%; 15 | -webkit-box-shadow: 0 0 0 0.3618em rgba(0, 0, 0, 0.05); 16 | box-shadow: 0 0 0 0.3618em rgba(0, 0, 0, 0.05); 17 | margin: 0 auto; 18 | -webkit-transition: all ease 0.4s; 19 | -moz-transition: all ease 0.4s; 20 | -o-transition: all ease 0.4s; 21 | transition: all ease 0.4s; 22 | cursor: pointer; 23 | &:hover { 24 | position: relative; 25 | -webkit-transform: translateY(-0.75em); 26 | -moz-transform: translateY(-0.75em); 27 | -ms-transform: translateY(-0.75em); 28 | -o-transform: translateY(-0.75em); 29 | transform: translateY(-0.75em); 30 | cursor: pointer; 31 | } 32 | } 33 | } 34 | } 35 | 36 | h2.description { 37 | font-size: 1em; 38 | font-weight: normal; 39 | padding: 5px; 40 | } 41 | 42 | .social-links { 43 | a { 44 | 45 | padding: 0 5px; 46 | &:hover { 47 | 48 | background-color: transparent; 49 | } 50 | } 51 | .iconfont { 52 | font-size: 2em; 53 | } 54 | } -------------------------------------------------------------------------------- /layouts/rss.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }} 4 | {{ .Permalink }} 5 | Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }} 6 | Hugo -- gohugo.io{{ with .Site.LanguageCode }} 7 | {{.}}{{end}}{{ with .Site.Author.email }} 8 | {{.}}{{ with site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} 9 | {{.}}{{ with site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} 10 | {{.}}{{end}}{{ if not .Date.IsZero }} 11 | {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} 12 | 13 | {{ range first 15 (where .Data.Pages "Type" "!=" "home") }} 14 | 15 | {{ .Title }} 16 | {{ .Permalink }} 17 | {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} 18 | {{ with .Site.Author.email }}{{.}}{{ with site.Author.name }} ({{.}}){{end}}{{end}} 19 | {{ .Permalink }} 20 | {{ .Content | html }} 21 | 22 | {{ end }} 23 | 24 | -------------------------------------------------------------------------------- /layouts/_default/links.html: -------------------------------------------------------------------------------- 1 | 74 |
75 | {{ .Content }} 76 |
77 | -------------------------------------------------------------------------------- /layouts/partials/social.html: -------------------------------------------------------------------------------- 1 | {{ with .Site.Params.Social.Github }} 2 | 3 | {{ end }} 4 | {{ with .Site.Params.Social.LinkedIn }} 5 | 6 | {{ end }} 7 | {{ with .Site.Params.Social.Twitter }} 8 | 9 | {{ end }} 10 | {{ with .Site.Params.Social.Instagram }} 11 | 12 | {{ end }} 13 | {{ with .Site.Params.Social.Wechat}} 14 | 15 | {{end}} 16 | {{ with .Site.Params.Social.Email}} 17 | 18 | {{ end }} 19 | {{ with .Site.Params.Social.Facebook}} 20 | 21 | {{ end }} 22 | {{ with .Site.Params.Social.Telegram}} 23 | 24 | {{ end }} 25 | {{ with .Site.Params.Social.Dribbble}} 26 | 27 | {{ end }} 28 | {{ with .Site.Params.Social.Medium}} 29 | 30 | {{ end }} 31 | -------------------------------------------------------------------------------- /exampleSite/config.toml: -------------------------------------------------------------------------------- 1 | baseURL = "https://example.com" 2 | languageCode = "en-us" 3 | title = "LeaveIt" 4 | theme = "LeaveIt" 5 | 6 | paginate = 12 7 | enableEmoji = true 8 | enableRobotsTXT = true 9 | googleAnalytics = "" 10 | 11 | preserveTaxonomyNames = true 12 | 13 | [blackfriday] 14 | hrefTargetBlank = true 15 | nofollowLinks = true 16 | noreferrerLinks = true 17 | 18 | [Permalinks] 19 | posts = "/:year/:filename/" 20 | 21 | [menu] 22 | [[menu.main]] 23 | name = "Blog" 24 | url = "/posts/" 25 | weight = 1 26 | 27 | [[menu.main]] 28 | name = "Categories" 29 | url = "/categories/" 30 | weight = 2 31 | 32 | [[menu.main]] 33 | name = "Tags" 34 | url = "/tags/" 35 | weight = 3 36 | 37 | [[menu.main]] 38 | name = "About" 39 | url = "/about/" 40 | weight = 4 41 | 42 | [params] 43 | since = 2011 44 | author = "Covey.Liu" # Author's name 45 | avatar = "/images/me/avatar.jpeg" # Author's avatar 46 | subtitle = "我会更好,因为我没有停止" # Subtitle 47 | cdn_url = "" # Base CDN URL 48 | home_mode = "" # post or other 49 | 50 | google_verification = "" 51 | 52 | description = "" # site description 53 | keywords = "" # site keywords 54 | 55 | beian = "" 56 | baiduAnalytics = "" 57 | 58 | license= '本文采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可' 59 | 60 | [params.social] 61 | GitHub = "xxoo" 62 | Twitter = "xxoo" 63 | Email = "xxoo" 64 | Instagram = "xxoo" 65 | Wechat = "/images/me/wechat.png" # Wechat QRcode image 66 | Facebook = "xxoo" 67 | Telegram = "xxoo" 68 | Dribbble = "xxoo" 69 | Medium = "xxoo" 70 | 71 | -------------------------------------------------------------------------------- /assets/js/lightGallery-init.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | let items = []; 3 | $('.post-content figure').each(function() { 4 | if ($(this).attr('class') == 'gallery-ignore') return true; // ignore any figures where class="pswp-ignore" 5 | // get properties from child a/img/figcaption elements, 6 | let $figure = $(this), 7 | $img = $figure.find('img'), 8 | $src = $img.attr('data-src'), 9 | $title = $figure.find('figcaption').html(); 10 | 11 | if ($img.data('size')) { 12 | let $size = $a.data('size').split('x'); 13 | var item = { 14 | 'src': $src, 15 | 'thumb': $src, 16 | 'subHtml': $title, 17 | 'width': $size[0], 18 | 'height': $size[1] 19 | } 20 | }else{ 21 | var item = { 22 | 'src': $src, 23 | 'thumb': $src, 24 | 'subHtml': $title 25 | } 26 | var img = new Image(); 27 | img.src = $src; 28 | var wait = setInterval(function() { 29 | var w = img.naturalWidth, 30 | h = img.naturalHeight; 31 | if (w && h) { 32 | clearInterval(wait); 33 | item.width = w; 34 | item.height = h; 35 | } 36 | }, 30); 37 | } 38 | 39 | var index = items.length; 40 | items.push(item); 41 | // console.log(item) 42 | 43 | $figure.on('click', function(event) { 44 | event.preventDefault(); 45 | $(this).lightGallery({ 46 | dynamic: true, 47 | download: false, 48 | showThumbByDefault: false, 49 | dynamicEl: items, 50 | index: index 51 | }) 52 | }); 53 | }); 54 | }); -------------------------------------------------------------------------------- /assets/css/_common/_core/layout.scss: -------------------------------------------------------------------------------- 1 | /** Layout **/ 2 | 3 | .wrapper { 4 | display: flex; 5 | flex-direction: column; 6 | min-height: 100vh; 7 | width: 100%; 8 | } 9 | 10 | .navbar { 11 | height: 4rem; 12 | line-height: 4rem; 13 | width: 100%; 14 | background-color: $light-navbar-background-color; 15 | .dark-theme & { 16 | background-color: $dark-navbar-background-color; 17 | } 18 | .container { 19 | width: auto; 20 | max-width: 1000px; 21 | text-align: center; 22 | margin: 0 auto; 23 | display: flex; 24 | justify-content: space-between; 25 | font-size: 1.125em; 26 | 27 | .theme-switch { 28 | // display: none; 29 | border-left: 2px solid; 30 | } 31 | 32 | .header-logo { 33 | font-weight: bold; 34 | font-family: monospace, monospace; 35 | } 36 | 37 | .logo_cursor { 38 | display: inline-block; 39 | width: 10px; 40 | height: 1rem; 41 | background: #fe5186; 42 | margin-left: 5px; 43 | border-radius: 1px; 44 | animation: cursor 1s infinite; 45 | } 46 | @media (prefers-reduced-motion: reduce) { 47 | .logo_cursor { 48 | animation: none; 49 | } 50 | } 51 | } 52 | } 53 | 54 | .main { 55 | flex: 1 0 auto; 56 | } 57 | .container{ 58 | padding-left: 1em; 59 | padding-right: 1em; 60 | } 61 | 62 | .footer { 63 | height: 4rem; 64 | width: 100%; 65 | text-align: center; 66 | line-height: 4rem; 67 | padding-top: 2em; 68 | } 69 | 70 | 71 | .notfound { 72 | font-size: 2em; 73 | transform: translateY(35vh); 74 | text-align: center; 75 | } 76 | 77 | @keyframes cursor { 78 | 0% { opacity: 0; } 79 | 50% { opacity: 1; } 80 | 100% { opacity: 0; } 81 | } -------------------------------------------------------------------------------- /layouts/_default/terms.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 | 3 | {{ $termName := .Data.Plural }} 4 | {{ $terms := .Data.Terms.ByCount }} 5 | {{ $length := len $terms }} 6 | {{ $type := .Type }} 7 | 8 |
9 |

- {{ .Data.Plural | humanize }} -

10 | {{ if and $.Site.Taxonomies.categories (eq $termName "categories") }} 11 | 12 |
13 | {{ range $terms }} 14 | {{ $term := .Term }} 15 | {{ $pages := .Pages }} 16 | {{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) }} 17 |
18 |
19 |

{{ $term | humanize}}

20 | {{ range first 5 $pages }} 21 | 24 | {{ end }} 25 | {{ if gt (len $pages) 5 }} 26 | 27 | More >> 28 | 29 | {{ end }} 30 |
31 |
32 | {{ end }} 33 | {{ end }} 34 |
35 | 36 | {{ else if and $.Site.Taxonomies.tags (eq $termName "tags") }} 37 |
38 | {{ range $.Site.Taxonomies.tags.ByCount }} 39 | {{ if .Name }} 40 | {{ .Name }} ({{ .Count }}) 41 | {{ end }} 42 | {{end}} 43 |
44 | 45 | {{ end }} 46 |
47 | {{end }} -------------------------------------------------------------------------------- /assets/css/_common/_page/home_post.scss: -------------------------------------------------------------------------------- 1 | .post-warp { 2 | .intro { 3 | transform: translateY(0); 4 | margin: 2em 0 5em 0; 5 | 6 | .avatar { 7 | img { 8 | width: 96px; 9 | } 10 | } 11 | } 12 | 13 | .post { 14 | margin-bottom: 4em; 15 | border-bottom: 1px dashed #ddd; 16 | 17 | .post-content { 18 | padding-top: .5em; 19 | } 20 | 21 | .post-footer { 22 | display: flex; 23 | justify-content: space-between; 24 | align-items: center; 25 | 26 | .post-meta { 27 | a { 28 | color: rgba(85, 85, 85, 0.52941) !important; 29 | .dark-theme & { 30 | color: $dark-font-secondary-color !important; 31 | } 32 | 33 | &:hover { 34 | color: $light-font-secondary-color !important; 35 | .dark-theme & { 36 | color: $dark-font-secondary-color !important; 37 | } 38 | } 39 | } 40 | } 41 | .post-tags { 42 | span { 43 | a { 44 | color: rgba(85, 85, 85, 0.52941) !important; 45 | .dark-theme & { 46 | color: $dark-font-secondary-color !important; 47 | } 48 | 49 | &:hover { 50 | color: $light-font-secondary-color !important; 51 | .dark-theme & { 52 | color: $dark-font-secondary-color !important; 53 | } 54 | } 55 | } 56 | } 57 | } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /assets/js/main.js: -------------------------------------------------------------------------------- 1 | jQuery(function($) { 2 | 3 | 'use strict'; 4 | 5 | var _Blog = window._Blog || {}; 6 | 7 | _Blog.prettify = function() { 8 | $('pre').addClass('prettyprint linenums').attr('style', 'overflow:auto;'); 9 | window.prettyPrint && prettyPrint(); 10 | }; 11 | 12 | _Blog.externalUrl = function() { 13 | $.expr[':'].external = function(obj) { 14 | return !obj.href.match(/^mailto\:/) && 15 | (obj.hostname != location.hostname); 16 | }; 17 | $('a:external').addClass('external'); 18 | $(".external").attr('target', '_blank'); 19 | 20 | } 21 | 22 | _Blog.changeTitle = function() { 23 | var currentTitle = document.title; 24 | window.onblur = function() { 25 | document.title = 'I miss you!(>﹏<)'; 26 | } 27 | window.onfocus = function() { 28 | document.title = currentTitle; 29 | } 30 | }; 31 | 32 | _Blog.toggleTheme = function() { 33 | const currentTheme = window.localStorage && window.localStorage.getItem('theme') 34 | const isDark = currentTheme === 'dark' 35 | $('body').toggleClass('dark-theme', isDark) 36 | $('.theme-switch').on('click', () => { 37 | $('body').toggleClass('dark-theme') 38 | window.localStorage && 39 | window.localStorage.setItem('theme', document.body.classList.contains('dark-theme') ? 'dark' : 'light', ) 40 | }) 41 | } 42 | 43 | _Blog.toggleMobileMenu = function() { 44 | $('.menu-toggle').on('click', () => { 45 | $('.menu-toggle').toggleClass('active') 46 | $('#mobile-menu').toggleClass('active') 47 | }) 48 | } 49 | 50 | $(document).ready(function() { 51 | _Blog.prettify() 52 | _Blog.changeTitle() 53 | _Blog.toggleTheme() 54 | _Blog.toggleMobileMenu() 55 | }); 56 | }); -------------------------------------------------------------------------------- /layouts/partials/seo_schema.html: -------------------------------------------------------------------------------- 1 | 2 | {{ if .IsHome }} 3 | 16 | {{ end }} 17 | {{ if .IsPage }} 18 | 43 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/js.html: -------------------------------------------------------------------------------- 1 | {{ $cdn_url := .Scratch.Get "cdn_url" }} 2 | {{ $postHasImages := .Scratch.Get "postHasImages"}} 3 | {{ $jquery := resources.Get "/js/jquery.min.js" }} 4 | {{ $lazysizes := resources.Get "/js/lazysizes.min.js"}} 5 | {{ $prettify := resources.Get "/js/prettify.min.js" }} 6 | {{ $dynamic := resources.Get "/js/dynamic.to.top.min.js" }} 7 | {{ $main := resources.Get "/js/main.js" }} 8 | {{ $custom := resources.Get "/js/_custom.js" }} 9 | {{ if .IsPage }} 10 | 11 | {{ if $postHasImages }} 12 | {{ if .Site.Params.lightGallery }} 13 | {{ $lihtGallery := resources.Get "/js/lightGallery-all.min.js" }} 14 | {{ $lihtGallery_init := resources.Get "/js/lightGallery-init.js" }} 15 | 16 | {{ $vendorscript := slice $jquery $lazysizes $prettify $dynamic $main $lihtGallery $custom $lihtGallery_init | resources.Concat "/js/vendor_gallery.js" | resources.Minify }} 17 | 18 | {{ end }} 19 | {{ else }} 20 | {{ $vendorscript := slice $jquery $prettify $dynamic $custom $main | resources.Concat "/js/vendor_no_gallery.js" | resources.Minify }} 21 | 22 | {{ end }} 23 | 24 | {{ else }} 25 | {{ $main := slice $jquery $main | resources.Concat "/js/vendor_main.js" | resources.Minify}} 26 | 27 | {{ end }} 28 | 29 | {{ if eq ( getenv "HUGO_ENV" ) "production" }} 30 | {{ template "_internal/google_analytics_async.html" . }} 31 | {{ with .Site.Params.baiduAnalytics}} 32 | 41 | {{ end }} 42 | {{ end }} 43 | -------------------------------------------------------------------------------- /assets/css/_common/_page/terms.scss: -------------------------------------------------------------------------------- 1 | .post-warp { 2 | 3 | .archive-item { 4 | margin-left: 2rem; 5 | } 6 | 7 | .categories-card { 8 | margin: 0 auto; 9 | margin-top: 3em; 10 | display: flex; 11 | align-items: center; 12 | justify-content: space-between; 13 | flex-direction: row; 14 | flex-wrap: wrap; 15 | padding: 0 2.5em; 16 | line-height: 1.6em; 17 | 18 | .card-item { 19 | font-size: 14px; 20 | text-align: left; 21 | width: 45%; 22 | display: flex; 23 | align-items: flex-start; 24 | margin-top:2em; 25 | min-height: 16em; 26 | padding: 0 2%; 27 | position: relative; 28 | 29 | .categories{ 30 | overflow: hidden; 31 | } 32 | } 33 | } 34 | 35 | .archive-item-link { 36 | display: inline-block; 37 | text-decoration: none; 38 | overflow: hidden; 39 | text-overflow: ellipsis; 40 | white-space: nowrap; 41 | max-width: 95%; 42 | &:hover { 43 | color: $light-global-link-hover-color; 44 | background-color: transparent; 45 | } 46 | 47 | .dark-theme & { 48 | color: $dark-global-link-color; 49 | text-decoration: none; 50 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 51 | 52 | &:hover { 53 | color: $dark-global-link-hover-color; 54 | text-decoration: none; 55 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 56 | } 57 | } 58 | } 59 | .archive-item-date { 60 | float: right; 61 | text-align: right; 62 | color: $light-font-secondary-color; 63 | 64 | .dark-theme & { 65 | color: $dark-font-secondary-color; 66 | } 67 | } 68 | 69 | .more-post { 70 | text-align: right; 71 | } 72 | } 73 | 74 | .categories { 75 | h3 { 76 | display: inline-block; 77 | } 78 | span { 79 | float: right; 80 | padding-right: 1em; 81 | } 82 | } -------------------------------------------------------------------------------- /assets/css/_common/_section/pagination.scss: -------------------------------------------------------------------------------- 1 | /** pagination **/ 2 | 3 | .pagination { 4 | display: flex; 5 | flex-direction: row; 6 | justify-content: center; 7 | list-style: none; 8 | white-space: nowrap; 9 | width: 100%; 10 | padding-top: 2em; 11 | a { 12 | -webkit-font-smoothing: antialiased; 13 | font-size: 12px; 14 | color: #bfbfbf; 15 | letter-spacing: 0.1em; 16 | font-weight: 700; 17 | padding: 5px 5px; 18 | text-decoration: none; 19 | transition: 0.3s; 20 | } 21 | li { 22 | padding-bottom: 3px; 23 | margin: 0 20px; 24 | box-sizing: border-box; 25 | position: relative; 26 | display: inline; 27 | &.disabled { 28 | display: none; 29 | } 30 | &:hover a { 31 | color: $light-pagination-link-active-color; 32 | } 33 | 34 | .dark-theme &:hover a { 35 | color: $dark-pagination-link-active-color; 36 | } 37 | 38 | &:before, 39 | &:after { 40 | position: absolute; 41 | content: ""; 42 | width: 0; 43 | height: 3px; 44 | background: $light-pagination-link-active-color; 45 | transition: 0.3s; 46 | bottom: 0px; 47 | } 48 | .dark-theme &:before, 49 | .dark-theme &:after{ 50 | background: $dark-pagination-link-active-color; 51 | } 52 | 53 | &:before .active, 54 | &:after .active { 55 | width: 100%; 56 | } 57 | &:before { 58 | left: 50%; 59 | } 60 | &:after { 61 | right: 50%; 62 | } 63 | &:hover { 64 | &:before, 65 | &:after { 66 | width: 50%; 67 | } 68 | } 69 | &.active { 70 | a { 71 | color: $light-pagination-link-active-color; 72 | } 73 | 74 | .dark-theme & a { 75 | color: $dark-pagination-link-active-color; 76 | } 77 | &:before, 78 | &:after { 79 | width: 60%; 80 | } 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /layouts/partials/paginator.html: -------------------------------------------------------------------------------- 1 | {{ $pag := $.Paginator }} 2 | {{ if gt $pag.TotalPages 1 }} 3 | 50 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ with .Site.Params.author }}{{ end }} 7 | {{ with .Site.Params.description }}{{ end }} 8 | {{ with .Site.Params.keywords }}{{ end }} 9 | {{ with .Site.Params.google_verification }}{{ end }} 10 | {{ if .PrevInSection }}{{end}} 11 | {{ if .NextInSection}}{{end}} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | {{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} 22 | {{ if .IsHome }} 23 | {{ .Site.Title }} 24 | {{ else if .Params.heading }} 25 | {{ .Params.heading }} 26 | {{ else }} 27 | {{ .Title }} | {{ .Site.Title }} 28 | {{ end }} 29 | 30 | 31 | {{ partial "css" . }} 32 | {{ with .OutputFormats.Get "RSS" }} 33 | 34 | 35 | {{ end }} 36 | {{ partial "seo_schema" . }} 37 | 38 | {{ $cdn_url := ""}} 39 | {{ if eq ( getenv "HUGO_ENV" ) "production" }} 40 | {{ with .Site.Params.cdn_url }} 41 | {{ $cdn_url = .}} 42 | {{ end }} 43 | {{ end }} 44 | {{ .Scratch.Set "cdn_url" $cdn_url }} 45 | -------------------------------------------------------------------------------- /layouts/partials/home_post.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | {{ $cdn_url := .Scratch.Get "cdn_url" }} 5 | {{ with .Site.Params.avatar}} 6 | {{ $avatar := .}} 7 |
8 | 9 |
10 | {{ end }} 11 | {{ with .Site.Params.subtitle}} 12 |

13 | {{ . }} 14 |

15 | {{ end }} 16 | 17 |
18 | {{ range (.Paginate .Pages).Pages }} 19 |
20 | 21 |
22 |

{{ .Title }}

23 |
24 |
25 | 26 | {{ with .Params.featured_image }} 27 | {{- $img := . -}} 28 |

29 | {{ end }} 30 | 31 | 32 | {{ .Summary }} 33 |
34 | 62 |
63 | {{ end }} 64 | 65 | {{ partial "paginator.html" . }} 66 |
67 | -------------------------------------------------------------------------------- /layouts/partials/header.html: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /exampleSite/content/posts/hugoisforlovers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Getting Started with Hugo 3 | cover: "/img/cover.jpg" 4 | tags: ["go", "golang", "hugo", "development"] 5 | categories: ["Uncategorized"] 6 | date: "2014-04-02" 7 | --- 8 | 9 | ## Step 1. Install Hugo 10 | 11 | Goto [hugo releases](https://github.com/spf13/hugo/releases) and download the 12 | appropriate version for your os and architecture. 13 | 14 | Save it somewhere specific as we will be using it in the next step. 15 | 16 | More complete instructions are available at [installing hugo](/overview/installing/) 17 | 18 | ## Step 2. Build the Docs 19 | 20 | Hugo has its own example site which happens to also be the documentation site 21 | you are reading right now. 22 | 23 | Follow the following steps: 24 | 25 | 1. Clone the [hugo repository](http://github.com/spf13/hugo) 26 | 2. Go into the repo 27 | 3. Run hugo in server mode and build the docs 28 | 4. Open your browser to http://localhost:1313 29 | 30 | Corresponding pseudo commands: 31 | 32 | git clone https://github.com/spf13/hugo 33 | cd hugo 34 | /path/to/where/you/installed/hugo server --source=./docs 35 | > 29 pages created 36 | > 0 tags index created 37 | > in 27 ms 38 | > Web Server is available at http://localhost:1313 39 | > Press ctrl+c to stop 40 | 41 | Once you've gotten here, follow along the rest of this page on your local build. 42 | 43 | ## Step 3. Change the docs site 44 | 45 | Stop the Hugo process by hitting ctrl+c. 46 | 47 | Now we are going to run hugo again, but this time with hugo in watch mode. 48 | 49 | /path/to/hugo/from/step/1/hugo server --source=./docs --watch 50 | > 29 pages created 51 | > 0 tags index created 52 | > in 27 ms 53 | > Web Server is available at http://localhost:1313 54 | > Watching for changes in /Users/spf13/Code/hugo/docs/content 55 | > Press ctrl+c to stop 56 | 57 | 58 | Open your [favorite editor](http://vim.spf13.com) and change one of the source 59 | content pages. How about changing this very file to *fix the typo*. How about changing this very file to *fix the typo*. 60 | 61 | Content files are found in `docs/content/`. Unless otherwise specified, files 62 | are located at the same relative location as the url, in our case 63 | `docs/content/overview/quickstart.md`. 64 | 65 | Change and save this file.. Notice what happened in your terminal. 66 | 67 | > Change detected, rebuilding site 68 | 69 | > 29 pages created 70 | > 0 tags index created 71 | > in 26 ms 72 | 73 | Refresh the browser and observe that the typo is now fixed. 74 | 75 | Notice how quick that was. Try to refresh the site before it's finished building.. I double dare you. 76 | Having nearly instant feedback enables you to have your creativity flow without waiting for long builds. 77 | 78 | ## Step 4. Have fun 79 | 80 | The best way to learn something is to play with it. 81 | -------------------------------------------------------------------------------- /exampleSite/content/posts/news/http2-server-push-in-hugo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "HTTP/2 Server Push in Hugo" 3 | date: 2017-07-24T18:36:00+02:00 4 | description: > 5 | As every page in Hugo can be output to multiple formats, it is easy to create Netlify's _redirects and _headers files on the fly. 6 | categories: [blog] 7 | keywords: [] 8 | slug: "http2-server-push-in-hugo" 9 | aliases: [] 10 | author: bep 11 | images: 12 | - images/gohugoio-card-1.png 13 | --- 14 | 15 | **Netlify** recently announced support for [HTTP/2 server push](https://www.netlify.com/blog/2017/07/18/http/2-server-push-on-netlify/), and we have now added it to the **gohugo.io** sites for the main `CSS` and `JS` bundles, along with server-side 301 redirect support. 16 | 17 | If you navigate to https://gohugo.io and look in the Chrome developer network console, you should now see `Push` as the new source ("Initiator") for the `CSS` and `JSS`: 18 | 19 | 20 | 21 | **Setting up this in Hugo was easy:** 22 | 23 | ## 1. Configure Netlify Output Formats 24 | 25 | Add a new custom media type and two new output formats to `config.toml`. For more on output formats in Hugo, see [Custom Output Formats](/templates/output-formats/). 26 | ```bash 27 | [outputs] 28 | home = [ "HTML", "RSS", "REDIR", "HEADERS" ] 29 | 30 | [mediaTypes] 31 | [mediaTypes."text/netlify"] 32 | suffix = "" 33 | delimiter = "" 34 | 35 | [outputFormats] 36 | [outputFormats.REDIR] 37 | mediatype = "text/netlify" 38 | baseName = "_redirects" 39 | isPlainText = true 40 | notAlternative = true 41 | [outputFormats.HEADERS] 42 | mediatype = "text/netlify" 43 | baseName = "_headers" 44 | isPlainText = true 45 | notAlternative = true 46 | ``` 47 | ## 2. Add Template For the _headers File 48 | 49 | Add `layouts/index.headers`: 50 | 51 | ```bash 52 | /* 53 | X-Frame-Options: DENY 54 | X-XSS-Protection: 1; mode=block 55 | X-Content-Type-Options: nosniff 56 | Referrer-Policy: origin-when-cross-origin 57 | */ 58 | Link: <{{ "dist/app.bundle.js" | relURL }}>; rel=preload; as=script 59 | Link: <{{ "dist/main.css" | relURL }}>; rel=preload; as=style 60 | ``` 61 | The template above creates both a security header definition and a HTTP/2 server push configuration. 62 | 63 | Also note that this is a template for the home page, so the full `Page` with its `Site` and many variables are available. You can also use `partial` to include other templates. 64 | 65 | 66 | 67 | 68 | ## 3. Add Template For the _redirects File 69 | Add `layouts/index.redir`: 70 | ```bash 71 | # Netlify redirects. See https://www.netlify.com/docs/redirects/ 72 | {{ range $p := .Site.Pages -}} 73 | {{ range .Aliases }} 74 | {{ . | printf "%-35s" }} {{ $p.RelPermalink -}} 75 | {{ end -}} 76 | {{- end -}} 77 | ``` 78 | The template above creates 301 redirects for your [aliases](/content-management/urls/#aliases), so you will probably want to turn off aliases in your `config.toml`: `disableAliases = true`. 79 | 80 | -------------------------------------------------------------------------------- /assets/css/_common/_core/base.scss: -------------------------------------------------------------------------------- 1 | /** Font **/ 2 | 3 | /* iconfont */ 4 | @import url('https://at.alicdn.com/t/font_1230224_omviwgy4rx.css'); 5 | 6 | /* josefin-sans-regular && pt-sans-regular */ 7 | @import url('https://fonts.proxy.ustclug.org/css?family=Josefin+Sans|PT+Sans&display=swap'); 8 | 9 | /* Fira Code */ 10 | @font-face{ 11 | font-family: 'Fira Code'; 12 | src: url('/font/FiraCode-Regular.woff2'); 13 | src: url('/font/FiraCode-Regular.woff2') format('woff2'), 14 | url('/font/FiraCode-Regular.eot') format('embedded-opentype'), 15 | url('/font/FiraCode-Regular.woff') format('woff'), 16 | url('/font/FiraCode-Regular.ttf') format('truetype'); 17 | font-style: normal; 18 | } 19 | 20 | html { 21 | &::-webkit-scrollbar { 22 | width: 8px; 23 | height: 8px; 24 | } 25 | &::-webkit-scrollbar-thumb { 26 | height: 40px; 27 | background-color: #eee; 28 | border-radius: 16px; 29 | &:hover { 30 | background-color: #ddd; 31 | } 32 | } 33 | } 34 | 35 | ::selection { 36 | background: rgba(0, 149, 255, 0.1); 37 | } 38 | 39 | html { 40 | font-family: "Josefin Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", STHeiti, "Microsoft Yahei", "WenQuanYi Micro Hei", Arial, Verdana, sans-serif; 41 | } 42 | 43 | body { 44 | font-size: 11pt; 45 | font-weight: 400; 46 | line-height: 2em; 47 | background-color: $light-background-color; 48 | color: $light-font-color; 49 | &:before { 50 | content: ""; 51 | background-repeat: no-repeat; 52 | background-position: center; 53 | opacity: 0.05; 54 | position: fixed; 55 | top: 0; 56 | left: 0; 57 | width: 100%; 58 | height: 100%; 59 | z-index: -1; 60 | -webkit-filter: grayscale(100%); 61 | -moz-filter: grayscale(100%); 62 | -ms-filter: grayscale(100%); 63 | -o-filter: grayscale(100%); 64 | filter: grayscale(100%); 65 | filter: gray; 66 | } 67 | 68 | &.dark-theme { 69 | background-color: $dark-background-color; 70 | color: $dark-font-color; 71 | } 72 | } 73 | 74 | a { 75 | color: $light-global-link-color; 76 | text-decoration: none; 77 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 78 | &:hover { 79 | color: $light-global-link-hover-color; 80 | text-decoration: none; 81 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 82 | } 83 | 84 | .dark-theme & { 85 | color: $dark-global-link-color; 86 | text-decoration: none; 87 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 88 | 89 | &:hover{ 90 | color: $dark-global-link-hover-color; 91 | text-decoration: none; 92 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 93 | } 94 | } 95 | } 96 | 97 | blockquote { 98 | font: 14px/22px normal helvetica, sans-serif; 99 | margin-top: 10px; 100 | margin-bottom: 10px; 101 | margin-left: 2%; 102 | margin-right: 0%; 103 | padding-left: 15px; 104 | padding-top: 10px; 105 | padding-right: 10px; 106 | padding-bottom: 10px; 107 | border-left: 3px solid #ccc; 108 | background-color:#f1f1f1; 109 | 110 | .dark-theme & { 111 | background-color:$dark-blockquote-background-color; 112 | } 113 | } -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.44-relnotes/index.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | date: 2018-07-13 4 | title: "Hugo 0.44: Friday the 13th Edition" 5 | description: "A sequel to the very popular Hugo Pipes Edition; bug-fixes and enhancements …" 6 | categories: ["Releases"] 7 | --- 8 | 9 | 10 | Hugo `0.44` is the follow-up release, or **The Sequel**, of the very well received `0.43` only days ago. That release added **Hugo Pipes**, with SCSS/SASS support, assets bundling and minification, ad-hoc image processing and much more. 11 | 12 | This is mostly a bug-fix release, but it also includes several important improvements. 13 | 14 | Many complained that their SVG images vanished when browsed from the `hugo server`. With **Hugo Pipes** MIME types suddenly got really important, but Hugo's use of `Suffix` was ambiguous. This became visible when we redefined the `image/svg+xml` to work with **Hugo Pipes**. We have now added a `Suffixes` field on the MIME type definition in Hugo, which is a list of one or more filename suffixes the MIME type is identified with. If you need to add a custom MIME type definition, this means that you also need to specify the full MIME type as the key, e.g. `image/svg+xml`. 15 | 16 | Hugo now has: 17 | 18 | * 27120+ [stars](https://github.com/gohugoio/hugo/stargazers) 19 | * 443+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) 20 | * 239+ [themes](http://themes.gohugo.io/) 21 | 22 | ## Notes 23 | * `MediaType.Suffix` is deprecated and replaced with a plural version, `MediaType.Suffixes`, with a more specific definition. You will get a detailed WARNING in the console if you need to do anything. 24 | 25 | ## Enhancements 26 | * Allow multiple file suffixes per media type [b874a1ba](https://github.com/gohugoio/hugo/commit/b874a1ba7ab8394dc741c8c70303a30a35b63e43) [@bep](https://github.com/bep) [#4920](https://github.com/gohugoio/hugo/issues/4920) 27 | * Clean up the in-memory Resource reader usage [47d38628](https://github.com/gohugoio/hugo/commit/47d38628ec0f4e72ff17661f13456b2a1511fe13) [@bep](https://github.com/bep) [#4936](https://github.com/gohugoio/hugo/issues/4936) 28 | * Move opening of the transformed resources after cache check [0024dcfe](https://github.com/gohugoio/hugo/commit/0024dcfe3e016c67046de06d1dac5e7f5235f9e1) [@bep](https://github.com/bep) 29 | * Improve type support in `resources.Concat` [306573de](https://github.com/gohugoio/hugo/commit/306573def0e20ec16ee5c447981cc09ed8bb7ec7) [@bep](https://github.com/bep) [#4934](https://github.com/gohugoio/hugo/issues/4934) 30 | * Flush `partialCached` cache on rebuilds [6b6dcb44](https://github.com/gohugoio/hugo/commit/6b6dcb44a014699c289bf32fe57d4c4216777be0) [@bep](https://github.com/bep) [#4931](https://github.com/gohugoio/hugo/issues/4931) 31 | * Include the transformation step in the error message [d96f2a46](https://github.com/gohugoio/hugo/commit/d96f2a460f58e91d8f6253a489d4879acfec6916) [@bep](https://github.com/bep) [#4924](https://github.com/gohugoio/hugo/issues/4924) 32 | * Exclude *.svg from CRLF/LF conversion [9c1e8208](https://github.com/gohugoio/hugo/commit/9c1e82085eb07d5b4dcdacbe82d5bafd26e08631) [@anthonyfok](https://github.com/anthonyfok) 33 | 34 | ## Fixes 35 | 36 | * Fix `resources.Concat` for transformed resources [beec1fc9](https://github.com/gohugoio/hugo/commit/beec1fc98e5d37bba742d6bc2a0ff7c344b469f8) [@bep](https://github.com/bep) [#4936](https://github.com/gohugoio/hugo/issues/4936) 37 | * Fix static filesystem for themed multihost sites [80c8f3b8](https://github.com/gohugoio/hugo/commit/80c8f3b81a9849080e64bf877288ede28d960d3f) [@bep](https://github.com/bep) [#4929](https://github.com/gohugoio/hugo/issues/4929) 38 | * Set permission of embedded templates to 0644 [2b73e89d](https://github.com/gohugoio/hugo/commit/2b73e89d6d2822e86360a6c92c87f539677c119b) [@anthonyfok](https://github.com/anthonyfok) 39 | 40 | -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.46-relnotes/index.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | date: 2018-08-01 4 | title: "The Summer of Hugo" 5 | description: "Hugo 0.46: Full SCSS/SASS import inheritance support, rework of Hugo Pipes vs. multilingual, and more …" 6 | categories: ["Releases"] 7 | --- 8 | 9 | **Hugo 0.46** is the closing credits to **The Summer of Hugo**. While most people have been relaxing on the beach, Hugo has been really busy: 10 | 11 | * **0.42, June 12, 2018**: [Theme Composition and Inheritance!](https://gohugo.io/news/0.42-relnotes/) 12 | * **0.43, July 9, 2018**: [Hugo Pipes!](https://gohugo.io/news/0.43-relnotes/) 13 | 14 | This was followed by some more technical follow-up releases. And today, when July has turned into August, we come with another one. It's not a big release. But with the big interest in **Hugo Pipes**, we felt that it was important to get this out there sooner rather than later. 15 | 16 | There are two main items in this release: 17 | 18 | 1. We have added a custom SCSS/SASS import resolver that respects Hugo's project/themes filesystem hierarchy anywhere in `/assets`. Using the LibSass' resolver alone only made this work for the entry folder. 19 | 2. Resources fetched via `resources.Get` and similar are now language agnostic. The thought behind the original implementation was maximum flexibility with support for `assetDir` per language. In practice, this was a bad idea, as it made some CSS imports hard to get working in multilingual setups, and you got duplication of identical content for no good reason, with added processing time. 20 | 21 | This release represents **12 contributions by 2 contributors** to the main Hugo code base. 22 | 23 | A special thanks in this release goes to [@onedrawingperday](https://github.com/onedrawingperday) for his excellent work maintaining the fast-growing [Themes Site](https://themes.gohugo.io/). 24 | 25 | Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs), 26 | which has received **5 contributions by 3 contributors**. 27 | 28 | Hugo now has: 29 | 30 | * 27596+ [stars](https://github.com/gohugoio/hugo/stargazers) 31 | * 442+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) 32 | * 245+ [themes](http://themes.gohugo.io/) 33 | 34 | ## Notes 35 | 36 | * Resources fetched via `resources.Get` and similar are now considered global across languages. If you need, as an example, to create a CSS per language, you need to set the path yourself. 37 | 38 | ## Enhancements 39 | 40 | * Add `templates.Exists` template function. This can be used to check if a template, e.g. a partial, exists in the project or any of the themes in use. [0ba19c57](https://github.com/gohugoio/hugo/commit/0ba19c57f180c33b41c64335ea1d1c89335d34c0) [@bep](https://github.com/bep) [#5010](https://github.com/gohugoio/hugo/issues/5010) 41 | * Remove superflous loop [0afa2897](https://github.com/gohugoio/hugo/commit/0afa2897a0cf90f4348929ef432202efddc183a0) [@bep](https://github.com/bep) 42 | * Update Chroma [b5d13ca1](https://github.com/gohugoio/hugo/commit/b5d13ca16bf106c1bc29c2a5295cd231d1bf13fd) [@bep](https://github.com/bep) [#5019](https://github.com/gohugoio/hugo/issues/5019) 43 | * Make resources fetched via `resources.Get` and similar language agnostic [6b02f5c0](https://github.com/gohugoio/hugo/commit/6b02f5c0f4e0ba1730aebc5a590a111548233bd5) [@bep](https://github.com/bep) [#5017](https://github.com/gohugoio/hugo/issues/5017) 44 | * Improve SCSS project vs themes import resolution [f219ac09](https://github.com/gohugoio/hugo/commit/f219ac09f6b7e26d84599401512233d77c1bdb4c) [@bep](https://github.com/bep) [#5008](https://github.com/gohugoio/hugo/issues/5008) 45 | * Improve _ prefix handling in SCSS imports [88e447c4](https://github.com/gohugoio/hugo/commit/88e447c449608523d87c517396bde31a62f392b6) [@bep](https://github.com/bep) [#5008](https://github.com/gohugoio/hugo/issues/5008) 46 | 47 | ## Fixes 48 | * Fix file paths for uncached transformed images [b718d743](https://github.com/gohugoio/hugo/commit/b718d743b7a2eff3bea74ced57147825294a629f) [@RJacksonm1](https://github.com/RJacksonm1) [#5012](https://github.com/gohugoio/hugo/issues/5012) 49 | * Fix image cache eviction for sites with subdir in baseURL [786f7230](https://github.com/gohugoio/hugo/commit/786f72302f65580ca8d1df2132a7756584539ea0) [@bep](https://github.com/bep) [#5006](https://github.com/gohugoio/hugo/issues/5006) 50 | -------------------------------------------------------------------------------- /assets/css/_common/_section/footer.scss: -------------------------------------------------------------------------------- 1 | /**Footer**/ 2 | 3 | .copyright { 4 | font-size: 14px; 5 | } 6 | 7 | #dynamic-to-top { 8 | display: none; 9 | overflow: hidden; 10 | width: auto; 11 | z-index: 90; 12 | position: fixed; 13 | bottom: 2em; 14 | right: 2em; 15 | top: auto; 16 | left: auto; 17 | font-family: sans-serif; 18 | font-size: 1em; 19 | color: #fff; 20 | text-decoration: none; 21 | text-shadow: 0 1px 0 #333; 22 | font-weight: bold; 23 | padding: 17px 16px; 24 | border: 1px solid $light-border-color; 25 | background: #222; 26 | &:hover { 27 | background: #000; 28 | cursor: pointer; 29 | } 30 | &:active { 31 | background: #000; 32 | outline: none; 33 | } 34 | outline: none; 35 | &:focus, &:hover { 36 | outline: none; 37 | } 38 | span { 39 | display: block; 40 | overflow: hidden; 41 | width: 14px; 42 | height: 12px; 43 | background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAKCAYAAACE2W/HAAAACXBIWXMAAArwAAAK8AFCrDSYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAKVJREFUeNqUz7ENgzAURdErUSXQMgdTZJFIqeg8DFI2YQeEvAEbUJja3y9NEiwCUXIlN/62jww7Saok3Z+r4pckXSRNWpskXb5deClHfeo7ylGrLqnbTmOMs/e+9d63McZ554GOlFLId0IIvXOuAUqgdM41IYQ+P5NSCpjZkitADRTZTwqgznUzWzCzZaMc9dbNbGEYhuuOclQB1OM43gBO/N/5MQAeMwpyB1MtLQAAAABJRU5ErkJggg==') no-repeat center center; 44 | } 45 | 46 | .dark-theme &{ 47 | border: 1px solid $dark-border-color; 48 | } 49 | } -------------------------------------------------------------------------------- /layouts/_default/single.html: -------------------------------------------------------------------------------- 1 | {{ define "content" -}} 2 | {{ $cdn_url := .Scratch.Get "cdn_url" }} 3 |
4 |
5 |

{{ .Title }}

6 | 25 |
26 |
27 | 28 | 29 | {{ $images := findRE " 37 | {{ end }} 38 | 39 | 40 | {{ $reAltIn := "\"([^\"]+)?\"" }} 41 | {{ $reAltOut := ( printf "
\"$2\"
$2
" $cdn_url ) }} 42 | {{ $altContent := .Content | replaceRE $reAltIn $reAltOut | safeHTML }} 43 | 44 | {{ $reAltTitleIn := "\"([^\"]+)?\"" }} 45 | {{ $reAltTitleOut := ( printf "
\"$2\"
$2
" $cdn_url ) }} 46 | {{ $finalContent := $altContent | replaceRE $reAltTitleIn $reAltTitleOut | safeHTML }} 47 | 48 | {{ $finalContent }} 49 |
50 | 51 |
52 | {{ with .Site.Params.author }} 53 | 57 | {{ end }} 58 | 59 | {{ with .Permalink }} 60 | 64 | {{ end }} 65 | {{ with .Site.Params.license }} 66 | 69 | {{ end }} 70 |
71 | 72 | 73 |
74 | {{ with .Params.tags }} 75 |
76 | Tag(s): 77 | {{ range . }} 78 | 79 | #{{.}} 80 | {{ end }} 81 |
82 | {{ end }} 83 |
84 | back · 85 | home 86 |
87 |
88 | 89 |
90 | {{ if .PrevInSection }} 91 | 92 | {{ end }} 93 | {{ if .NextInSection }} 94 | 95 | {{ end }} 96 |
97 | 98 |
99 | {{ if ( .Params.showComments | default true ) }} 100 | {{ if ne .Site.DisqusShortname "" }} 101 | {{ template "_internal/disqus.html" . }} 102 | {{ end }} 103 | {{ end }} 104 | {{ partial "gitalk.html" . }} 105 |
106 |
107 | {{- end }} 108 | -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.48-relnotes/index.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | date: 2018-08-29 4 | title: "This One Goes to 11!" 5 | description: "With Go 1.11, Hugo finally gets support for variable overwrites in templates!" 6 | categories: ["Releases"] 7 | --- 8 | 9 | Hugo `0.48` is built with the brand new Go 1.11. On the technical side this means that Hugo now uses [Go Modules](https://github.com/golang/go/wiki/Modules) for the build. The big new functional thing in Go 1.11 for Hugo is added support for [variable overwrites](https://github.com/golang/go/issues/10608). This means that you can now do this and get the expected result: 10 | 11 | ```go-html-template 12 | {{ $var := "Hugo Page" }} 13 | {{ if .IsHome }} 14 | {{ $var = "Hugo Home" }} 15 | {{ end }} 16 | Var is {{ $var }} 17 | ``` 18 | 19 | The above may look obvious, but has not been possible until now. In Hugo we have had `.Scratch` as a workaround for this, but Go 1.11 will help clean up a lot of templates. 20 | 21 | This release represents **23 contributions by 5 contributors** to the main Hugo code base. [@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@anthonyfok](https://github.com/anthonyfok), [@vsopvsop](https://github.com/vsopvsop), and [@moorereason](https://github.com/moorereason) for their ongoing contributions. And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) for his great work on the documentation site. 22 | 23 | Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs), 24 | which has received **15 contributions by 12 contributors**. A special thanks to [@bep](https://github.com/bep), [@kaushalmodi](https://github.com/kaushalmodi), [@regisphilibert](https://github.com/regisphilibert), and [@anthonyfok](https://github.com/anthonyfok) for their work on the documentation site. 25 | 26 | 27 | Hugo now has: 28 | 29 | * 28275+ [stars](https://github.com/gohugoio/hugo/stargazers) 30 | * 441+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) 31 | * 252+ [themes](http://themes.gohugo.io/) 32 | 33 | ## Enhancements 34 | 35 | * Add a test for template variable overwrite [0c8a4154](https://github.com/gohugoio/hugo/commit/0c8a4154838e32a33d34202fd4fa0187aa502190) [@bep](https://github.com/bep) 36 | * Include language code in REF_NOT_FOUND errors [94d0e79d](https://github.com/gohugoio/hugo/commit/94d0e79d33994b9a9d26a4d020500acdcc71e58c) [@bep](https://github.com/bep) [#5110](https://github.com/gohugoio/hugo/issues/5110) 37 | * Improve minifier MIME type resolution [ebb56e8b](https://github.com/gohugoio/hugo/commit/ebb56e8bdbfaf4f955326017e40b2805850871e9) [@bep](https://github.com/bep) [#5093](https://github.com/gohugoio/hugo/issues/5093) 38 | * Update to Go 1.11 [6b9934a2](https://github.com/gohugoio/hugo/commit/6b9934a26615ea614b1774770532cae9762a58d3) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115) 39 | * Set GO111MODULE=on for mage install [c7f05779](https://github.com/gohugoio/hugo/commit/c7f057797ca7bfc781d5a2bbf181bb52360f160f) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115) 40 | * Add instruction to install PostCSS when missing [08d14113](https://github.com/gohugoio/hugo/commit/08d14113b60ff70ffe922e8098e289b099a70e0f) [@anthonyfok](https://github.com/anthonyfok) [#5111](https://github.com/gohugoio/hugo/issues/5111) 41 | * Update snapcraft build config to Go 1.11 [94d6d678](https://github.com/gohugoio/hugo/commit/94d6d6780fac78e9ed5ed58ecdb9821ad8f0f27c) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115) 42 | * Use Go 1.11 modules with Mage [45c9c45d](https://github.com/gohugoio/hugo/commit/45c9c45d1d0d99443fa6bb524a1265fa9ba95e0e) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115) 43 | * Add go.mod [fce32c07](https://github.com/gohugoio/hugo/commit/fce32c07fb80e9929bc2660cf1e681e93009d24b) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115) 44 | * Update Travis to Go 1.11 and Go 1.10.4 [d32ff16f](https://github.com/gohugoio/hugo/commit/d32ff16fd61f55874e81d73759afa099b8bdcb57) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115) 45 | * Skip installing postcss due to failure on build server [66f688f7](https://github.com/gohugoio/hugo/commit/66f688f7120560ca787c1a23e3e7fbc3aa617956) [@anthonyfok](https://github.com/anthonyfok) 46 | 47 | ## Fixes 48 | 49 | * Keep end tags [e6eda2a3](https://github.com/gohugoio/hugo/commit/e6eda2a370aa1184e0afaf12e95dbd6f8b63ace5) [@vsopvsop](https://github.com/vsopvsop) 50 | * Fix permissions when creating new folders [f4675fa0](https://github.com/gohugoio/hugo/commit/f4675fa0f0fae2358adfaea49e8da824ee094495) [@bep](https://github.com/bep) [#5128](https://github.com/gohugoio/hugo/issues/5128) 51 | * Fix handling of taxonomy terms containing slashes [fff13253](https://github.com/gohugoio/hugo/commit/fff132537b4094221f4f099e2251f3cda613060f) [@moorereason](https://github.com/moorereason) [#4090](https://github.com/gohugoio/hugo/issues/4090) 52 | * Fix build on armv7 [8999de19](https://github.com/gohugoio/hugo/commit/8999de193c18b7aa07b44e5b7d9f443a8572e117) [@caarlos0](https://github.com/caarlos0) [#5101](https://github.com/gohugoio/hugo/issues/5101) 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### I migrated this project to [Mogeko/mogege](https://github.com/Mogeko/mogege) 2 | 3 | --- 4 | 5 | LeaveIt Hugo Theme 6 | ======================== 7 | 8 | LeaveIt is a clean, elegant, simple but not simpler blog theme for Hugo. 9 | 10 | ![hugo-theme-LeaveIt](https://raw.githubusercontent.com/liuzc/LeaveIt/master/images/screenshot.png) 11 | 12 | # Demo 13 | To see this theme in action, Here is a live [demo site](https://liuzhichao.com) which is rendered with this theme and some content for documentation and blog posts. 14 | 15 | 16 | [中文说明](https://liuzhichao.com/2018/hugo-theme-leaveit/) 17 | 18 | # Features 19 | 20 | * Dark/Light mode 21 | * Wrap Image with Figure Tag without Shortcode. Thanks [Junian.Net](https://www.junian.net/hugo-image-figure-wrap/) 22 | * Load images with Lazy Load By [lazysizes](https://github.com/aFarkas/lazysizes) 23 | * Automatically highlighting code By [Google code-prettify](https://github.com/google/code-prettify), Customizable styles via CSS. See the [themes gallery](https://rawgit.com/google/code-prettify/master/styles/index.html). 24 | * Automagical image gallery with [lightGallery](https://github.com/sachinchoolur/lightGallery) 25 | * ... 26 | 27 | # Getting Started 28 | Clone this repository to your hugo theme directory. 29 | 30 | ```bash 31 | cd themes 32 | git clone https://github.com/liuzc/LeaveIt.git 33 | ``` 34 | 35 | Next, open config.toml in the base of the Hugo site and ensure the theme option is set to mainroad: 36 | ```bash 37 | theme = "LeaveIt" 38 | ``` 39 | For more information read the [official setup guide](https://gohugo.io/documentation/) of Hugo. 40 | 41 | # Site Configuration 42 | Take a look in the `exampleSite` folder. 43 | 44 | This directory contains an example config file and the content for the demo. It serves as an example setup for your documentation. 45 | 46 | Copy the `config.toml` in the root directory of your website. Overwrite the existing config file if necessary. 47 | 48 | # Content Suggestions 49 | 50 | A few suggestions to help you get a good looking site quickly: 51 | 52 | * Keep blog posts in the content/posts directory, for example: content/posts/my-first-post.md 53 | * Keep static pages in the content directory, for example: content/about.md 54 | * Keep media like images in the static directory, for example: static/images/2016/10/screenshot.png 55 | 56 | # Customizing styles for your website 57 | 58 | If you want to change some styling to fit your own website needs, you can edit them: 59 | 60 | * `assets/css/_varibales/default.scss`: You can override the variables in `_variables.scss` to customize the style 61 | * `assets/css/_custom.scss` : You can put your custom css in this file 62 | 63 | # Favicons, Browserconfig, Manifest 64 | 65 | It is recommended to put your own favicons 66 | 67 | * apple-touch-icon.png (180x180) 68 | * favicon-32x32.png (32x32) 69 | * favicon-16x16.png (16x16) 70 | * mstile-150x150.png (150x150) 71 | * android-chrome-192x192.png (192x192) 72 | * android-chrome-512x512.png (512x512) 73 | 74 | into `/static`. They’re easily created via https://realfavicongenerator.net/. 75 | 76 | Customize browserconfig.xml and site.webmanifest to set theme-color and background-color for example. 77 | 78 | # Tips 79 | 80 | #### Set production environment when generating site 81 | 82 | Because some functions are only in production mode, So you **need to add a production** environment variables when generating your site. 83 | ```bash 84 | HUGO_ENV=production hugo --gc --minify 85 | ``` 86 | 87 | #### Hugo “extended” Sass/SCSS version required 88 | 89 | This theme write style with scss, So you must download and install the “extended” Sass/SCSS version 90 | 91 | #### How to toggle dark-light mode 92 | * You can click the love heart ❤️ in front of your blog title to toggle dark-light mode. I don't think it's a good interaction design. But I don't have a good idea. 93 | * If you want to make your own theme toggle-able element, you can create an element with a class `.theme-switch`. See [here](https://github.com/liuzc/LeaveIt/blob/4e8672ebbc636ba1d0e96573d25739a5295d879b/assets/js/main.js#L32) 94 | 95 | # Home Post model 96 | If you want to show posts on index instead of a personal profile, just open config.toml in the base of the Hugo site, add the following line to config.toml 97 | ```toml 98 | [params] 99 | home_mode = "post" # post or other 100 | ``` 101 | 102 | ### Displaying Featured Image 103 | 104 | ```toml 105 | --- 106 | date: 2018-08-29 107 | title: "This One Goes to 11!" 108 | description: "With Go 1.11, Hugo finally gets support for variable overwrites in templates!" 109 | categories: ["Releases"] 110 | featured_image: https://raw.githubusercontent.com/gohugoio/hugoDocs/master/content/en/news/0.48-relnotes/featured-hugo-48-poster.png 111 | --- 112 | ``` 113 | ![hugo-theme-LeaveIt-Host_post](https://raw.githubusercontent.com/liuzc/LeaveIt/master/images/home_post_mode.jpg) 114 | 115 | # Questions, ideas, bugs, pull requests? 116 | All feedback is welcome! Head over to the [issue tracker](https://github.com/liuzc/LeaveIt/issues). 117 | 118 | # License 119 | LeaveIt is licensed under the MIT license. Check the LICENSE file for details. 120 | The following resources are included in the theme: 121 | 122 | * lazysizes - https://github.com/aFarkas/lazysizes 123 | * lightGallery - https://github.com/sachinchoolur/lightGallery 124 | * code-prettify - https://github.com/google/code-prettify 125 | 126 | # Author 127 | [LiuZhichao](https://github.com/liuzc) 128 | 129 | # See Also 130 | 131 | * [Coder](https://themes.gohugo.io/hugo-coder/) 132 | * [hello-friend](https://themes.gohugo.io/hugo-theme-hello-friend/) 133 | -------------------------------------------------------------------------------- /assets/css/_common/_page/post.scss: -------------------------------------------------------------------------------- 1 | /** Post **/ 2 | 3 | .post-warp { 4 | position: relative; 5 | width: 100%; 6 | max-width: 780px; 7 | margin: 0 auto; 8 | padding-top: 2rem; 9 | 10 | .post-header h1 { 11 | margin: 0 !important; 12 | } 13 | 14 | .post-title { 15 | font-size: 2em; 16 | line-height: 1.5em; 17 | } 18 | 19 | .post-meta { 20 | color: rgba(85, 85, 85, 0.52941) !important; 21 | .dark-theme & { 22 | color: $dark-font-secondary-color !important; 23 | } 24 | 25 | a { 26 | color: $light-post-link-color; 27 | .dark-theme & { 28 | color: $dark-post-link-color; 29 | } 30 | 31 | &:hover { 32 | color: $light-post-link-hover-color; 33 | .dark-theme & { 34 | color: $dark-post-link-hover-color; 35 | } 36 | } 37 | } 38 | } 39 | 40 | .post-content { 41 | padding-top: 2rem; 42 | 43 | h2, 44 | h3, 45 | h4, 46 | h5, 47 | h6 { 48 | padding-top: .8em; 49 | padding-bottom: .3em; 50 | } 51 | h2::before { 52 | content: "#"; 53 | margin-right: 5px; 54 | color: $light-post-link-color; 55 | .dark-theme & { 56 | color: $dark-post-link-color; 57 | } 58 | } 59 | 60 | h3::before { 61 | content: "|"; 62 | margin-right: 5px; 63 | color: $light-post-link-color; 64 | 65 | .dark-theme & { 66 | color: $dark-post-link-color; 67 | } 68 | } 69 | 70 | a { 71 | color: $light-post-link-color; 72 | .dark-theme & { 73 | color: $dark-post-link-color; 74 | } 75 | } 76 | 77 | a:hover { 78 | color: $light-post-link-hover-color; 79 | .dark-theme &:hover { 80 | color: $dark-post-link-hover-color; 81 | // font-weight: bold; 82 | text-decoration: underline; 83 | } 84 | } 85 | 86 | code, 87 | pre { 88 | padding: 7px; 89 | font-size: 13px; 90 | font-family: 'Fira Code', Consolas, Monaco, Menlo, Consolas, monospace; 91 | word-break: break-all; 92 | word-wrap: break-word; 93 | } 94 | 95 | code:not([class]) { 96 | padding: 1px 6px; 97 | margin: 0 2px; 98 | background: $light-code-notclass-background-color; 99 | border-radius: 5px; 100 | 101 | .dark-theme &:not([class]) { 102 | background: $dark-code-notclass-background-color; 103 | } 104 | } 105 | 106 | ul { 107 | padding-left: 2em; 108 | } 109 | 110 | table { 111 | max-width: 100%; 112 | margin: 10px 0; 113 | border-spacing: 0; 114 | box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.125); 115 | 116 | th, 117 | td { 118 | padding: 5px 15px; 119 | border: 1px double #ebe9f5; 120 | } 121 | } 122 | 123 | figure { 124 | text-align: center; 125 | img:hover{ 126 | cursor: zoom-in; 127 | } 128 | } 129 | 130 | .image-caption:not(:empty) { 131 | min-width: 20%; 132 | max-width: 80%; 133 | display: inline-block; 134 | padding: 10px; 135 | margin: 0 auto; 136 | border-bottom: 1px solid #d9d9d9; 137 | font-size: 14px; 138 | color: #969696; 139 | line-height: 1.7; 140 | } 141 | 142 | img { 143 | display: block; 144 | max-width: 80%; 145 | height: auto; 146 | margin: 0 auto; 147 | overflow: hidden; 148 | } 149 | 150 | 151 | 152 | img[data-action="zoom"] { 153 | cursor: zoom-in; 154 | } 155 | 156 | .featured_image { 157 | width: 100% !important; 158 | max-width: 100% !important; 159 | height: auto !important; 160 | margin: 0 !important; 161 | } 162 | } 163 | 164 | p { 165 | font-size: 1em; 166 | margin: .5em 0 .5em 0; 167 | } 168 | 169 | .post-copyright { 170 | margin-top: 5rem; 171 | border-top: 1px solid $light-border-color; 172 | border-bottom: 1px solid $light-border-color; 173 | 174 | .copyright-item { 175 | margin: 5px 0; 176 | } 177 | 178 | .lincese { 179 | font-weight: bold; 180 | & a {} 181 | } 182 | 183 | .dark-theme & { 184 | border-top: 1px solid $dark-border-color; 185 | border-bottom: 1px solid $dark-border-color; 186 | } 187 | } 188 | 189 | .post-tags { 190 | padding: 1rem 0 1rem; 191 | display: flex; 192 | justify-content: space-between; 193 | 194 | } 195 | 196 | 197 | .post-nav { 198 | 199 | &:before, 200 | &:after { 201 | content: " "; 202 | display: table; 203 | } 204 | 205 | & a.prev, 206 | & a.next { 207 | font-weight: 600; 208 | font-size: 16px; 209 | 210 | transition-property: transform; 211 | transition-timing-function: ease-out; 212 | transition-duration: 0.3s; 213 | } 214 | 215 | & a.prev { 216 | float: left; 217 | } 218 | 219 | & a.prev:hover { 220 | transform: translateX(-4px); 221 | } 222 | 223 | & a.next { 224 | float: right; 225 | } 226 | & a.next:hover { 227 | transform: translateX(4px); 228 | } 229 | } 230 | 231 | .tag:not(:last-child) a::after { 232 | content: " / "; 233 | } 234 | 235 | .post-comment{ 236 | padding: 3em 0; 237 | } 238 | } -------------------------------------------------------------------------------- /assets/js/lazysizes.min.js: -------------------------------------------------------------------------------- 1 | /*! lazysizes - v4.1.2 */ 2 | !function(a,b){var c=b(a,a.document);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}(window,function(a,b){"use strict";if(b.getElementsByClassName){var c,d,e=b.documentElement,f=a.Date,g=a.HTMLPictureElement,h="addEventListener",i="getAttribute",j=a[h],k=a.setTimeout,l=a.requestAnimationFrame||k,m=a.requestIdleCallback,n=/^picture$/i,o=["load","error","lazyincluded","_lazyloaded"],p={},q=Array.prototype.forEach,r=function(a,b){return p[b]||(p[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),p[b].test(a[i]("class")||"")&&p[b]},s=function(a,b){r(a,b)||a.setAttribute("class",(a[i]("class")||"").trim()+" "+b)},t=function(a,b){var c;(c=r(a,b))&&a.setAttribute("class",(a[i]("class")||"").replace(c," "))},u=function(a,b,c){var d=c?h:"removeEventListener";c&&u(a,b),o.forEach(function(c){a[d](c,b)})},v=function(a,d,e,f,g){var h=b.createEvent("CustomEvent");return e||(e={}),e.instance=c,h.initCustomEvent(d,!f,!g,e),a.dispatchEvent(h),h},w=function(b,c){var e;!g&&(e=a.picturefill||d.pf)?(c&&c.src&&!b[i]("srcset")&&b.setAttribute("srcset",c.src),e({reevaluate:!0,elements:[b]})):c&&c.src&&(b.src=c.src)},x=function(a,b){return(getComputedStyle(a,null)||{})[b]},y=function(a,b,c){for(c=c||a.offsetWidth;c49?function(){m(h,{timeout:g}),g!==d.ricTimeout&&(g=d.ricTimeout)}:A(function(){k(h)},!0);return function(a){var d;(a=a===!0)&&(g=33),b||(b=!0,d=e-(f.now()-c),0>d&&(d=0),a||9>d?i():k(i,d))}},C=function(a){var b,c,d=99,e=function(){b=null,a()},g=function(){var a=f.now()-c;d>a?k(g,d-a):(m||e)(e)};return function(){c=f.now(),b||(b=k(g,d))}};!function(){var b,c={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};d=a.lazySizesConfig||a.lazysizesConfig||{};for(b in c)b in d||(d[b]=c[b]);a.lazySizesConfig=d,k(function(){d.init&&F()})}();var D=function(){var g,l,m,o,p,y,D,F,G,H,I,J,K,L,M=/^img$/i,N=/^iframe$/i,O="onscroll"in a&&!/(gle|ing)bot/.test(navigator.userAgent),P=0,Q=0,R=0,S=-1,T=function(a){R--,a&&a.target&&u(a.target,T),(!a||0>R||!a.target)&&(R=0)},U=function(a,c){var d,f=a,g="hidden"==x(b.body,"visibility")||"hidden"!=x(a.parentNode,"visibility")&&"hidden"!=x(a,"visibility");for(F-=c,I+=c,G-=c,H+=c;g&&(f=f.offsetParent)&&f!=b.body&&f!=e;)g=(x(f,"opacity")||1)>0,g&&"visible"!=x(f,"overflow")&&(d=f.getBoundingClientRect(),g=H>d.left&&Gd.top-1&&FR&&(a=r.length)){f=0,S++,null==K&&("expand"in d||(d.expand=e.clientHeight>500&&e.clientWidth>500?500:370),J=d.expand,K=J*d.expFactor),K>Q&&1>R&&S>2&&o>2&&!b.hidden?(Q=K,S=0):Q=o>1&&S>1&&6>R?J:P;for(;a>f;f++)if(r[f]&&!r[f]._lazyRace)if(O)if((p=r[f][i]("data-expand"))&&(m=1*p)||(m=Q),q!==m&&(y=innerWidth+m*L,D=innerHeight+m,n=-1*m,q=m),h=r[f].getBoundingClientRect(),(I=h.bottom)>=n&&(F=h.top)<=D&&(H=h.right)>=n*L&&(G=h.left)<=y&&(I||H||G||F)&&(d.loadHidden||"hidden"!=x(r[f],"visibility"))&&(l&&3>R&&!p&&(3>o||4>S)||U(r[f],m))){if(ba(r[f]),k=!0,R>9)break}else!k&&l&&!j&&4>R&&4>S&&o>2&&(g[0]||d.preloadAfterLoad)&&(g[0]||!p&&(I||H||G||F||"auto"!=r[f][i](d.sizesAttr)))&&(j=g[0]||r[f]);else ba(r[f]);j&&!k&&ba(j)}},W=B(V),X=function(a){s(a.target,d.loadedClass),t(a.target,d.loadingClass),u(a.target,Z),v(a.target,"lazyloaded")},Y=A(X),Z=function(a){Y({target:a.target})},$=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},_=function(a){var b,c=a[i](d.srcsetAttr);(b=d.customMedia[a[i]("data-media")||a[i]("media")])&&a.setAttribute("media",b),c&&a.setAttribute("srcset",c)},aa=A(function(a,b,c,e,f){var g,h,j,l,o,p;(o=v(a,"lazybeforeunveil",b)).defaultPrevented||(e&&(c?s(a,d.autosizesClass):a.setAttribute("sizes",e)),h=a[i](d.srcsetAttr),g=a[i](d.srcAttr),f&&(j=a.parentNode,l=j&&n.test(j.nodeName||"")),p=b.firesLoad||"src"in a&&(h||g||l),o={target:a},p&&(u(a,T,!0),clearTimeout(m),m=k(T,2500),s(a,d.loadingClass),u(a,Z,!0)),l&&q.call(j.getElementsByTagName("source"),_),h?a.setAttribute("srcset",h):g&&!l&&(N.test(a.nodeName)?$(a,g):a.src=g),f&&(h||l)&&w(a,{src:g})),a._lazyRace&&delete a._lazyRace,t(a,d.lazyClass),z(function(){(!p||a.complete&&a.naturalWidth>1)&&(p?T(o):R--,X(o))},!0)}),ba=function(a){var b,c=M.test(a.nodeName),e=c&&(a[i](d.sizesAttr)||a[i]("sizes")),f="auto"==e;(!f&&l||!c||!a[i]("src")&&!a.srcset||a.complete||r(a,d.errorClass)||!r(a,d.lazyClass))&&(b=v(a,"lazyunveilread").detail,f&&E.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,R++,aa(a,b,f,e,c))},ca=function(){if(!l){if(f.now()-p<999)return void k(ca,999);var a=C(function(){d.loadMode=3,W()});l=!0,d.loadMode=3,W(),j("scroll",function(){3==d.loadMode&&(d.loadMode=2),a()},!0)}};return{_:function(){p=f.now(),c.elements=b.getElementsByClassName(d.lazyClass),g=b.getElementsByClassName(d.lazyClass+" "+d.preloadClass),L=d.hFac,j("scroll",W,!0),j("resize",W,!0),a.MutationObserver?new MutationObserver(W).observe(e,{childList:!0,subtree:!0,attributes:!0}):(e[h]("DOMNodeInserted",W,!0),e[h]("DOMAttrModified",W,!0),setInterval(W,999)),j("hashchange",W,!0),["focus","mouseover","click","load","transitionend","animationend","webkitAnimationEnd"].forEach(function(a){b[h](a,W,!0)}),/d$|^c/.test(b.readyState)?ca():(j("load",ca),b[h]("DOMContentLoaded",W),k(ca,2e4)),c.elements.length?(V(),z._lsFlush()):W()},checkElems:W,unveil:ba}}(),E=function(){var a,c=A(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),n.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;g>f;f++)e[f].setAttribute("sizes",d);c.detail.dataAttr||w(a,c.detail)}),e=function(a,b,d){var e,f=a.parentNode;f&&(d=y(a,f,d),e=v(a,"lazybeforesizes",{width:d,dataAttr:!!b}),e.defaultPrevented||(d=e.detail.width,d&&d!==a._lazysizesWidth&&c(a,f,e,d)))},f=function(){var b,c=a.length;if(c)for(b=0;c>b;b++)e(a[b])},g=C(f);return{_:function(){a=b.getElementsByClassName(d.autosizesClass),j("resize",g)},checkElems:g,updateElem:e}}(),F=function(){F.i||(F.i=!0,E._(),D._())};return c={cfg:d,autoSizer:E,loader:D,init:F,uP:w,aC:s,rC:t,hC:r,fire:v,gW:y,rAF:z}}}); -------------------------------------------------------------------------------- /exampleSite/content/posts/migrate-from-jekyll.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Migrate to Hugo from Jekyll 3 | date: 2014-03-10 4 | categories: ["Uncategorized"] 5 | --- 6 | 7 | ## Move static content to `static` 8 | 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. 9 | With Jekyll, something that looked like 10 | 11 | ▾ / 12 | ▾ images/ 13 | logo.png 14 | 15 | should become 16 | 17 | ▾ / 18 | ▾ static/ 19 | ▾ images/ 20 | logo.png 21 | 22 | Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`. 23 | 24 | ## Create your Hugo configuration file 25 | 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. 26 | 27 | ## Set your configuration publish folder to `_site` 28 | 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: 29 | 30 | 1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended). 31 | 32 | git submodule deinit _site 33 | git rm _site 34 | git submodule add -b gh-pages git@github.com:your-username/your-repo.git public 35 | 36 | 2. Or, change the Hugo configuration to use `_site` instead of `public`. 37 | 38 | { 39 | .. 40 | "publishdir": "_site", 41 | .. 42 | } 43 | 44 | ## Convert Jekyll templates to Hugo templates 45 | 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. 46 | 47 | As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours. 48 | 49 | ## Convert Jekyll plugins to Hugo shortcodes 50 | Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port. 51 | 52 | ### Implementation 53 | 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. 54 | 55 | Jekyll's plugin: 56 | 57 | module Jekyll 58 | class ImageTag < Liquid::Tag 59 | @url = nil 60 | @caption = nil 61 | @class = nil 62 | @link = nil 63 | // Patterns 64 | IMAGE_URL_WITH_CLASS_AND_CAPTION = 65 | IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i 66 | IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i 67 | IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i 68 | IMAGE_URL = /((https?:\/\/|\/)(\S+))/i 69 | def initialize(tag_name, markup, tokens) 70 | super 71 | if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK 72 | @class = $1 73 | @url = $3 74 | @caption = $7 75 | @link = $9 76 | elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION 77 | @class = $1 78 | @url = $3 79 | @caption = $7 80 | elsif markup =~ IMAGE_URL_WITH_CAPTION 81 | @url = $1 82 | @caption = $5 83 | elsif markup =~ IMAGE_URL_WITH_CLASS 84 | @class = $1 85 | @url = $3 86 | elsif markup =~ IMAGE_URL 87 | @url = $1 88 | end 89 | end 90 | def render(context) 91 | if @class 92 | source = "
" 93 | else 94 | source = "
" 95 | end 96 | if @link 97 | source += "" 98 | end 99 | source += "" 100 | if @link 101 | source += "" 102 | end 103 | source += "
#{@caption}
" if @caption 104 | source += "
" 105 | source 106 | end 107 | end 108 | end 109 | Liquid::Template.register_tag('image', Jekyll::ImageTag) 110 | 111 | is written as this Hugo shortcode: 112 | 113 | 114 |
115 | {{ with .Get "link"}}{{ end }} 116 | 117 | {{ if .Get "link"}}{{ end }} 118 | {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} 119 |
{{ if isset .Params "title" }} 120 | {{ .Get "title" }}{{ end }} 121 | {{ if or (.Get "caption") (.Get "attr")}}

122 | {{ .Get "caption" }} 123 | {{ with .Get "attrlink"}} {{ end }} 124 | {{ .Get "attr" }} 125 | {{ if .Get "attrlink"}} {{ end }} 126 |

{{ end }} 127 |
128 | {{ end }} 129 |
130 | 131 | 132 | ### Usage 133 | I simply changed: 134 | 135 | {% 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/ %} 136 | 137 | to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`): 138 | 139 | {{%/* 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/" */%}} 140 | 141 | As a bonus, the shortcode named parameters are, arguably, more readable. 142 | 143 | ## Finishing touches 144 | ### Fix content 145 | 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. 146 | 147 | ### Clean up 148 | You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it. 149 | 150 | ## A practical example in a diff 151 | [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). 152 | -------------------------------------------------------------------------------- /assets/css/_common/_core/normalize.scss: -------------------------------------------------------------------------------- 1 | /*! normalize.css v8.0.0 | 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 | @charset "UTF-8"; 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 | html, 24 | body, 25 | main, 26 | div, 27 | span, 28 | a, 29 | li, 30 | ul, 31 | hr, 32 | h1, 33 | h2, 34 | h3, 35 | h4 { 36 | padding: 0; 37 | margin: 0; 38 | } 39 | /** 40 | * Correct the font size and margin on `h1` elements within `section` and 41 | * `article` contexts in Chrome, Firefox, and Safari. 42 | */ 43 | 44 | h1 { 45 | font-size: 2em; 46 | margin: 0.67em 0; 47 | } 48 | 49 | /* Grouping content 50 | ========================================================================== */ 51 | 52 | /** 53 | * 1. Add the correct box sizing in Firefox. 54 | * 2. Show the overflow in Edge and IE. 55 | */ 56 | 57 | hr { 58 | box-sizing: content-box; /* 1 */ 59 | height: 0; /* 1 */ 60 | overflow: visible; /* 2 */ 61 | } 62 | 63 | /** 64 | * 1. Correct the inheritance and scaling of font size in all browsers. 65 | * 2. Correct the odd `em` font sizing in all browsers. 66 | */ 67 | 68 | pre { 69 | font-family: monospace, monospace; /* 1 */ 70 | font-size: 1em; /* 2 */ 71 | } 72 | 73 | /* Text-level semantics 74 | ========================================================================== */ 75 | 76 | /** 77 | * Remove the gray background on active links in IE 10. 78 | */ 79 | 80 | a { 81 | background-color: transparent; 82 | } 83 | 84 | /** 85 | * 1. Remove the bottom border in Chrome 57- 86 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. 87 | */ 88 | 89 | abbr[title] { 90 | border-bottom: none; /* 1 */ 91 | text-decoration: underline; /* 2 */ 92 | text-decoration: underline dotted; /* 2 */ 93 | } 94 | 95 | /** 96 | * Add the correct font weight in Chrome, Edge, and Safari. 97 | */ 98 | 99 | b, 100 | strong { 101 | font-weight: bolder; 102 | } 103 | 104 | /** 105 | * 1. Correct the inheritance and scaling of font size in all browsers. 106 | * 2. Correct the odd `em` font sizing in all browsers. 107 | */ 108 | 109 | code, 110 | kbd, 111 | samp { 112 | font-family: monospace, monospace; /* 1 */ 113 | font-size: 1em; /* 2 */ 114 | } 115 | 116 | /** 117 | * Add the correct font size in all browsers. 118 | */ 119 | 120 | small { 121 | font-size: 80%; 122 | } 123 | 124 | /** 125 | * Prevent `sub` and `sup` elements from affecting the line height in 126 | * all browsers. 127 | */ 128 | 129 | sub, 130 | sup { 131 | font-size: 75%; 132 | line-height: 0; 133 | position: relative; 134 | vertical-align: baseline; 135 | } 136 | 137 | sub { 138 | bottom: -0.25em; 139 | } 140 | 141 | sup { 142 | top: -0.5em; 143 | } 144 | 145 | /* Embedded content 146 | ========================================================================== */ 147 | 148 | /** 149 | * Remove the border on images inside links in IE 10. 150 | */ 151 | 152 | img { 153 | border-style: none; 154 | } 155 | 156 | /* Forms 157 | ========================================================================== */ 158 | 159 | /** 160 | * 1. Change the font styles in all browsers. 161 | * 2. Remove the margin in Firefox and Safari. 162 | */ 163 | 164 | button, 165 | input, 166 | optgroup, 167 | select, 168 | textarea { 169 | font-family: inherit; /* 1 */ 170 | font-size: 100%; /* 1 */ 171 | line-height: 1.15; /* 1 */ 172 | margin: 0; /* 2 */ 173 | } 174 | 175 | /** 176 | * Show the overflow in IE. 177 | * 1. Show the overflow in Edge. 178 | */ 179 | 180 | button, 181 | input { 182 | /* 1 */ 183 | overflow: visible; 184 | } 185 | 186 | /** 187 | * Remove the inheritance of text transform in Edge, Firefox, and IE. 188 | * 1. Remove the inheritance of text transform in Firefox. 189 | */ 190 | 191 | button, 192 | select { 193 | /* 1 */ 194 | text-transform: none; 195 | } 196 | 197 | /** 198 | * Correct the inability to style clickable types in iOS and Safari. 199 | */ 200 | 201 | button, 202 | [type="button"], 203 | [type="reset"], 204 | [type="submit"] { 205 | -webkit-appearance: button; 206 | } 207 | 208 | /** 209 | * Remove the inner border and padding in Firefox. 210 | */ 211 | 212 | button::-moz-focus-inner, 213 | [type="button"]::-moz-focus-inner, 214 | [type="reset"]::-moz-focus-inner, 215 | [type="submit"]::-moz-focus-inner { 216 | border-style: none; 217 | padding: 0; 218 | } 219 | 220 | /** 221 | * Restore the focus styles unset by the previous rule. 222 | */ 223 | 224 | button:-moz-focusring, 225 | [type="button"]:-moz-focusring, 226 | [type="reset"]:-moz-focusring, 227 | [type="submit"]:-moz-focusring { 228 | outline: 1px dotted ButtonText; 229 | } 230 | 231 | /** 232 | * Correct the padding in Firefox. 233 | */ 234 | 235 | fieldset { 236 | padding: 0.35em 0.75em 0.625em; 237 | } 238 | 239 | /** 240 | * 1. Correct the text wrapping in Edge and IE. 241 | * 2. Correct the color inheritance from `fieldset` elements in IE. 242 | * 3. Remove the padding so developers are not caught out when they zero out 243 | * `fieldset` elements in all browsers. 244 | */ 245 | 246 | legend { 247 | box-sizing: border-box; /* 1 */ 248 | color: inherit; /* 2 */ 249 | display: table; /* 1 */ 250 | max-width: 100%; /* 1 */ 251 | padding: 0; /* 3 */ 252 | white-space: normal; /* 1 */ 253 | } 254 | 255 | /** 256 | * Add the correct vertical alignment in Chrome, Firefox, and Opera. 257 | */ 258 | 259 | progress { 260 | vertical-align: baseline; 261 | } 262 | 263 | /** 264 | * Remove the default vertical scrollbar in IE 10+. 265 | */ 266 | 267 | textarea { 268 | overflow: auto; 269 | } 270 | 271 | /** 272 | * 1. Add the correct box sizing in IE 10. 273 | * 2. Remove the padding in IE 10. 274 | */ 275 | 276 | [type="checkbox"], 277 | [type="radio"] { 278 | box-sizing: border-box; /* 1 */ 279 | padding: 0; /* 2 */ 280 | } 281 | 282 | /** 283 | * Correct the cursor style of increment and decrement buttons in Chrome. 284 | */ 285 | 286 | [type="number"]::-webkit-inner-spin-button, 287 | [type="number"]::-webkit-outer-spin-button { 288 | height: auto; 289 | } 290 | 291 | /** 292 | * 1. Correct the odd appearance in Chrome and Safari. 293 | * 2. Correct the outline style in Safari. 294 | */ 295 | 296 | [type="search"] { 297 | -webkit-appearance: textfield; /* 1 */ 298 | outline-offset: -2px; /* 2 */ 299 | } 300 | 301 | /** 302 | * Remove the inner padding in Chrome and Safari on macOS. 303 | */ 304 | 305 | [type="search"]::-webkit-search-decoration { 306 | -webkit-appearance: none; 307 | } 308 | 309 | /** 310 | * 1. Correct the inability to style clickable types in iOS and Safari. 311 | * 2. Change font properties to `inherit` in Safari. 312 | */ 313 | 314 | ::-webkit-file-upload-button { 315 | -webkit-appearance: button; /* 1 */ 316 | font: inherit; /* 2 */ 317 | } 318 | 319 | /* Interactive 320 | ========================================================================== */ 321 | 322 | /* 323 | * Add the correct display in Edge, IE 10+, and Firefox. 324 | */ 325 | 326 | details { 327 | display: block; 328 | } 329 | 330 | /* 331 | * Add the correct display in all browsers. 332 | */ 333 | 334 | summary { 335 | display: list-item; 336 | } 337 | 338 | /* Misc 339 | ========================================================================== */ 340 | 341 | /** 342 | * Add the correct display in IE 10+. 343 | */ 344 | 345 | template { 346 | display: none; 347 | } 348 | 349 | /** 350 | * Add the correct display in IE 10. 351 | */ 352 | 353 | [hidden] { 354 | display: none; 355 | } 356 | -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.47-relnotes/index.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | date: 2018-08-17 4 | title: "Output Minification, Live-Reload Fixes and More" 5 | description: "Hugo 0.47: Adds minification of rendered output, but is mostly a massive bug fix release." 6 | categories: ["Releases"] 7 | --- 8 | 9 | Hugo `0.47` is named **Hugo Reloaded**. It adds minification support for the final rendered output (run `hugo --minify`), but it is mostly a bug fix release. And most notably, it fixes a set of issues with live-reloading/partial rebuilds when running `hugo server`. Working with bundles should now be a more pleasant experience, to pick one example. 10 | 11 | This release represents **35 contributions by 6 contributors** to the main Hugo code base. 12 | [@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@satotake](https://github.com/satotake), [@anthonyfok](https://github.com/anthonyfok), and [@coliff](https://github.com/coliff) for their ongoing contributions. 13 | 14 | And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) and [@onedrawingperday](https://github.com/onedrawingperday) for their relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) for his great work on the documentation site. 15 | 16 | Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs), 17 | which has received **21 contributions by 10 contributors**. A special thanks to [@bep](https://github.com/bep), [@aapeliv](https://github.com/aapeliv), [@regisphilibert](https://github.com/regisphilibert), and [@brentybh](https://github.com/brentybh) for their work on the documentation site. 18 | 19 | 20 | Hugo now has: 21 | 22 | * 27980+ [stars](https://github.com/gohugoio/hugo/stargazers) 23 | * 442+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) 24 | * 251+ [themes](http://themes.gohugo.io/) 25 | 26 | ## Enhancements 27 | 28 | ### Templates 29 | 30 | * Suppress blank lines from opengraph internal template [c09ee78f](https://github.com/gohugoio/hugo/commit/c09ee78fd235599d3fb794110cd75c024d80cfca) [@anthonyfok](https://github.com/anthonyfok) 31 | * Add MIME type to embedded JS [755d1ffe](https://github.com/gohugoio/hugo/commit/755d1ffe7a22d8ad83485240ff78cf25d501602f) [@bep](https://github.com/bep) [#5042](https://github.com/gohugoio/hugo/issues/5042) 32 | * Add `os.Stat` template function [d7112085](https://github.com/gohugoio/hugo/commit/d71120852a8e14d0ea4d24de269fce041ef7b666) [@satotake](https://github.com/satotake) 33 | 34 | ### Output 35 | 36 | * Add support for minification of final output [789ef8c6](https://github.com/gohugoio/hugo/commit/789ef8c639e4621abd36da530bcb5942ac9297da) [@bep](https://github.com/bep) [#1251](https://github.com/gohugoio/hugo/issues/1251) 37 | 38 | ### Other 39 | 40 | * Regenerate CLI docs [4a16b5f4](https://github.com/gohugoio/hugo/commit/4a16b5f4b0adbb31fee611c378de9d5526de2f86) [@bep](https://github.com/bep) 41 | * Include theme name in version mismatch error [e5052f4e](https://github.com/gohugoio/hugo/commit/e5052f4e09b6df590cddf2f8bc2c834fd3af3082) [@bep](https://github.com/bep) [#5044](https://github.com/gohugoio/hugo/issues/5044) 42 | * Make the JS minifier matcher less specific [c81fbf46](https://github.com/gohugoio/hugo/commit/c81fbf4625ae7cc7dd3a7a526331ddfdf5237cc6) [@bep](https://github.com/bep) [#5073](https://github.com/gohugoio/hugo/issues/5073) 43 | * Close file when done [f6ae436c](https://github.com/gohugoio/hugo/commit/f6ae436c5878bafeafa0bb2646a2c9b32c9b4380) [@bep](https://github.com/bep) [#5062](https://github.com/gohugoio/hugo/issues/5062) 44 | * https links to 3rd party sites [c2a67413](https://github.com/gohugoio/hugo/commit/c2a6741394bc609a663522b245d3d75f0ad17da4) [@coliff](https://github.com/coliff) 45 | * Update alias.go [06bd0136](https://github.com/gohugoio/hugo/commit/06bd0136419ebd6727635716c7023494cc5a8257) [@coliff](https://github.com/coliff) 46 | * Remove test debug [fb3cb05c](https://github.com/gohugoio/hugo/commit/fb3cb05cc3dfc50370449f622fb0130ba7e0ced2) [@bep](https://github.com/bep) 47 | * Update dependencies [d07882df](https://github.com/gohugoio/hugo/commit/d07882dfb76a65cce79aaa6f27df71279cd30600) [@bep](https://github.com/bep) 48 | * Update Chroma [7f535671](https://github.com/gohugoio/hugo/commit/7f5356717d14079432365974e1424fc4ff5987c9) [@bep](https://github.com/bep) [#5025](https://github.com/gohugoio/hugo/issues/5025) 49 | * Remove alias of os.Stat [71931b30](https://github.com/gohugoio/hugo/commit/71931b30b1813b146aaa60f5cdab16c0f9ebebdb) [@satotake](https://github.com/satotake) 50 | * Renmae FileStat Stat [d40116e5](https://github.com/gohugoio/hugo/commit/d40116e5f941e4734ed3bed69dce8ffe11fc76b2) [@satotake](https://github.com/satotake) 51 | * Reduce allocation in the benchmark itself [a6b1eb1e](https://github.com/gohugoio/hugo/commit/a6b1eb1e9150aa5c1c86fe7424cc4167d6f59a5a) [@bep](https://github.com/bep) 52 | * Simplify the 0 transformer case [27110133](https://github.com/gohugoio/hugo/commit/27110133ffca05feae2e11a9ff28a9a00f613350) [@bep](https://github.com/bep) 53 | 54 | ## Fixes 55 | 56 | ### Templates 57 | 58 | * Fix compiling Amber templates that import other templates [37438757](https://github.com/gohugoio/hugo/commit/37438757788d279c839506d54f460b2ab37db164) [@Stebalien](https://github.com/Stebalien) 59 | * Reimplement the ".Params tolower" template transformer [5c538491](https://github.com/gohugoio/hugo/commit/5c5384916e8f954f3ea66148ecceb3732584588e) [@bep](https://github.com/bep) [#5068](https://github.com/gohugoio/hugo/issues/5068) 60 | 61 | ### Output 62 | 63 | * Fix Resource output in multihost setups [78f8475a](https://github.com/gohugoio/hugo/commit/78f8475a054a6277d37f13329afd240b00dc9408) [@bep](https://github.com/bep) [#5058](https://github.com/gohugoio/hugo/issues/5058) 64 | 65 | ### Core 66 | 67 | * Force render of any changed page, even in Fast Render Mode [22475460](https://github.com/gohugoio/hugo/commit/2247546017c00201d2ce1232dd5303295451f1cc) [@bep](https://github.com/bep) [#5083](https://github.com/gohugoio/hugo/issues/5083) 68 | * Add configFile(s) back to the watch list after REMOVE event [abc54080](https://github.com/gohugoio/hugo/commit/abc54080ec8c43e8989c081d934b59f0c9570c0b) [@anthonyfok](https://github.com/anthonyfok) [#4701](https://github.com/gohugoio/hugo/issues/4701) 69 | * Gracefully handle typos in server config when running the server [a655e00d](https://github.com/gohugoio/hugo/commit/a655e00d702dbc20b3961b131b33ab21841b043d) [@bep](https://github.com/bep) [#5081](https://github.com/gohugoio/hugo/issues/5081) 70 | * Fix shortcode output wrapped in p [78c99463](https://github.com/gohugoio/hugo/commit/78c99463fdd45c91af9933528d12d36a86dc6482) [@gllera](https://github.com/gllera) [#1642](https://github.com/gohugoio/hugo/issues/1642) 71 | * Adjust tests for shortcode p-issue [baa62d0a](https://github.com/gohugoio/hugo/commit/baa62d0abbbf24a17d0aa800a4bb217f026c49ad) [@bep](https://github.com/bep) [#1642](https://github.com/gohugoio/hugo/issues/1642) 72 | * Fix image cache-clearing for sub-languages [9d973004](https://github.com/gohugoio/hugo/commit/9d973004f5379cff2adda489566fe40683553c4c) [@bep](https://github.com/bep) [#5084](https://github.com/gohugoio/hugo/issues/5084) 73 | * Fix error when deleting a bundle in server mode [0a88741f](https://github.com/gohugoio/hugo/commit/0a88741fe85f4f7aedc02ed748dfeb8ccc073dbf) [@bep](https://github.com/bep) [#5077](https://github.com/gohugoio/hugo/issues/5077) 74 | * Fix Related when called from shortcode [0dd06bda](https://github.com/gohugoio/hugo/commit/0dd06bdac008aa81ec2e8f29ad8110dac0227011) [@bep](https://github.com/bep) [#5071](https://github.com/gohugoio/hugo/issues/5071) 75 | * Use the interface value when doing Related search [a6f199f7](https://github.com/gohugoio/hugo/commit/a6f199f7a640161333608b4a843d701f7e182829) [@bep](https://github.com/bep) [#5071](https://github.com/gohugoio/hugo/issues/5071) 76 | * Fix GitInfo when multiple content dirs [2182ecfd](https://github.com/gohugoio/hugo/commit/2182ecfd34a24521bf0e3c939627a55327eb1e19) [@bep](https://github.com/bep) [#5054](https://github.com/gohugoio/hugo/issues/5054) 77 | * Add multiple content dirs to GitInfo test site [e85833d8](https://github.com/gohugoio/hugo/commit/e85833d868a902840c5ed1c90713256153b2548b) [@bep](https://github.com/bep) [#5054](https://github.com/gohugoio/hugo/issues/5054) 78 | * Fix "adding a bundle" in server mode [d139a037](https://github.com/gohugoio/hugo/commit/d139a037d98e4b388687eecb7831758412247c58) [@bep](https://github.com/bep) [#5075](https://github.com/gohugoio/hugo/issues/5075) 79 | * Fix typo [c362634b](https://github.com/gohugoio/hugo/commit/c362634b7d8802ea81b0b4341c800a9f78f7cd7c) [@satotake](https://github.com/satotake) 80 | -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.43-relnotes/index.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | date: 2018-07-09 4 | title: "And Now: Hugo Pipes!" 5 | description: "Hugo 0.43 adds a powerful and simple to use assets pipeline with SASS/SCSS and much, much more …" 6 | categories: ["Releases"] 7 | --- 8 | 9 | Hugo `0.43` adds a powerful and very simple to use **Assets Pipeline** with **SASS and SCSS** with source map support, **PostCSS** and **minification** and **fingerprinting** and **Subresource Integrity** and ... much more. Oh, did we mention that you can now do **ad-hoc image processing** and execute text resources as Go templates? 10 | 11 | An example pipeline: 12 | 13 | ```go-html-template 14 | {{ $styles := resources.Get "scss/main.scss" | toCSS | postCSS | minify | fingerprint }} 15 | 16 | ``` 17 | 18 | To me, the above is beautiful in its speed and simplicity. It could be printed on a t-shirt. I wrote in the [Hugo Birthday Post](https://gohugo.io/news/lets-celebrate-hugos-5th-birthday/) some days ago about the value of a single binary with native and fast implementations. I should have added _simplicity_ as a keyword. There seem to be a misconception that all of this needs to be hard and painful. 19 | 20 | New functions to create `Resource` objects: 21 | 22 | * `resources.Get` 23 | * `resources.FromString`: Create a Resource from a string. 24 | 25 | New `Resource` transformation funcs: 26 | 27 | * `resources.ToCSS`: Compile `SCSS` or `SASS` into `CSS`. 28 | * `resources.PostCSS`: Process your CSS with PostCSS. Config file support (project or theme or passed as an option). 29 | * `resources.Minify`: Currently supports `css`, `js`, `json`, `html`, `svg`, `xml`. 30 | * `resources.Fingerprint`: Creates a fingerprinted version of the given Resource with Subresource Integrity. 31 | * `resources.Concat`: Concatenates a list of Resource objects. Think of this as a poor man's bundler. 32 | * `resources.ExecuteAsTemplate`: Parses and executes the given Resource and data context (e.g. .Site) as a Go template. 33 | 34 | 35 | I, [@bep](https://github.com/bep), implemented this in [dea71670](https://github.com/gohugoio/hugo/commit/dea71670c059ab4d5a42bd22503f18c087dd22d4). We will work hard to get the documentation up to date, but follow the links above for details, and also see this [demo project](https://github.com/bep/hugo-sass-test). 36 | 37 | 38 | This release represents **35 contributions by 7 contributors** to the main Hugo code base. 39 | [@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@anthonyfok](https://github.com/anthonyfok), [@openscript](https://github.com/openscript), and [@caarlos0](https://github.com/caarlos0) for their ongoing contributions. 40 | And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) for his great work on the documentation site. 41 | 42 | Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs), 43 | which has received **11 contributions by 5 contributors**. A special thanks to [@bep](https://github.com/bep), [@danrl](https://github.com/danrl), [@regisphilibert](https://github.com/regisphilibert), and [@digitalcraftsman](https://github.com/digitalcraftsman) for their work on the documentation site. 44 | 45 | Hugo now has: 46 | 47 | * 26968+ [stars](https://github.com/gohugoio/hugo/stargazers) 48 | * 443+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) 49 | * 238+ [themes](http://themes.gohugo.io/) 50 | 51 | ## Notes 52 | 53 | * Replace deprecated {Get,}ByPrefix with {Get,}Match [42ed6025](https://github.com/gohugoio/hugo/commit/42ed602580a672e420e1d860384e812f4871ff67) [@anthonyfok](https://github.com/anthonyfok) 54 | * Hugo is now released with two binary version: One with and one without SCSS/SASS support. At the time of writing, this is only available in the binaries on the GitHub release page. Brew, Snap builds etc. will come. But note that you **only need the extended version if you want to edit SCSS**. For your CI server, or if you don't use SCSS, you will most likely want the non-extended version. 55 | 56 | ## Enhancements 57 | 58 | ### Templates 59 | 60 | * Return en empty slice in `after` instead of error [f8212d20](https://github.com/gohugoio/hugo/commit/f8212d20009c4b5cc6e1ec733d09531eb6525d9f) [@bep](https://github.com/bep) [#4894](https://github.com/gohugoio/hugo/issues/4894) 61 | * Update internal pagination template to support Bootstrap 4 [ca1e46ef](https://github.com/gohugoio/hugo/commit/ca1e46efb94e3f3d2c8482cb9434d2f38ffd2683) [@bep](https://github.com/bep) [#4881](https://github.com/gohugoio/hugo/issues/4881) 62 | * Support text/template/parse API change in go1.11 [9f27091e](https://github.com/gohugoio/hugo/commit/9f27091e1067875e2577c331acc60adaef5bb234) [@anthonyfok](https://github.com/anthonyfok) [#4784](https://github.com/gohugoio/hugo/issues/4784) 63 | 64 | ### Core 65 | 66 | * Allow forward slash in shortcode names [de37455e](https://github.com/gohugoio/hugo/commit/de37455ec73cffd039b44e8f6c62d2884b1d6bbd) [@bep](https://github.com/bep) [#4886](https://github.com/gohugoio/hugo/issues/4886) 67 | * Reset the global pages cache on server rebuilds [128f14ef](https://github.com/gohugoio/hugo/commit/128f14efad90886ffef37c01ac1e20436a732f97) [@bep](https://github.com/bep) [#4845](https://github.com/gohugoio/hugo/issues/4845) 68 | 69 | ### Other 70 | 71 | * Bump CircleCI image [e3df6478](https://github.com/gohugoio/hugo/commit/e3df6478f09a7a5fed96aced791fa94fd2c35d1a) [@bep](https://github.com/bep) 72 | * Add Goreleaser extended config [626afc98](https://github.com/gohugoio/hugo/commit/626afc98254421f5a5edc97c541b10bd81d5bbbb) [@bep](https://github.com/bep) [#4908](https://github.com/gohugoio/hugo/issues/4908) 73 | * Build both hugo and hugo.extended for 0.43 [e1027c58](https://github.com/gohugoio/hugo/commit/e1027c5846b48c4ad450f6cc27e2654c9e0dae39) [@anthonyfok](https://github.com/anthonyfok) [#4908](https://github.com/gohugoio/hugo/issues/4908) 74 | * Add temporary build script [bfc3488b](https://github.com/gohugoio/hugo/commit/bfc3488b8e8b3dc1ffc6a339ee2dac8dcbdb55a9) [@bep](https://github.com/bep) 75 | * Add "extended" to "hugo version" [ce84b524](https://github.com/gohugoio/hugo/commit/ce84b524f4e94299b5b66afe7ce1a9bd4a9959fc) [@anthonyfok](https://github.com/anthonyfok) [#4913](https://github.com/gohugoio/hugo/issues/4913) 76 | * Add a newScratch template func [2b8d907a](https://github.com/gohugoio/hugo/commit/2b8d907ab731627f4e2a30442cd729064516c8bb) [@bep](https://github.com/bep) [#4685](https://github.com/gohugoio/hugo/issues/4685) 77 | * Add Hugo Piper with SCSS support and much more [dea71670](https://github.com/gohugoio/hugo/commit/dea71670c059ab4d5a42bd22503f18c087dd22d4) [@bep](https://github.com/bep) [#4381](https://github.com/gohugoio/hugo/issues/4381)[#4903](https://github.com/gohugoio/hugo/issues/4903)[#4858](https://github.com/gohugoio/hugo/issues/4858) 78 | * Consider root and current section's content type if set in front matter [c790029e](https://github.com/gohugoio/hugo/commit/c790029e1dbb0b66af18d05764bd6045deb2e180) [@bep](https://github.com/bep) [#4891](https://github.com/gohugoio/hugo/issues/4891) 79 | * Update docker image [554553c0](https://github.com/gohugoio/hugo/commit/554553c09c7657d28681e1fa0638806a452737a0) [@bep](https://github.com/bep) 80 | * Merge branch 'release-0.42.2' [282f6035](https://github.com/gohugoio/hugo/commit/282f6035e7c36f8550d91033e3a66718468c6c8b) [@bep](https://github.com/bep) 81 | * Release 0.42.2 [1637d12e](https://github.com/gohugoio/hugo/commit/1637d12e3762fc1ebab4cd675f75afaf25f59cdb) [@bep](https://github.com/bep) 82 | * Update GoReleaser config [1f0c4e1f](https://github.com/gohugoio/hugo/commit/1f0c4e1fb347bb233f3312c424fbf5a013c03604) [@caarlos0](https://github.com/caarlos0) 83 | * Create missing head.html partial on new theme generation [fd71fa89](https://github.com/gohugoio/hugo/commit/fd71fa89bd6c197402582c87b2b76d4b96d562bf) [@openscript](https://github.com/openscript) 84 | * Add html doctype to baseof.html template for new themes [b5a3aa70](https://github.com/gohugoio/hugo/commit/b5a3aa7082135d0a573f4fbb00f798e26b67b902) [@openscript](https://github.com/openscript) 85 | * Adds .gitattributes to force Go files to LF [6a2968fd](https://github.com/gohugoio/hugo/commit/6a2968fd5c0116d93de0f379ac615e9076821899) [@neurocline](https://github.com/neurocline) 86 | * Update to Go 1.9.7 and Go 1.10.3 [23d5fc82](https://github.com/gohugoio/hugo/commit/23d5fc82ee01d56440d0991c899acd31e9b63e27) [@anthonyfok](https://github.com/anthonyfok) 87 | * Update Dockerfile to a multi-stage build [8531ec7c](https://github.com/gohugoio/hugo/commit/8531ec7ca36fd35a57fba06bbb06a65c94dfd3ed) [@skoblenick](https://github.com/skoblenick) [#4154](https://github.com/gohugoio/hugo/issues/4154) 88 | * Release 0.42.1 [d67e843c](https://github.com/gohugoio/hugo/commit/d67e843c1212e1f53933556b5f946c8541188d9a) [@bep](https://github.com/bep) 89 | * Do not fail server build when /static is missing [34ee27a7](https://github.com/gohugoio/hugo/commit/34ee27a78b9e2b5f475d44253ae234067b76cc6e) [@bep](https://github.com/bep) [#4846](https://github.com/gohugoio/hugo/issues/4846) 90 | 91 | ## Fixes 92 | 93 | * Do not create paginator pages for the other output formats [43338c3a](https://github.com/gohugoio/hugo/commit/43338c3a99769eb7d0df0c12559b8b3d42b67dba) [@bep](https://github.com/bep) [#4890](https://github.com/gohugoio/hugo/issues/4890) 94 | * Fix the shortcodes/partials vs base template detection [a5d0a57e](https://github.com/gohugoio/hugo/commit/a5d0a57e6bdab583134a68c035aac9b3007f006a) [@bep](https://github.com/bep) [#4897](https://github.com/gohugoio/hugo/issues/4897) 95 | * nfpm replacements [e1a052ec](https://github.com/gohugoio/hugo/commit/e1a052ecb823c688406a8af97dfaaf52a75231da) [@caarlos0](https://github.com/caarlos0) 96 | * Fix typos [3cea2932](https://github.com/gohugoio/hugo/commit/3cea2932e17a08ebc19cd05f3079d9379bc8fba5) [@idealhack](https://github.com/idealhack) 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /exampleSite/content/posts/news/0.45-relnotes/index.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | date: 2018-07-22 4 | title: "Hugo 0.45: Revival of ref, relref and GetPage" 5 | description: "Hugo 0.45 adds relative page lookups, language support in ref/relref and several Hugo Pipes improvements." 6 | categories: ["Releases"] 7 | --- 8 | 9 | 10 | Hugo `0.45` is the **revival of ref, relref and GetPage**. [@vassudanagunta](https://github.com/vassudanagunta) and [@bep](https://github.com/bep) have done some great work improving the API and implementation for the helper functions used to **get one page**. Before this release, the API was a little bit clumsy and the result potentially ambiguous in some situations. 11 | 12 | Now you can simply do: 13 | 14 | ```go-html-template 15 | {{ with .Site.GetPage "/blog/my-post.md" }}{{ .Title }}{{ end }} 16 | ``` 17 | 18 | Or to get a section page: 19 | 20 | 21 | ```go-html-template 22 | {{ with .Site.GetPage "/blog" }}{{ .Title }}{{ end }} 23 | ``` 24 | 25 | We have also added a `.GetPage` method on `Page` and added support for page-relative linking. This means that the leading slash (`/`) now has a meaning. For `.Site.GetPage`, all lookups will start at the content root. But for lookups with a `Page` context, paths without a leading slash will be treated as relative to the page. 26 | 27 | This means that the following example will find the page in the current section: 28 | 29 | ```go-html-template 30 | {{}} 31 | ``` 32 | 33 | You can also use the `..` to refer to a page one level up etc.: 34 | 35 | ```go-html-template 36 | {{}} 37 | ``` 38 | 39 | We have now also added language support to `ref` and `relref`, so you can link to a page in another language: 40 | 41 | ```go-html-template 42 | {{}} 43 | ``` 44 | 45 | To link to a given Output Format of a document, you can use this syntax: 46 | 47 | ```go-html-template 48 | {{}} 49 | ``` 50 | 51 | To make working with these reflinks on bigger sites easier to work with, we have also improved the error logging, and added two new configuration settings: 52 | 53 | * refLinksErrorLevel: ERROR (default, will fail the build when a reflink cannot be resolved) or WARNING. 54 | * refLinksNotFoundURL: Set this to an URL placeholder used when no reference could be resolved. 55 | 56 | Visit the [Hugo Docs](https://gohugo.io/content-management/cross-references) for more information. 57 | 58 | We have also done some important improvements and fixes in **Hugo Pipes** in this release: SCSS source maps on Windows now works, we now support project-local `PostCSS` installation, and we have added `IncludePaths` to `SCSS` options, making it possible to include, say, a path below `node_modules` in the SASS/SCSS build. 59 | 60 | This release represents **31 contributions by 4 contributors** to the main Hugo code base. 61 | [@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@vassudanagunta](https://github.com/vassudanagunta), [@hairmare](https://github.com/hairmare), and [@garrmcnu](https://github.com/garrmcnu) for their ongoing contributions. 62 | And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) for his great work on the documentation site. 63 | 64 | Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs), 65 | which has received **10 contributions by 8 contributors**. A special thanks to [@kaushalmodi](https://github.com/kaushalmodi), [@Hanzei](https://github.com/Hanzei), [@KurtTrowbridge](https://github.com/KurtTrowbridge), and [@regisphilibert](https://github.com/regisphilibert) for their work on the documentation site. 66 | 67 | 68 | Hugo now has: 69 | 70 | * 27334+ [stars](https://github.com/gohugoio/hugo/stargazers) 71 | * 443+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) 72 | * 238+ [themes](http://themes.gohugo.io/) 73 | 74 | ## Notes 75 | * `.Site.GetPage` with more than 2 arguments will not work anymore. This means that `{{ .Site.GetPage "page" "blog" "my-post.md" }}` will fail. `{{ .Site.GetPage "page" "blog/my-post.md" }}` will work, but we recommend you use the simpler `{{ .Site.GetPage "/blog/my-post.md" }}` 76 | * Relative paths in `relref` or `ref` that finds its match not relative to the page itself will work, but we now print a warning saying that you should correct it to an absolute path. E.g. `{{}}` => `{{}}`. 77 | 78 | ## Enhancements 79 | 80 | * Print a WARNING about relative non-relative ref/relref matches [a451c49f](https://github.com/gohugoio/hugo/commit/a451c49fde1da6e2cc436a2b7d383ee772b1f893) [@bep](https://github.com/bep) [#4973](https://github.com/gohugoio/hugo/issues/4973) 81 | * Allow untyped nil to be merged in lang.Merge [ff16c42e](https://github.com/gohugoio/hugo/commit/ff16c42ed0965e1c8acf6e6a6dcda3ea50c107f2) [@bep](https://github.com/bep) [#4977](https://github.com/gohugoio/hugo/issues/4977) 82 | * Get rid of the utils package [062510cf](https://github.com/gohugoio/hugo/commit/062510cf1f7b79aed2efe88c5b9340d009bdec0e) [@bep](https://github.com/bep) 83 | * Update hugo_windows.go [4e1d0cd9](https://github.com/gohugoio/hugo/commit/4e1d0cd9f1d43d133d669a019a84117cadd41955) [@bep](https://github.com/bep) 84 | * Add IncludePaths config option [166483fe](https://github.com/gohugoio/hugo/commit/166483fe1227b0c59c6b4d88cfdfaf7d7b0d79c5) [@bep](https://github.com/bep) [#4921](https://github.com/gohugoio/hugo/issues/4921) 85 | * Increase refLinker test coverage [8278384b](https://github.com/gohugoio/hugo/commit/8278384b9680cfdcecef9c668638ad483012857f) [@vassudanagunta](https://github.com/vassudanagunta) 86 | * Add test coverage for recent ref overhaul [2bac3715](https://github.com/gohugoio/hugo/commit/2bac3715448e90e197ada7cc73c87f696c19def6) [@vassudanagunta](https://github.com/vassudanagunta) [#4969](https://github.com/gohugoio/hugo/issues/4969) 87 | * Update ref, relref, GetPage docs [1eb8b36b](https://github.com/gohugoio/hugo/commit/1eb8b36b3802e72bc2c16965461ef1899bb073b3) [@bep](https://github.com/bep) 88 | * Document refLinksErrorLevel and refLinksNotFoundURL [00c74ee7](https://github.com/gohugoio/hugo/commit/00c74ee7ffae71fd5f47d555160354a775e26151) [@bep](https://github.com/bep) [#4964](https://github.com/gohugoio/hugo/issues/4964) 89 | * Add configurable ref/relref error handling and notFoundURL [e25aa655](https://github.com/gohugoio/hugo/commit/e25aa655f4227ac064be5fe770d517a80acd46b2) [@bep](https://github.com/bep) [#4964](https://github.com/gohugoio/hugo/issues/4964) 90 | * Try node_modules/postcss-cli/bin/postcss first [ebe4d39f](https://github.com/gohugoio/hugo/commit/ebe4d39f175f73e4f130972cb3d74ef0af5d5761) [@bep](https://github.com/bep) [#4952](https://github.com/gohugoio/hugo/issues/4952) 91 | * Add optional lang as argument to rel/relref [d741064b](https://github.com/gohugoio/hugo/commit/d741064bebe2f4663a7ba12556dccc3dffe08629) [@bep](https://github.com/bep) [#4956](https://github.com/gohugoio/hugo/issues/4956) 92 | * Simplify .Site.GetPage etc. [3eb313fe](https://github.com/gohugoio/hugo/commit/3eb313fef495a39731dafa6bddbf77760090230d) [@bep](https://github.com/bep) [#4147](https://github.com/gohugoio/hugo/issues/4147)[#4727](https://github.com/gohugoio/hugo/issues/4727)[#4728](https://github.com/gohugoio/hugo/issues/4728)[#4728](https://github.com/gohugoio/hugo/issues/4728)[#4726](https://github.com/gohugoio/hugo/issues/4726)[#4652](https://github.com/gohugoio/hugo/issues/4652) 93 | * Unify page lookups [b93417aa](https://github.com/gohugoio/hugo/commit/b93417aa1d3d38a9e56bad25937e0e638a113faf) [@vassudanagunta](https://github.com/vassudanagunta) [#4147](https://github.com/gohugoio/hugo/issues/4147)[#4727](https://github.com/gohugoio/hugo/issues/4727)[#4728](https://github.com/gohugoio/hugo/issues/4728)[#4728](https://github.com/gohugoio/hugo/issues/4728)[#4726](https://github.com/gohugoio/hugo/issues/4726)[#4652](https://github.com/gohugoio/hugo/issues/4652) 94 | * Improve error message [4c240800](https://github.com/gohugoio/hugo/commit/4c240800a4275244c9e0847cd6707383180f1ac3) [@bep](https://github.com/bep) 95 | * Remove unused code [2f2bc7ff](https://github.com/gohugoio/hugo/commit/2f2bc7ff70b90fb11580cc092ef3883bf68d8ad7) [@bep](https://github.com/bep) 96 | 97 | ## Fixes 98 | 99 | * Avoid server panic on TOML mistake in i18n [75acff5f](https://github.com/gohugoio/hugo/commit/75acff5f20d0d41ffa1ae20402001c7a82f077cb) [@bep](https://github.com/bep) [#4942](https://github.com/gohugoio/hugo/issues/4942) 100 | * Only set 'allThemes' if there are themes in the config file [38204c4a](https://github.com/gohugoio/hugo/commit/38204c4ab6fa2aa2ab8bd06ddb3e07b66e5f9646) [@garrmcnu](https://github.com/garrmcnu) [#4851](https://github.com/gohugoio/hugo/issues/4851) 101 | * Fix potential server panic with drafts/future enabled [1ab4658c](https://github.com/gohugoio/hugo/commit/1ab4658c0d5ea2927f04bd748206e5b139a6326e) [@bep](https://github.com/bep) [#4965](https://github.com/gohugoio/hugo/issues/4965) 102 | * Mark shortcode changes as content changes in server mode [12679b40](https://github.com/gohugoio/hugo/commit/12679b408362a93a3c6159588d6291a3b7ed5548) [@bep](https://github.com/bep) [#4965](https://github.com/gohugoio/hugo/issues/4965) 103 | * Fix source maps on Windows [f01505c9](https://github.com/gohugoio/hugo/commit/f01505c910a325acc18742ac6b3637aa01975e37) [@bep](https://github.com/bep) [#4968](https://github.com/gohugoio/hugo/issues/4968) 104 | * Fix typo-logic bug in GetPage [b56d9a12](https://github.com/gohugoio/hugo/commit/b56d9a1294e692d096bff442e0b1fec61a8c2b0f) [@vassudanagunta](https://github.com/vassudanagunta) 105 | * Enable test case fixed by commit 501543d4 [d6fde8fa](https://github.com/gohugoio/hugo/commit/d6fde8fa131f3852fa98a8ec5c360e736486cf54) [@vassudanagunta](https://github.com/vassudanagunta) 106 | * Fix theme config for Work Fs [5c9d5413](https://github.com/gohugoio/hugo/commit/5c9d5413a4e2cc8d44a8b2d7dff04e6523ba2a29) [@bep](https://github.com/bep) [#4951](https://github.com/gohugoio/hugo/issues/4951) 107 | * Fix addkit link to account for i18n [fd1f4a78](https://github.com/gohugoio/hugo/commit/fd1f4a7860c4b989865b47c727239cf924a52fa4) [@hairmare](https://github.com/hairmare) 108 | -------------------------------------------------------------------------------- /assets/css/_common/_core/media.scss: -------------------------------------------------------------------------------- 1 | @media only screen and (min-device-width: 320px) and (max-device-width: 480px) { 2 | .navbar { 3 | display: none; 4 | } 5 | 6 | .navbar-mobile { 7 | display: block !important; 8 | position: fixed; 9 | width: 100%; 10 | z-index: 100; 11 | transition: all 0.6s ease 0s; 12 | .container { 13 | padding: 0; 14 | margin: 0; 15 | height: 5em; 16 | line-height: 5.5em; 17 | background: $light-background-color; 18 | 19 | 20 | .header-logo { 21 | font-weight: bold; 22 | font-family: monospace, monospace; 23 | } 24 | 25 | .logo_cursor { 26 | display: inline-block; 27 | width: 10px; 28 | height: 1rem; 29 | background: #fe5186; 30 | margin-left: 5px; 31 | border-radius: 1px; 32 | animation: cursor 1s infinite; 33 | } 34 | @media (prefers-reduced-motion: reduce) { 35 | .logo_cursor { 36 | animation: none; 37 | } 38 | } 39 | .navbar-header { 40 | display: flex; 41 | justify-content: space-between; 42 | align-items: center; 43 | width: 100%; 44 | padding-right: 1em; 45 | padding-left: 1em; 46 | box-sizing: border-box; 47 | 48 | .navbar-right { 49 | display: flex; 50 | align-items: center; 51 | i { 52 | padding: 0 8px; 53 | float: left; 54 | font-size: 30px; 55 | } 56 | } 57 | 58 | .menu-toggle { 59 | cursor: pointer; 60 | line-height: 5.5em; 61 | 62 | span { 63 | display: block; 64 | background: #000; 65 | width: 36px; 66 | height: 2px; 67 | -webkit-border-radius: 3px; 68 | -moz-border-radius: 3px; 69 | border-radius: 3px; 70 | -webkit-transition: .25s margin .25s, .25s transform; 71 | -moz-transition: .25s margin .25s, .25s transform; 72 | transition: .25s margin .25s, .25s transform; 73 | 74 | .dark-theme & { 75 | background: $dark-font-color; 76 | } 77 | } 78 | 79 | span:nth-child(1) { 80 | margin-bottom: 8px; 81 | } 82 | span:nth-child(3) { 83 | margin-top: 8px; 84 | } 85 | 86 | &.active { 87 | span { 88 | -webkit-transition: .25s margin, .25s transform .25s; 89 | -moz-transition: .25s margin, .25s transform .25s; 90 | transition: .25s margin, .25s transform .25s; 91 | } 92 | span:nth-child(1) { 93 | -moz-transform: rotate(45deg) translate(4px, 6px); 94 | -ms-transform: rotate(45deg) translate(4px, 6px); 95 | -webkit-transform: rotate(45deg) translate(4px, 6px); 96 | transform: rotate(45deg) translate(4px, 6px); 97 | } 98 | 99 | span:nth-child(2) { 100 | opacity: 0 101 | } 102 | 103 | span:nth-child(3) { 104 | -moz-transform: rotate(-45deg) translate(8px, -10px); 105 | -ms-transform: rotate(-45deg) translate(8px, -10px); 106 | -webkit-transform: rotate(-45deg) translate(8px, -10px); 107 | transform: rotate(-45deg) translate(8px, -10px); 108 | } 109 | } 110 | } 111 | } 112 | 113 | .menu { 114 | text-align: center; 115 | background: #ffffff; 116 | border-top: 2px solid #000000; 117 | padding-top: 1em; 118 | padding-bottom: 1em; 119 | display: none; 120 | box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.1); 121 | a { 122 | display: block; 123 | line-height: 2.5em; 124 | } 125 | 126 | &.active { 127 | display: block; 128 | } 129 | 130 | .dark-theme & { 131 | background: $dark-background-color; 132 | border-top: 2px solid $dark-font-secondary-color; 133 | } 134 | } 135 | .dark-theme & { 136 | background: $dark-background-color !important; 137 | } 138 | } 139 | } 140 | 141 | #dynamic-to-top { 142 | display: none !important; 143 | } 144 | .footer { 145 | height: 3rem; 146 | width: 100%; 147 | text-align: center; 148 | line-height: 1.5rem; 149 | padding-top: 2em; 150 | } 151 | 152 | .post-warp { 153 | padding-top: 6em; 154 | .archive-item-date { 155 | display: none; 156 | } 157 | .categories-card { 158 | .card-item { 159 | width: 95%; 160 | } 161 | } 162 | } 163 | } 164 | 165 | 166 | 167 | /* iPads (portrait and landscape) ----------- */ 168 | 169 | @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {} 170 | 171 | 172 | 173 | /* Desktops and laptops ----------- */ 174 | 175 | @media only screen and (min-width: 1224px) { 176 | .navbar-mobile { 177 | display: none; 178 | } 179 | } 180 | 181 | 182 | 183 | /* Large screens ----------- */ 184 | 185 | @media only screen and (min-width: 1824px) { 186 | /* Styles */ 187 | } 188 | 189 | 190 | 191 | /* Dark Mode */ 192 | 193 | @media (prefers-color-scheme: dark) { 194 | body { 195 | background-color: $dark-background-color; 196 | color: $dark-font-color; 197 | } 198 | 199 | a { 200 | color: $dark-global-link-color; 201 | text-decoration: none; 202 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 203 | 204 | &:hover{ 205 | color: $dark-global-link-hover-color; 206 | text-decoration: none; 207 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 208 | } 209 | } 210 | 211 | blockquote { 212 | background-color:$dark-blockquote-background-color; 213 | } 214 | 215 | .navbar { 216 | background-color: $dark-navbar-background-color; 217 | 218 | .navbar-right .active{ 219 | color: $dark-navbar-active-color; 220 | } 221 | } 222 | 223 | .navbar-mobile .container { 224 | 225 | background: $dark-background-color !important; 226 | 227 | .navbar-header .menu-toggle span { 228 | background: $dark-font-color; 229 | } 230 | 231 | .menu { 232 | background: $dark-background-color; 233 | border-top: 2px solid $dark-font-secondary-color; 234 | } 235 | } 236 | 237 | .post-warp { 238 | .post .post-footer { 239 | .post-meta a { 240 | color: $dark-font-secondary-color !important; 241 | 242 | &:hover { 243 | color: $dark-font-secondary-color !important; 244 | } 245 | } 246 | 247 | .post-tags span { 248 | color: $dark-font-secondary-color !important; 249 | 250 | a:hover { 251 | color: $dark-font-secondary-color !important; 252 | } 253 | } 254 | } 255 | 256 | .post-meta { 257 | color: $dark-font-secondary-color !important; 258 | 259 | a { 260 | color: $dark-post-link-color; 261 | 262 | &:hover { 263 | color: $dark-post-link-hover-color; 264 | } 265 | } 266 | } 267 | 268 | .post-content { 269 | h2::before, 270 | h3::before, 271 | a { 272 | color: $dark-post-link-color; 273 | } 274 | 275 | a:hover { 276 | color: $dark-post-link-hover-color; 277 | // font-weight: bold; 278 | text-decoration: underline; 279 | } 280 | 281 | code:not([class]) { 282 | background: $dark-code-notclass-background-color; 283 | } 284 | } 285 | 286 | .post-copyright { 287 | border-top: 1px solid $dark-border-color; 288 | border-bottom: 1px solid $dark-border-color; 289 | } 290 | 291 | .archive-item-link { 292 | color: $dark-global-link-color; 293 | text-decoration: none; 294 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 295 | 296 | &:hover { 297 | color: $dark-global-link-hover-color; 298 | text-decoration: none; 299 | transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease; 300 | } 301 | } 302 | 303 | .archive-item-date { 304 | color: $dark-font-secondary-color; 305 | } 306 | } 307 | 308 | .tag-cloud-tags { 309 | a { 310 | &:active, 311 | &:focus, 312 | &:hover { 313 | color: $dark-global-link-hover-color; 314 | } 315 | 316 | small { 317 | color: $dark-global-link-hover-color; 318 | } 319 | } 320 | } 321 | 322 | .dynamic-to-top { 323 | border: 1px solid $dark-border-color; 324 | } 325 | 326 | .pagination { 327 | li{ 328 | &:hover a { 329 | color: $dark-pagination-link-active-color; 330 | } 331 | 332 | &:before, 333 | &:after{ 334 | background: $dark-pagination-link-active-color; 335 | } 336 | 337 | &.active a { 338 | color: $dark-pagination-link-active-color; 339 | } 340 | } 341 | } 342 | } -------------------------------------------------------------------------------- /exampleSite/content/posts/goisforlovers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: (Hu)go Template Primer 3 | tags: ["go", "golang", "templates", "themes", "development"] 4 | categories: ["Uncategorized"] 5 | date: 2014-07-28 6 | --- 7 | 8 | Hugo uses the excellent [go][] [html/template][gohtmltemplate] library for 9 | its template engine. It is an extremely lightweight engine that provides a very 10 | small amount of logic. In our experience that it is just the right amount of 11 | logic to be able to create a good static website. If you have used other 12 | template systems from different languages or frameworks you will find a lot of 13 | similarities in go templates. 14 | 15 | This document is a brief primer on using go templates. The [go docs][gohtmltemplate] 16 | provide more details. 17 | 18 | ## Introduction to Go Templates 19 | 20 | Go templates provide an extremely simple template language. It adheres to the 21 | belief that only the most basic of logic belongs in the template or view layer. 22 | One consequence of this simplicity is that go templates parse very quickly. 23 | 24 | A unique characteristic of go templates is they are content aware. Variables and 25 | content will be sanitized depending on the context of where they are used. More 26 | details can be found in the [go docs][gohtmltemplate]. 27 | 28 | ## Basic Syntax 29 | 30 | Go lang templates are html files with the addition of variables and 31 | functions. 32 | 33 | **Go variables and functions are accessible within {{ }}** 34 | 35 | Accessing a predefined variable "foo": 36 | 37 | {{ foo }} 38 | 39 | **Parameters are separated using spaces** 40 | 41 | Calling the add function with input of 1, 2: 42 | 43 | {{ add 1 2 }} 44 | 45 | **Methods and fields are accessed via dot notation** 46 | 47 | Accessing the Page Parameter "bar" 48 | 49 | {{ .Params.bar }} 50 | 51 | **Parentheses can be used to group items together** 52 | 53 | {{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }} 54 | 55 | 56 | ## Variables 57 | 58 | Each go template has a struct (object) made available to it. In hugo each 59 | template is passed either a page or a node struct depending on which type of 60 | page you are rendering. More details are available on the 61 | [variables](/layout/variables) page. 62 | 63 | A variable is accessed by referencing the variable name. 64 | 65 | {{ .Title }} 66 | 67 | Variables can also be defined and referenced. 68 | 69 | {{ $address := "123 Main St."}} 70 | {{ $address }} 71 | 72 | 73 | ## Functions 74 | 75 | Go template ship with a few functions which provide basic functionality. The go 76 | template system also provides a mechanism for applications to extend the 77 | available functions with their own. [Hugo template 78 | functions](/layout/functions) provide some additional functionality we believe 79 | are useful for building websites. Functions are called by using their name 80 | followed by the required parameters separated by spaces. Template 81 | functions cannot be added without recompiling hugo. 82 | 83 | **Example:** 84 | 85 | {{ add 1 2 }} 86 | 87 | ## Includes 88 | 89 | When including another template you will pass to it the data it will be 90 | able to access. To pass along the current context please remember to 91 | include a trailing dot. The templates location will always be starting at 92 | the /layout/ directory within Hugo. 93 | 94 | **Example:** 95 | 96 | {{ template "chrome/header.html" . }} 97 | 98 | 99 | ## Logic 100 | 101 | Go templates provide the most basic iteration and conditional logic. 102 | 103 | ### Iteration 104 | 105 | Just like in go, the go templates make heavy use of range to iterate over 106 | a map, array or slice. The following are different examples of how to use 107 | range. 108 | 109 | **Example 1: Using Context** 110 | 111 | {{ range array }} 112 | {{ . }} 113 | {{ end }} 114 | 115 | **Example 2: Declaring value variable name** 116 | 117 | {{range $element := array}} 118 | {{ $element }} 119 | {{ end }} 120 | 121 | **Example 2: Declaring key and value variable name** 122 | 123 | {{range $index, $element := array}} 124 | {{ $index }} 125 | {{ $element }} 126 | {{ end }} 127 | 128 | ### Conditionals 129 | 130 | If, else, with, or, & and provide the framework for handling conditional 131 | logic in Go Templates. Like range, each statement is closed with `end`. 132 | 133 | 134 | Go Templates treat the following values as false: 135 | 136 | * false 137 | * 0 138 | * any array, slice, map, or string of length zero 139 | 140 | **Example 1: If** 141 | 142 | {{ if isset .Params "title" }}

{{ index .Params "title" }}

{{ end }} 143 | 144 | **Example 2: If -> Else** 145 | 146 | {{ if isset .Params "alt" }} 147 | {{ index .Params "alt" }} 148 | {{else}} 149 | {{ index .Params "caption" }} 150 | {{ end }} 151 | 152 | **Example 3: And & Or** 153 | 154 | {{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}} 155 | 156 | **Example 4: With** 157 | 158 | An alternative way of writing "if" and then referencing the same value 159 | is to use "with" instead. With rebinds the context `.` within its scope, 160 | and skips the block if the variable is absent. 161 | 162 | The first example above could be simplified as: 163 | 164 | {{ with .Params.title }}

{{ . }}

{{ end }} 165 | 166 | **Example 5: If -> Else If** 167 | 168 | {{ if isset .Params "alt" }} 169 | {{ index .Params "alt" }} 170 | {{ else if isset .Params "caption" }} 171 | {{ index .Params "caption" }} 172 | {{ end }} 173 | 174 | ## Pipes 175 | 176 | One of the most powerful components of go templates is the ability to 177 | stack actions one after another. This is done by using pipes. Borrowed 178 | from unix pipes, the concept is simple, each pipeline's output becomes the 179 | input of the following pipe. 180 | 181 | Because of the very simple syntax of go templates, the pipe is essential 182 | to being able to chain together function calls. One limitation of the 183 | pipes is that they only can work with a single value and that value 184 | becomes the last parameter of the next pipeline. 185 | 186 | A few simple examples should help convey how to use the pipe. 187 | 188 | **Example 1 :** 189 | 190 | {{ if eq 1 1 }} Same {{ end }} 191 | 192 | is the same as 193 | 194 | {{ eq 1 1 | if }} Same {{ end }} 195 | 196 | It does look odd to place the if at the end, but it does provide a good 197 | illustration of how to use the pipes. 198 | 199 | **Example 2 :** 200 | 201 | {{ index .Params "disqus_url" | html }} 202 | 203 | Access the page parameter called "disqus_url" and escape the HTML. 204 | 205 | **Example 3 :** 206 | 207 | {{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}} 208 | Stuff Here 209 | {{ end }} 210 | 211 | Could be rewritten as 212 | 213 | {{ isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" | if }} 214 | Stuff Here 215 | {{ end }} 216 | 217 | 218 | ## Context (aka. the dot) 219 | 220 | The most easily overlooked concept to understand about go templates is that {{ . }} 221 | always refers to the current context. In the top level of your template this 222 | will be the data set made available to it. Inside of a iteration it will have 223 | the value of the current item. When inside of a loop the context has changed. . 224 | will no longer refer to the data available to the entire page. If you need to 225 | access this from within the loop you will likely want to set it to a variable 226 | instead of depending on the context. 227 | 228 | **Example:** 229 | 230 | {{ $title := .Site.Title }} 231 | {{ range .Params.tags }} 232 |
  • {{ . }} - {{ $title }}
  • 233 | {{ end }} 234 | 235 | Notice how once we have entered the loop the value of {{ . }} has changed. We 236 | have defined a variable outside of the loop so we have access to it from within 237 | the loop. 238 | 239 | # Hugo Parameters 240 | 241 | Hugo provides the option of passing values to the template language 242 | through the site configuration (for sitewide values), or through the meta 243 | data of each specific piece of content. You can define any values of any 244 | type (supported by your front matter/config format) and use them however 245 | you want to inside of your templates. 246 | 247 | 248 | ## Using Content (page) Parameters 249 | 250 | In each piece of content you can provide variables to be used by the 251 | templates. This happens in the [front matter](/content/front-matter). 252 | 253 | An example of this is used in this documentation site. Most of the pages 254 | benefit from having the table of contents provided. Sometimes the TOC just 255 | doesn't make a lot of sense. We've defined a variable in our front matter 256 | of some pages to turn off the TOC from being displayed. 257 | 258 | Here is the example front matter: 259 | 260 | ``` 261 | --- 262 | title: "Permalinks" 263 | date: "2013-11-18" 264 | aliases: 265 | - "/doc/permalinks/" 266 | groups: ["extras"] 267 | groups_weight: 30 268 | notoc: true 269 | --- 270 | ``` 271 | 272 | Here is the corresponding code inside of the template: 273 | 274 | {{ if not .Params.notoc }} 275 |
    276 | {{ .TableOfContents }} 277 |
    278 | {{ end }} 279 | 280 | 281 | 282 | ## Using Site (config) Parameters 283 | In your top-level configuration file (eg, `config.yaml`) you can define site 284 | parameters, which are values which will be available to you in chrome. 285 | 286 | For instance, you might declare: 287 | 288 | ```yaml 289 | params: 290 | CopyrightHTML: "Copyright © 2013 John Doe. All Rights Reserved." 291 | TwitterUser: "spf13" 292 | SidebarRecentLimit: 5 293 | ``` 294 | 295 | Within a footer layout, you might then declare a `