├── exampleSite ├── layouts │ └── .gitkeep ├── static │ └── .gitkeep ├── content │ ├── contact.ja.md │ ├── contact.md │ ├── projects.ja.md │ ├── projects.md │ ├── posts │ │ ├── FeaturesOfCoderPortfolio.ja.md │ │ ├── FeaturesOfCoderPortfolio.md │ │ ├── theme-demo.ja.md │ │ ├── theme-demo.md │ │ ├── hugoisforlovers.md │ │ ├── migrate-from-jekyll.md │ │ ├── goisforlovers.md │ │ └── creating-a-new-theme.md │ ├── about.ja.md │ └── about.md └── config.toml ├── .gitignore ├── images ├── tn.png ├── avatar.jpg ├── screenshot.png └── logos │ ├── favicon.png │ ├── logomark.png │ ├── logotype-a.png │ ├── logotype-b.png │ ├── logomark.svg │ ├── favicon.svg │ ├── logotype-a.svg │ └── logotype-b.svg ├── layouts ├── 404.html ├── index.html ├── shortcodes │ ├── private.html │ └── portfolio.html ├── partials │ ├── page.html │ ├── 404.html │ ├── list.html │ ├── home.html │ ├── post.html │ ├── pagination.html │ ├── header.html │ └── footer.html ├── _default │ ├── list.html │ ├── single.html │ └── baseof.html └── posts │ └── single.html ├── static ├── images │ ├── tn.png │ ├── avatar.jpg │ ├── favicon-16x16.png │ └── favicon-32x32.png ├── less │ ├── colors.less │ ├── style-rtl.less │ ├── normalize.less │ └── style.less └── css │ ├── style-rtl.min.css │ ├── normalize.min.css │ └── style.min.css ├── archetypes ├── default.md └── posts.md ├── .editorconfig ├── theme.toml ├── LICENSE.md ├── Makefile └── README.md /exampleSite/layouts/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exampleSite/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/themes/ 2 | demo/ 3 | -------------------------------------------------------------------------------- /images/tn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/images/tn.png -------------------------------------------------------------------------------- /layouts/404.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 | {{ partial "404.html" . }} 3 | {{ end }} 4 | -------------------------------------------------------------------------------- /layouts/index.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 | {{ partial "home.html" . }} 3 | {{ end }} 4 | -------------------------------------------------------------------------------- /images/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/images/avatar.jpg -------------------------------------------------------------------------------- /images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/images/screenshot.png -------------------------------------------------------------------------------- /static/images/tn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/static/images/tn.png -------------------------------------------------------------------------------- /images/logos/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/images/logos/favicon.png -------------------------------------------------------------------------------- /static/images/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/static/images/avatar.jpg -------------------------------------------------------------------------------- /images/logos/logomark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/images/logos/logomark.png -------------------------------------------------------------------------------- /images/logos/logotype-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/images/logos/logotype-a.png -------------------------------------------------------------------------------- /images/logos/logotype-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/images/logos/logotype-b.png -------------------------------------------------------------------------------- /static/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/static/images/favicon-16x16.png -------------------------------------------------------------------------------- /static/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naro143/hugo-coder-portfolio/HEAD/static/images/favicon-32x32.png -------------------------------------------------------------------------------- /static/less/colors.less: -------------------------------------------------------------------------------- 1 | @bg-color: #fefefe; 2 | @fg-color: #323232; 3 | @darker-bg-color: #dcdcdc; 4 | @darker-fg-color: #000; 5 | @link-color: #3366CC; 6 | -------------------------------------------------------------------------------- /archetypes/default.md: -------------------------------------------------------------------------------- 1 | +++ 2 | draft = true 3 | date = {{ .Date }} 4 | title = "" 5 | slug = "" 6 | thumbnail = "{{ .Site.Params.thumbnail }}" 7 | description = "" 8 | +++ 9 | -------------------------------------------------------------------------------- /layouts/shortcodes/private.html: -------------------------------------------------------------------------------- 1 | {{ $_hugo_config := `{ "version": 1 }` }} 2 |
3 |
4 | {{ .Inner }} 5 |
6 |
-------------------------------------------------------------------------------- /layouts/partials/page.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

{{ .Title }}

5 |
6 | 7 | {{ .Content }} 8 |
9 |
10 | -------------------------------------------------------------------------------- /archetypes/posts.md: -------------------------------------------------------------------------------- 1 | +++ 2 | draft = true 3 | date = {{ .Date }} 4 | title = "" 5 | slug = "" 6 | tags = [] 7 | categories = [] 8 | thumbnail = "{{ .Site.Params.thumbnail }}" 9 | description = "" 10 | +++ 11 | -------------------------------------------------------------------------------- /layouts/_default/list.html: -------------------------------------------------------------------------------- 1 | {{ define "og-title" }} 2 | {{ .Title }} - {{ .Site.Title }} 3 | {{ end }} 4 | {{ define "title" }} 5 | {{ .Title }} - {{ .Site.Title }} 6 | {{ end }} 7 | {{ define "content" }} 8 | {{ partial "list.html" . }} 9 | {{ end }} 10 | -------------------------------------------------------------------------------- /layouts/_default/single.html: -------------------------------------------------------------------------------- 1 | {{ define "og-title" }} 2 | {{ .Title }} - {{ .Site.Title }} 3 | {{ end }} 4 | {{ define "title" }} 5 | {{ .Title }} - {{ .Site.Title }} 6 | {{ end }} 7 | {{ define "content" }} 8 | {{ partial "page.html" . }} 9 | {{ end }} 10 | -------------------------------------------------------------------------------- /layouts/posts/single.html: -------------------------------------------------------------------------------- 1 | {{ define "og-title" }} 2 | {{ .Title }} - {{ .Site.Title }} 3 | {{ end }} 4 | {{ define "title" }} 5 | {{ .Title }} - {{ .Site.Title }} 6 | {{ end }} 7 | {{ define "content" }} 8 | {{ partial "post.html" . }} 9 | {{ end }} 10 | -------------------------------------------------------------------------------- /layouts/partials/404.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

404

4 |

Page Not Found

5 |

Sorry, this page does not exist.
You can head back to homepage.

6 |
7 |
8 | -------------------------------------------------------------------------------- /exampleSite/content/contact.ja.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Contact" 3 | slug = "contact" 4 | thumbnail = "images/tn.png" 5 | description = "contact" 6 | +++ 7 | 8 | ## 連絡をとりたいですか? 9 | 10 | 質問や報告などの連絡は下記からお願いします。 11 | 12 | * [open an issue on GitHub](https://github.com/naro143/hugo-coder-portfolio/issues/new) 13 | * [ask me on Twitter](https://twitter.com/naro143) -------------------------------------------------------------------------------- /exampleSite/content/contact.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Contact" 3 | slug = "contact" 4 | thumbnail = "images/tn.png" 5 | description = "contact" 6 | +++ 7 | 8 | ## Want Contact? 9 | 10 | Have questions or suggestions? Feel free to [open an issue on GitHub](https://github.com/naro143/hugo-coder-portfolio/issues/new) or [ask me on Twitter](https://twitter.com/naro143). -------------------------------------------------------------------------------- /exampleSite/content/projects.ja.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Projects" 3 | slug = "projects" 4 | thumbnail = "images/tn.png" 5 | description = "projects" 6 | +++ 7 | 8 | ## Portfolio Demo 9 | 10 | {{% portfolio image="/images/tn.png" alt="Coder Portfolio" %}} 11 | 12 | ## Coder Portfolio 13 | 14 | hugo-coderを元に作成しました。 15 | より自分を伝えられるようにしました。 16 | {{% /portfolio %}} -------------------------------------------------------------------------------- /layouts/partials/list.html: -------------------------------------------------------------------------------- 1 |
2 |

{{ .Title }}

3 | 10 | {{ partial "pagination.html" . }} 11 |
12 | -------------------------------------------------------------------------------- /exampleSite/content/projects.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Projects" 3 | slug = "projects" 4 | thumbnail = "images/tn.png" 5 | description = "projects" 6 | +++ 7 | 8 | ## Portfolio Demo 9 | 10 | {{% portfolio image="/images/tn.png" alt="Coder Portfolio" %}} 11 | 12 | ## Coder Portfolio 13 | 14 | This theme is created based on hugo-coder. 15 | I made it possible to tell yourself more by my change. 16 | {{% /portfolio %}} -------------------------------------------------------------------------------- /static/css/style-rtl.min.css: -------------------------------------------------------------------------------- 1 | body.rtl{direction:rtl}body.rtl blockquote{border-right:2px solid #dcdcdc;padding-right:1.6rem}body.rtl table tr td:first-child,body.rtl table tr th:first-child{border-right:0}body.rtl table tr td:last-child,body.rtl table tr th:last-child{border-left:0}body.rtl .navigation ul li{float:right}body.rtl .list ul li span{text-align:left;margin-left:3rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){body.rtl .list ul li span{text-align:right}} 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | # this file is the top-most editorconfig file 4 | root = true 5 | 6 | # all files 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_style = space 11 | indent_size = 4 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | 15 | # markdown files 16 | [*.md] 17 | insert_final_newline = false 18 | trim_trailing_whitespace = false 19 | 20 | # configuration files 21 | [*.toml] 22 | indent_size = 2 23 | 24 | # web files 25 | [*.{html,css,less}] 26 | indent_size = 2 27 | 28 | [Makefile] 29 | indent_style = tab 30 | -------------------------------------------------------------------------------- /layouts/shortcodes/portfolio.html: -------------------------------------------------------------------------------- 1 | {{ $_hugo_config := `{ "version": 1 }` }} 2 | {{ if .IsNamedParams }} 3 | {{ $.Scratch.Add "image" ( .Get "image") }} 4 | {{ $.Scratch.Add "alt" ( .Get "alt") }} 5 | {{ else }} 6 | {{ $.Scratch.Add "image" "" }} 7 | {{ $.Scratch.Add "alt" "" }} 8 | {{ end }} 9 | 10 | {{ $image := $.Scratch.Get "image" }} 11 | {{ $alt := $.Scratch.Get "alt" }} 12 | 13 |
14 |
15 |
{{ $alt }}
16 |
17 | {{ .Inner }} 18 |
19 |
20 |
-------------------------------------------------------------------------------- /exampleSite/content/posts/FeaturesOfCoderPortfolio.ja.md: -------------------------------------------------------------------------------- 1 | +++ 2 | date = "2018-08-03" 3 | title = "CoderPortfolioの特徴" 4 | math = "true" 5 | 6 | +++ 7 | 8 | ## 変更点 9 | 10 | ### ShortCode "private content"を追加しました 11 | 12 | 綺麗なサイトを崩さずに、あなたの個人的なコンテンツ(趣味や感情)を簡単に伝えることができます。 13 | 実際の動きについては、"テーマデモ"をご覧ください。 14 | 15 | ### リンクに赤い下線のアニメーションを追加しました 16 | 17 | サイトがよりカラフルに美しくなりました。 18 | 19 | ### SNSシェアのボタンを追加しました 20 | 21 | あなたの記事がより影響力を持つようになりました。 22 | 23 | ### コードのハイライトを変更しました 24 | 25 | 日本のサービス [Qiita](https://qiita.com/) のハイライトを参照しました。 26 | とても優しく美しいハイライトです。 27 | 28 | ### ヘッダーに影を追加しました 29 | 30 | より境界線がはっきりしました。 31 | 32 | ### ShortCode "portfolio"を追加しました 33 | 34 | あなたの作品を綺麗に表示できるようになりました。 35 | 実際の動きについては、"テーマデモ"をご覧ください。 -------------------------------------------------------------------------------- /theme.toml: -------------------------------------------------------------------------------- 1 | name = "Coder Portfolio" 2 | license = "MIT" 3 | licenselink = "https://github.com/naro143/hugo-coder-portfolio/blob/master/LICENSE.md" 4 | description = "It is a theme to have you know yourself than developed based on hugo-coder" 5 | homepage = "https://github.com/naro143/hugo-coder-portfolio" 6 | tags = [ 7 | "blog", 8 | "minimal", 9 | "minimalist", 10 | "responsive", 11 | "simple", 12 | "clean", 13 | "personal" 14 | ] 15 | features = [ 16 | "analytics", 17 | "favicon", 18 | "pagination", 19 | "single-column", 20 | "syntax-highlighting" 21 | ] 22 | min_version = "0.32" 23 | 24 | [author] 25 | name = "Yusuke Ishimi" 26 | homepage = "https://naro143.github.io" 27 | 28 | [original] 29 | author = "Luiz F. A. de Prá" 30 | homepage = "https://luizdepra.com" 31 | repo = "https://github.com/luizdepra/hugo-coder" -------------------------------------------------------------------------------- /layouts/partials/home.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | {{ with .Site.Params.avatarurl }} 4 |
avatar
5 | {{ end }} 6 |

{{ .Site.Params.author }}

7 |

{{ .Site.Params.info }}

8 | {{ with .Site.Params.social }} 9 | 22 | {{ end }} 23 |
24 |
25 | -------------------------------------------------------------------------------- /static/less/style-rtl.less: -------------------------------------------------------------------------------- 1 | @import "colors.less"; 2 | 3 | body.rtl { 4 | direction: rtl; 5 | 6 | blockquote { 7 | border-right: 2px solid @darker-bg-color; 8 | padding-right: 1.6rem; 9 | } 10 | 11 | table tr td:first-child, 12 | table tr th:first-child { 13 | border-right: 0; 14 | } 15 | table tr td:last-child, 16 | table tr th:last-child { 17 | border-left: 0; 18 | } 19 | 20 | .navigation { 21 | ul { 22 | li { 23 | float: right; 24 | } 25 | } 26 | } 27 | 28 | .list { 29 | ul { 30 | li { 31 | span { 32 | text-align: left; 33 | margin-left: 3.0rem; 34 | @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { 35 | text-align: right; 36 | } 37 | } 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /images/logos/logomark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /exampleSite/content/posts/FeaturesOfCoderPortfolio.md: -------------------------------------------------------------------------------- 1 | +++ 2 | date = "2018-08-03" 3 | title = "Features Of CoderPortfolio" 4 | math = "true" 5 | 6 | +++ 7 | 8 | ## Change Point 9 | 10 | ### "private content" short code added. 11 | 12 | It is now possible to communicate your personal hobby and your own content. 13 | You can use it easily. 14 | Please see "theme-demo" for details and demo. 15 | 16 | ### An animation of red underline was added to Anchor. 17 | 18 | The site became a little fun and colorful. 19 | 20 | ### The button of the SNS share was added. 21 | 22 | It became to have an influence when writing articles more. 23 | 24 | ### Changed the color scheme of code highlight. 25 | 26 | I am referring to the color scheme of service [Qiita](https://qiita.com/) in Japan. 27 | This color scheme is gentle and wonderful. 28 | 29 | ### I shadowed Navigation. 30 | 31 | I made the boundary clearer. 32 | 33 | ### "portfolio" short code added. 34 | 35 | It is now possible to communicate your portfolio. 36 | You can use it easily. 37 | Please see "theme-demo" for details and demo. -------------------------------------------------------------------------------- /images/logos/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Yusuke Ishimi 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 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # LESS params 2 | LESS_DIR = ./static/less 3 | LESS_FILE = style.less 4 | LESS_RTL_FILE = style-rtl.less 5 | LESS_NORMALIZE_FILE = normalize.less 6 | 7 | # CSS params 8 | CSS_DIR = ./static/css 9 | CSS_FILE = style.min.css 10 | CSS_RTL_FILE = style-rtl.min.css 11 | CSS_TMP_FILE = tmp.css 12 | CSS_NORMALIZE_FILE = normalize.min.css 13 | 14 | define build_less 15 | lessc $(LESS_DIR)/$(1) > $(CSS_DIR)/$(CSS_TMP_FILE) 16 | uglifycss $(CSS_DIR)/$(CSS_TMP_FILE) > $(CSS_DIR)/$(2) 17 | rm -f $(CSS_DIR)/$(CSS_TMP_FILE) 18 | endef 19 | 20 | .PHONY: clean demo build build-ltr build-rtl build-normalize 21 | 22 | build: clean build-ltr build-rtl build-normalize 23 | 24 | build-ltr: 25 | $(call build_less,$(LESS_FILE),$(CSS_FILE)) 26 | 27 | build-rtl: 28 | $(call build_less,$(LESS_RTL_FILE),$(CSS_RTL_FILE)) 29 | 30 | build-normalize: 31 | $(call build_less,$(LESS_NORMALIZE_FILE),$(CSS_NORMALIZE_FILE)) 32 | 33 | demo: build 34 | mkdir -p demo/themes/coder-portfolio 35 | rsync -av exampleSite/* demo 36 | rsync -av --exclude='demo' --exclude='exampleSite' --exclude='.git' . demo/themes/coder-portfolio 37 | cd demo && hugo serve -D 38 | 39 | clean: 40 | rm -f $(CSS_DIR)/*.css 41 | rm -rf demo 42 | -------------------------------------------------------------------------------- /exampleSite/content/about.ja.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "About Hugo" 3 | slug = "about" 4 | thumbnail = "images/tn.png" 5 | description = "about" 6 | +++ 7 | 8 | --------------------------- 9 | このテーマは[hugo-coder](https://github.com/luizdepra/hugo-coder)を元に作成をしています。 10 | 一見綺麗なポートフォリをサイトですが、より個人的なことも伝えられるようにしました。 11 | 変更点の詳細はブログから、"FeaturesOfCoderPortfolio"を見てください。 12 | それ以外のDEMOのコンテンツに関してはhugo-coderのものです。 13 | 質問や、報告がありましたら、下記からお願いいたします。 14 | 15 | * [open an issue on GitHub](https://github.com/naro143/hugo-coder-portfolio/issues/new) 16 | * [ask me on Twitter](https://twitter.com/naro143) 17 | 18 | --------------------------- 19 | 20 | Hugo is a static site engine written in Go. 21 | 22 | 23 | It makes use of a variety of open source projects including: 24 | 25 | * [Cobra](https://github.com/spf13/cobra) 26 | * [Viper](https://github.com/spf13/viper) 27 | * [J Walter Weatherman](https://github.com/spf13/jWalterWeatherman) 28 | * [Cast](https://github.com/spf13/cast) 29 | 30 | Learn more and contribute on [GitHub](https://github.com/spf13). 31 | 32 | ## Setup 33 | 34 | Some fun facts about [Hugo](http://gohugo.io/): 35 | 36 | * Built in [Go](http://golang.org/) 37 | * Loosely inspired by [Jekyll](http://jekyllrb.com/) 38 | * Primarily developed by [spf13](http://spf13.com/) on the train while commuting to and from Manhattan. 39 | * Coded in [Vim](http://vim.org) using [spf13-vim](http://vim.spf13.com/) 40 | 41 | Have questions or suggestions? Feel free to [open an issue on GitHub](https://github.com/spf13/hugo/issues/new) or [ask me on Twitter](https://twitter.com/spf13). 42 | 43 | Thanks for reading! 44 | -------------------------------------------------------------------------------- /layouts/partials/post.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

{{ .Title }}

5 |

{{ .Date.Format "January 2, 2006" }}

6 | 7 | {{ if eq .Params.math "true" }} 8 | 30 | {{ end }} 31 |
32 | 33 | {{ .Content }} 34 |
35 | 36 |
37 | 38 | {{ if and (not (eq .Site.DisqusShortname "" )) (eq (.Params.disable_comments | default false) false)}} 39 | {{ template "_internal/disqus.html" . }} 40 | {{ end }} 41 | 42 |
-------------------------------------------------------------------------------- /exampleSite/content/about.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "About Hugo" 3 | slug = "about" 4 | thumbnail = "images/tn.png" 5 | description = "about" 6 | +++ 7 | 8 | --------------------------- 9 | This theme is created based on [hugo-coder](https://github.com/luizdepra/hugo-coder). 10 | I made it possible to tell yourself more by my change. 11 | Please see "FeaturesOfCoderPortfolio" in the post about the change. 12 | Regarding other demo contents, it is hugo-coder's thing. 13 | Have questions or suggestions? Feel free to [open an issue on GitHub](https://github.com/naro143/hugo-coder-portfolio/issues/new) or [ask me on Twitter](https://twitter.com/naro143). 14 | 15 | --------------------------- 16 | 17 | Hugo is a static site engine written in Go. 18 | 19 | 20 | It makes use of a variety of open source projects including: 21 | 22 | * [Cobra](https://github.com/spf13/cobra) 23 | * [Viper](https://github.com/spf13/viper) 24 | * [J Walter Weatherman](https://github.com/spf13/jWalterWeatherman) 25 | * [Cast](https://github.com/spf13/cast) 26 | 27 | Learn more and contribute on [GitHub](https://github.com/spf13). 28 | 29 | ## Setup 30 | 31 | Some fun facts about [Hugo](http://gohugo.io/): 32 | 33 | * Built in [Go](http://golang.org/) 34 | * Loosely inspired by [Jekyll](http://jekyllrb.com/) 35 | * Primarily developed by [spf13](http://spf13.com/) on the train while commuting to and from Manhattan. 36 | * Coded in [Vim](http://vim.org) using [spf13-vim](http://vim.spf13.com/) 37 | 38 | Have questions or suggestions? Feel free to [open an issue on GitHub](https://github.com/spf13/hugo/issues/new) or [ask me on Twitter](https://twitter.com/spf13). 39 | 40 | Thanks for reading! 41 | -------------------------------------------------------------------------------- /static/css/normalize.min.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:0;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} 2 | -------------------------------------------------------------------------------- /layouts/partials/pagination.html: -------------------------------------------------------------------------------- 1 | {{ $paginator := .Paginator }} 2 | {{ $adjacent_links := 2 }} 3 | {{ $max_links := (add (mul $adjacent_links 2) 1) }} 4 | {{ $lower_limit := (add $adjacent_links 1) }} 5 | {{ $upper_limit := (sub $paginator.TotalPages $adjacent_links) }} 6 | {{ if gt $paginator.TotalPages 1 }} 7 | 48 | {{ end }} 49 | -------------------------------------------------------------------------------- /layouts/partials/header.html: -------------------------------------------------------------------------------- 1 | 43 | -------------------------------------------------------------------------------- /exampleSite/content/posts/theme-demo.ja.md: -------------------------------------------------------------------------------- 1 | +++ 2 | date = "2018-08-03" 3 | title = "テーマデモ" 4 | math = "true" 5 | 6 | +++ 7 | 8 | ## Style Demo 9 | 10 | # h1 Heading 11 | ## h2 Heading 12 | ### h3 Heading 13 | #### h4 Heading 14 | ##### h5 Heading 15 | ###### h6 Heading 16 | 17 | 18 | --- 19 | 20 | **This is bold text** 21 | 22 | __This is bold text__ 23 | 24 | *This is italic text* 25 | 26 | _This is italic text_ 27 | 28 | ~~Deleted text~~ 29 | 30 | This is text with inline math $\sum_{n=1}^{\infty} 2^{-n} = 1$ and with math blocks: 31 | 32 | $$ 33 | \sum_{n=1}^{\infty} 2^{-n} = 1 34 | $$ 35 | 36 | | Heading | Another heading | 37 | | :----: | :-------------: | 38 | | text | text | 39 | | text | text | 40 | | text | text | 41 | 42 | > Block quotes are 43 | > written like so. 44 | > 45 | > They can span multiple paragraphs, 46 | > if you like. 47 | 48 | Some text, and some `code` and then a nice plain [link with title](https://github.com/davidhampgonsalves/davidhampgonsalves.com-hugo "title text!"). 49 | 50 | and then 51 | 52 | + Create a list by starting a line with `+`, `-`, or `*` 53 | + Sub-lists are made by indenting 2 spaces: 54 | - Marker character change forces new list start: 55 | * Ac tristique libero volutpat at 56 | + Very easy! 57 | 58 | vs. 59 | 60 | 1. Lorem ipsum dolor sit amet 61 | 2. Consectetur adipiscing elit 62 | 3. Integer molestie lorem at massa 63 | 64 | ## Code 65 | 66 | Inline `code` 67 | 68 | ``` js 69 | var foo = function (bar) { 70 | return bar++; 71 | }; 72 | 73 | console.log(foo(5)); 74 | ``` 75 | 76 | ## Private Content 77 | 78 | プライベートな内容をこのShortCodeで作成できます。 79 | 80 | ``` 81 | {% private %} 82 | ここにプライベートな内容を書きます。 83 | {% /private %} 84 | ``` 85 | 86 | 実際に使用するときには、ShortCodeをさらに{}で囲ってください。 87 | 88 | ## Private Content Demo 89 | 90 | 下付きのバーの'Click'をクリックしてください。 91 | プライベートな内容が下に表示されます。 92 | 93 | {{% private %}} 94 | ## Private Content 95 | プライベートな内容です。 96 | {{% /private %}} 97 | 98 | ## Portfolio Content 99 | 100 | ポートフォリオをこのShortCodeで作成できます。 101 | 102 | ``` 103 | {% portfolio image="/images/tn.png" alt="Coder Portfolio" %} 104 | 作品の説明。 105 | {% /portfolio %} 106 | ``` 107 | 108 | 実際に使用するときには、ShortCodeをさらに{}で囲ってください。 109 | 110 | ## Portfolio Content Demo 111 | 112 | "プロジェクト"を見てください。 -------------------------------------------------------------------------------- /exampleSite/content/posts/theme-demo.md: -------------------------------------------------------------------------------- 1 | +++ 2 | date = "2018-08-03" 3 | title = "Theme Demo" 4 | math = "true" 5 | 6 | +++ 7 | 8 | ## Style Demo 9 | 10 | # h1 Heading 11 | ## h2 Heading 12 | ### h3 Heading 13 | #### h4 Heading 14 | ##### h5 Heading 15 | ###### h6 Heading 16 | 17 | 18 | --- 19 | 20 | **This is bold text** 21 | 22 | __This is bold text__ 23 | 24 | *This is italic text* 25 | 26 | _This is italic text_ 27 | 28 | ~~Deleted text~~ 29 | 30 | This is text with inline math $\sum_{n=1}^{\infty} 2^{-n} = 1$ and with math blocks: 31 | 32 | $$ 33 | \sum_{n=1}^{\infty} 2^{-n} = 1 34 | $$ 35 | 36 | | Heading | Another heading | 37 | | :----: | :-------------: | 38 | | text | text | 39 | | text | text | 40 | | text | text | 41 | 42 | > Block quotes are 43 | > written like so. 44 | > 45 | > They can span multiple paragraphs, 46 | > if you like. 47 | 48 | Some text, and some `code` and then a nice plain [link with title](https://github.com/davidhampgonsalves/davidhampgonsalves.com-hugo "title text!"). 49 | 50 | and then 51 | 52 | + Create a list by starting a line with `+`, `-`, or `*` 53 | + Sub-lists are made by indenting 2 spaces: 54 | - Marker character change forces new list start: 55 | * Ac tristique libero volutpat at 56 | + Very easy! 57 | 58 | vs. 59 | 60 | 1. Lorem ipsum dolor sit amet 61 | 2. Consectetur adipiscing elit 62 | 3. Integer molestie lorem at massa 63 | 64 | ## Code 65 | 66 | Inline `code` 67 | 68 | ``` js 69 | var foo = function (bar) { 70 | return bar++; 71 | }; 72 | 73 | console.log(foo(5)); 74 | ``` 75 | 76 | ## Private Content 77 | 78 | You can create private content with this short code 79 | 80 | ``` 81 | {% private %} 82 | Write private content here 83 | {% /private %} 84 | ``` 85 | 86 | When using for inspection, please add "{}" so that you can see the notation of shortcode 87 | 88 | ## Private Content Demo 89 | 90 | Please click on fixed bottom bar 'Click' 91 | private content is displayed here 92 | 93 | {{% private %}} 94 | ## Private Content 95 | This is private content 96 | {{% /private %}} 97 | 98 | ## Portfolio Content 99 | 100 | You can create portfolio content with this short code 101 | 102 | ``` 103 | {% portfolio image="/images/tn.png" alt="Coder Portfolio" %} 104 | Write portfolio content here 105 | {% /portfolio %} 106 | ``` 107 | 108 | When using for inspection, please add "{}" so that you can see the notation of shortcode 109 | 110 | ## Portfolio Content Demo 111 | 112 | Please see "projects" for demo. -------------------------------------------------------------------------------- /exampleSite/content/posts/hugoisforlovers.md: -------------------------------------------------------------------------------- 1 | +++ 2 | date = "2014-04-02" 3 | title = "Getting Started with Hugo" 4 | tags = [ 5 | "go", 6 | "golang", 7 | "hugo", 8 | "development", 9 | ] 10 | categories = [ 11 | "Development", 12 | "golang", 13 | ] 14 | +++ 15 | 16 | ## Step 1. Install Hugo 17 | 18 | Goto [hugo releases](https://github.com/spf13/hugo/releases) and download the 19 | appropriate version for your os and architecture. 20 | 21 | Save it somewhere specific as we will be using it in the next step. 22 | 23 | More complete instructions are available at [installing hugo](/overview/installing/) 24 | 25 | ## Step 2. Build the Docs 26 | 27 | Hugo has its own example site which happens to also be the documentation site 28 | you are reading right now. 29 | 30 | Follow the following steps: 31 | 32 | 1. Clone the [hugo repository](http://github.com/spf13/hugo) 33 | 2. Go into the repo 34 | 3. Run hugo in server mode and build the docs 35 | 4. Open your browser to http://localhost:1313 36 | 37 | Corresponding pseudo commands: 38 | 39 | git clone https://github.com/spf13/hugo 40 | cd hugo 41 | /path/to/where/you/installed/hugo server --source=./docs 42 | > 29 pages created 43 | > 0 tags index created 44 | > in 27 ms 45 | > Web Server is available at http://localhost:1313 46 | > Press ctrl+c to stop 47 | 48 | Once you've gotten here, follow along the rest of this page on your local build. 49 | 50 | ## Step 3. Change the docs site 51 | 52 | Stop the Hugo process by hitting ctrl+c. 53 | 54 | Now we are going to run hugo again, but this time with hugo in watch mode. 55 | 56 | /path/to/hugo/from/step/1/hugo server --source=./docs --watch 57 | > 29 pages created 58 | > 0 tags index created 59 | > in 27 ms 60 | > Web Server is available at http://localhost:1313 61 | > Watching for changes in /Users/spf13/Code/hugo/docs/content 62 | > Press ctrl+c to stop 63 | 64 | 65 | Open your [favorite editor](http://vim.spf13.com) and change one of the source 66 | content pages. How about changing this very file to *fix the typo*. How about changing this very file to *fix the typo*. 67 | 68 | Content files are found in `docs/content/`. Unless otherwise specified, files 69 | are located at the same relative location as the url, in our case 70 | `docs/content/overview/quickstart.md`. 71 | 72 | Change and save this file.. Notice what happened in your terminal. 73 | 74 | > Change detected, rebuilding site 75 | 76 | > 29 pages created 77 | > 0 tags index created 78 | > in 26 ms 79 | 80 | Refresh the browser and observe that the typo is now fixed. 81 | 82 | Notice how quick that was. Try to refresh the site before it's finished building.. I double dare you. 83 | Having nearly instant feedback enables you to have your creativity flow without waiting for long builds. 84 | 85 | ## Step 4. Have fun 86 | 87 | The best way to learn something is to play with it. 88 | -------------------------------------------------------------------------------- /layouts/_default/baseof.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ with .Site.Params.author }}{{ end }} 9 | 10 | {{ with .Site.Params.keywords }}{{ end }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {{ block "title" . }}{{ .Site.Title }}{{ end }} 24 | 25 | 26 | {{ if or (.Site.Params.snsShare) (.Site.Params.faIcons) }} 27 | 28 | {{ end }} 29 | 30 | 31 | 32 | 33 | {{ if .Site.Params.rtl}} 34 | 35 | {{ end }} 36 | 37 | {{ range .Site.Params.custom_css }} 38 | 39 | {{ end }} 40 | 41 | 42 | 43 | 44 | {{ with .Site.Home.AlternativeOutputFormats.Get "RSS" }} 45 | 46 | 47 | {{ end }} 48 | 49 | {{ hugo.Generator }} 50 | 51 | 52 | 53 |
54 | {{ partial "header.html" . }} 55 | 56 |
57 | {{ block "content" . }}{{ end }} 58 |
59 | {{ if or (.Site.Params.fixedbarContent) (.Site.Params.snsShare)}} 60 | {{ partial "footer.html" . }} 61 | {{ end }} 62 |
63 | 64 | {{ template "_internal/google_analytics.html" . }} 65 | 66 | 67 | {{ with .Site.Params.fixedbarContentAfter }} 68 | 78 | {{ end }} 79 | 80 | 81 | -------------------------------------------------------------------------------- /layouts/partials/footer.html: -------------------------------------------------------------------------------- 1 | 29 |
30 |
31 | {{ with .Site.Params.fixedbarContent }} 32 |

{{.}}Click!

33 | {{ end }} 34 | {{ if .Site.Params.snsShare }} 35 |
36 | {{ if .Site.Params.enableTwitterShare }} 37 | 38 | {{ end }} 39 | {{ if .Site.Params.enableFacebookShare }} 40 | 41 | {{ end }} 42 | {{ if .Site.Params.enableHatenaShare }} 43 | 44 | {{ end }} 45 | {{ if .Site.Params.enableLineShare }} 46 | 47 | {{ end }} 48 | {{ if .Site.Params.enableLinkedInShare }} 49 | 50 | {{ end }} 51 |
52 | {{ end }} 53 |
54 |
55 | -------------------------------------------------------------------------------- /images/logos/logotype-a.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 10 | 11 | 12 | 13 | 15 | 19 | 23 | 24 | 27 | 31 | 35 | 36 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /images/logos/logotype-b.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 10 | 11 | 12 | 13 | 15 | 19 | 23 | 24 | 28 | 32 | 36 | 37 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /exampleSite/config.toml: -------------------------------------------------------------------------------- 1 | baseurl = "http://www.example.com" 2 | title = "Yusuke Ishimi" 3 | 4 | theme = "coder-portfolio" 5 | 6 | DefaultContentLanguage = "en" 7 | 8 | paginate = 20 9 | 10 | pygmentsstyle = "b2" 11 | pygmentscodefences = true 12 | pygmentscodefencesguesssyntax = true 13 | pygmentsUseClasses = true 14 | 15 | disqusShortname = "yourdiscussshortname" 16 | 17 | [params] 18 | author = "Yusuke Ishimi" 19 | description = "Yusuke Ishimi's personal website" 20 | keywords = "blog,developer,personal" 21 | info = "WEB AND APPS ENGINEER" 22 | avatarurl = "images/avatar.jpg" 23 | footercontent = "Enter a text here." 24 | fixedbarContent = "Do you want to know me more private?→" 25 | fixedbarContentAfter = "Thank You! Please share it if you like it→" 26 | 27 | hideCredits = false 28 | hideCopyright = false 29 | 30 | # Bottom sns share 31 | snsShare = true 32 | # Popular sns share 33 | # if you want add sns. please message! 34 | enableTwitterShare = true 35 | enableFacebookShare = true 36 | enableHatenaShare = true 37 | enableLineShare = true 38 | enableLinkedInShare = true 39 | 40 | thumbnail = "images/tn.png" 41 | 42 | # Custom CSS 43 | custom_css = [] 44 | 45 | # Alignment of Mobile Menu items 46 | itemscentered = true 47 | 48 | # RTL support 49 | rtl = false 50 | 51 | langseparator = "|" 52 | 53 | [[params.social]] 54 | name = "Github" 55 | icon = "fab fa-github" 56 | weight = 1 57 | url = "https://github.com/naro143/" 58 | [[params.social]] 59 | name = "Twitter" 60 | icon = "fab fa-twitter" 61 | weight = 2 62 | url = "https://twitter.com/naro143/" 63 | [[params.social]] 64 | name = "LinkedIn" 65 | icon = "fab fa-linkedin" 66 | weight = 3 67 | url = "https://www.linkedin.com/in/naro143/" 68 | [[params.social]] 69 | name = "LinkedIn" 70 | weight = 4 71 | url = "https://www.linkedin.com/in/naro143/" 72 | 73 | [languages] 74 | [languages.en] 75 | languagecode = "en" 76 | languagename = "English" # The language name to be displayed in the selector. 77 | title = "Yusuke Ishimi" 78 | 79 | # You can configure the theme parameter for each language. 80 | [languages.en.params] 81 | author = "Yusuke Ishimi" 82 | info = "WEB AND APPS ENGINEER" 83 | description = "Yusuke Ishimi's personal website" 84 | keywords = "blog,developer,personal" 85 | 86 | [languages.en.menu] # It is possible to change the menu too. 87 | 88 | [[languages.en.menu.main]] 89 | name = "About" 90 | weight = 1.0 91 | url = "about" 92 | 93 | [[languages.en.menu.main]] 94 | name = "Blog" 95 | weight = 2.0 96 | url = "posts" 97 | 98 | [[languages.en.menu.main]] 99 | name = "Projects" 100 | weight = 3 101 | url = "projects" 102 | [[languages.en.menu.main]] 103 | name = "Contact me" 104 | weight = 5 105 | url = "contact" 106 | 107 | 108 | [languages.ja] 109 | languagecode = "ja" 110 | languagename = "Japanese" 111 | title = "石見 優丞" 112 | 113 | [languages.ja.params] 114 | author = "石見 優丞" 115 | description = "石見のサイト" 116 | keywords = "blog,developer,strona domowa" 117 | info = "WEBとアプリのエンジニア" 118 | 119 | [languages.ja.menu] 120 | [[languages.ja.menu.main]] 121 | name = "テーマについて" 122 | weight = 1.0 123 | url = "ja/about" 124 | [[languages.ja.menu.main]] 125 | name = "ブログ" 126 | weight = 2.0 127 | url = "ja/posts" 128 | [[languages.ja.menu.main]] 129 | name = "プロジェクト" 130 | weight = 3 131 | url = "ja/projects" 132 | [[languages.ja.menu.main]] 133 | name = "お問い合わせ" 134 | weight = 5 135 | url = "ja/contact" 136 | -------------------------------------------------------------------------------- /exampleSite/content/posts/migrate-from-jekyll.md: -------------------------------------------------------------------------------- 1 | +++ 2 | date = "2014-03-10" 3 | title = "Migrate to Hugo from Jekyll" 4 | +++ 5 | 6 | ## Move static content to `static` 7 | Jekyll has a rule that any directory not starting with `_` will be copied as-is to the `_site` output. Hugo keeps all static content under `static`. You should therefore move it all there. 8 | With Jekyll, something that looked like 9 | 10 | ▾ / 11 | ▾ images/ 12 | logo.png 13 | 14 | should become 15 | 16 | ▾ / 17 | ▾ static/ 18 | ▾ images/ 19 | logo.png 20 | 21 | Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`. 22 | 23 | ## Create your Hugo configuration file 24 | Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the [Hugo configuration documentation](/overview/configuration/) for details. 25 | 26 | ## Set your configuration publish folder to `_site` 27 | The default is for Jekyll to publish to `_site` and for Hugo to publish to `public`. If, like me, you have [`_site` mapped to a git submodule on the `gh-pages` branch](http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html), you'll want to do one of two alternatives: 28 | 29 | 1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended). 30 | 31 | git submodule deinit _site 32 | git rm _site 33 | git submodule add -b gh-pages git@github.com:your-username/your-repo.git public 34 | 35 | 2. Or, change the Hugo configuration to use `_site` instead of `public`. 36 | 37 | { 38 | .. 39 | "publishdir": "_site", 40 | .. 41 | } 42 | 43 | ## Convert Jekyll templates to Hugo templates 44 | That's the bulk of the work right here. The documentation is your friend. You should refer to [Jekyll's template documentation](http://jekyllrb.com/docs/templates/) if you need to refresh your memory on how you built your blog and [Hugo's template](/layout/templates/) to learn Hugo's way. 45 | 46 | As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours. 47 | 48 | ## Convert Jekyll plugins to Hugo shortcodes 49 | Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port. 50 | 51 | ### Implementation 52 | As an example, I was using a custom [`image_tag`](https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb) plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing. 53 | 54 | Jekyll's plugin: 55 | 56 | module Jekyll 57 | class ImageTag < Liquid::Tag 58 | @url = nil 59 | @caption = nil 60 | @class = nil 61 | @link = nil 62 | // Patterns 63 | IMAGE_URL_WITH_CLASS_AND_CAPTION = 64 | IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i 65 | IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i 66 | IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i 67 | IMAGE_URL = /((https?:\/\/|\/)(\S+))/i 68 | def initialize(tag_name, markup, tokens) 69 | super 70 | if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK 71 | @class = $1 72 | @url = $3 73 | @caption = $7 74 | @link = $9 75 | elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION 76 | @class = $1 77 | @url = $3 78 | @caption = $7 79 | elsif markup =~ IMAGE_URL_WITH_CAPTION 80 | @url = $1 81 | @caption = $5 82 | elsif markup =~ IMAGE_URL_WITH_CLASS 83 | @class = $1 84 | @url = $3 85 | elsif markup =~ IMAGE_URL 86 | @url = $1 87 | end 88 | end 89 | def render(context) 90 | if @class 91 | source = "
" 92 | else 93 | source = "
" 94 | end 95 | if @link 96 | source += "" 97 | end 98 | source += "" 99 | if @link 100 | source += "" 101 | end 102 | source += "
#{@caption}
" if @caption 103 | source += "
" 104 | source 105 | end 106 | end 107 | end 108 | Liquid::Template.register_tag('image', Jekyll::ImageTag) 109 | 110 | is written as this Hugo shortcode: 111 | 112 | 113 |
114 | {{ with .Get "link"}}{{ end }} 115 | 116 | {{ if .Get "link"}}{{ end }} 117 | {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} 118 |
{{ if isset .Params "title" }} 119 | {{ .Get "title" }}{{ end }} 120 | {{ if or (.Get "caption") (.Get "attr")}}

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

{{ end }} 126 |
127 | {{ end }} 128 |
129 | 130 | 131 | ### Usage 132 | I simply changed: 133 | 134 | {% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg "One of my favorite touristy-type photos. I secretly waited for the good light while we were "having fun" and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." ->http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %} 135 | 136 | to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`): 137 | 138 | {{%/* fig class="full" src="http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg" title="One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." link="http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/" */%}} 139 | 140 | As a bonus, the shortcode named parameters are, arguably, more readable. 141 | 142 | ## Finishing touches 143 | ### Fix content 144 | Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that `hugo server --watch` is your friend. Test your changes and fix errors as needed. 145 | 146 | ### Clean up 147 | You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it. 148 | 149 | ## A practical example in a diff 150 | [Hey, it's Alex](http://heyitsalex.net/) was migrated in less than a _father-with-kids day_ from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this [diff](https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610). 151 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --------------------------- 2 | This theme is created based on [hugo-coder](https://github.com/luizdepra/hugo-coder). 3 | I made it possible to tell yourself more by my change. 4 | Please see [FeaturesOfCoderPortfolio](https://github.com/naro143/hugo-coder-portfolio/blob/master/exampleSite/content/posts/FeaturesOfCoderPortfolio.md) in the post about the change. 5 | Have questions or suggestions? Feel free to [open an issue on GitHub](https://github.com/naro143/hugo-coder-portfolio/issues/new) or [ask me on Twitter](https://twitter.com/naro143). 6 | 7 | --------------------------- 8 | 9 | A simple and clean blog theme for Hugo. 10 | 11 | ![](https://github.com/naro143/hugo-coder-portfolio/blob/master/images/screenshot.png) 12 | 13 | ## How to use this theme 14 | 15 | To use `hugo-coder-portfolio` go through the following steps. 16 | 17 | ### Download 18 | 19 | Clone this repository into your Hugo project. 20 | 21 | ``` 22 | git clone https://github.com/naro143/hugo-coder-portfolio themes/coder-portfolio 23 | ``` 24 | 25 | ### Configuration 26 | 27 | Add the following lines to your `config.toml`. 28 | 29 | ```toml 30 | baseurl = "http://www.example.com" # Hostname (and path) to the root. 31 | title = "Yusuke Ishimi" # Site title. 32 | theme = "coder-portfolio" # Set the theme. 33 | languagecode = "en" # The site’s language code used to generate RSS. 34 | defaultcontentlanguage = "en" # The default content language. 35 | 36 | paginate = 20 # Default number of pages per page in pagination. 37 | 38 | pygmentsstyle = "b2" # Color-theme or style for syntax highlighting. 39 | pygmentscodefences = true # Enable code fence background highlighting. 40 | pygmentscodefencesguesssyntax = true # Enable syntax guessing for code fences without specified language. 41 | pygmentsUseClasses = true # new add 42 | 43 | disqusShortname = "yourdiscussshortname" # Enable or disable Disqus. 44 | 45 | [params] # theme parameters 46 | author = "Yusuke Ishimi" # Author's name. 47 | info = "WEB AND APPS ENGINEER" # Author's job title or info. 48 | description = "Yusuke Ishimi's personal website" # Site description. 49 | keywords = "blog,developer,personal" # Site keywords. 50 | avatarurl = "images/avatar.jpg" # Contain the path of the optionnal avatar in the static folder. 51 | 52 | footercontent = "Enter a text here." # Add footer content 53 | fixedbarContent = "Do you want to know me more private?→" # Add fixedbar content 54 | fixedbarContentAfter = "Thank You! Please share it if you like it→" # Add fixedbar content after click 55 | 56 | # Whether you want to hide copyright and credits in the footer. 57 | hideCredits = false 58 | hideCopyright = false 59 | 60 | # Custom CSS 61 | custom_css = [] 62 | 63 | # Alignment of Mobile Menu items 64 | itemscentered = true 65 | 66 | # RTL support 67 | rtl = false 68 | 69 | # Bottom sns share 70 | snsShare = true # new add 71 | # Popular sns share 72 | # if you want add sns. please message! 73 | enableTwitterShare = true # new add 74 | enableFacebookShare = true # new add 75 | enableHatenaShare = true # new add 76 | enableLineShare = true # new add 77 | enableLinkedInShare = true # new add 78 | 79 | thumbnail = "images/tn.png" # default sns thumbnail 80 | 81 | # Multilanguage mode 82 | langseparator = "|" # Separates menus from language selectors when site is multilingual. 83 | 84 | # Social links 85 | [[params.social]] 86 | name = "Github" 87 | icon = "fab fa-github" 88 | weight = 1 89 | url = "https://github.com/naro143/" 90 | [[params.social]] 91 | name = "Twitter" 92 | icon = "fab fa-twitter" 93 | weight = 2 94 | url = "https://twitter.com/naro143/" 95 | [[params.social]] 96 | name = "LinkedIn" 97 | icon = "fab fa-linkedin" 98 | weight = 3 99 | url = "https://www.linkedin.com/in/naro143/" 100 | [[params.social]] 101 | # If icon is not set, Text is displayed. 102 | name = "LinkedIn" 103 | weight = 4 104 | url = "https://www.linkedin.com/in/naro143/" 105 | 106 | # Menu links 107 | [[menu.main]] 108 | name = "Blog" 109 | weight = 1 110 | url = "posts" 111 | [[menu.main]] 112 | name = "About" 113 | weight = 2 114 | url = "about" 115 | ``` 116 | 117 | You can look at full working [`config.toml`](https://github.com/naro143/hugo-coder-portfolio/blob/master/exampleSite/config.toml) inside the [exampleSite](https://github.com/naro143/hugo-coder-portfolio/tree/master/exampleSite) folder. 118 | 119 | #### Multilingual mode 120 | 121 | To use multilingual mode, the configuration above needs to be extended by parameters for the specific languages. 122 | Each `language` section overrides default site's parameters when that language is chosen. 123 | 124 | ```toml 125 | [params] 126 | langseparator = "|" # separates menus from language selectors. 127 | 128 | [languages] 129 | [languages.en] 130 | languagename = "English" # The language name to be displayed in the selector. 131 | title = "Yusuke Ishimi" 132 | 133 | # You can configure the theme parameter for each language. 134 | [languages.en.params] 135 | author = "Yusuke Ishimi" 136 | info = "WEB AND APPS ENGINEER" 137 | description = "Yusuke Ishimi's personal website" 138 | keywords = "blog,developer,personal" 139 | 140 | [languages.en.menu] # It is possible to change the menu too. 141 | 142 | [[languages.en.menu.main]] 143 | name = "About" 144 | weight = 1.0 145 | url = "about" 146 | 147 | [[languages.en.menu.main]] 148 | name = "Blog" 149 | weight = 2.0 150 | url = "posts" 151 | 152 | 153 | [languages.ja] 154 | languagename = "Japanese" 155 | title = "石見 優丞" 156 | 157 | [languages.ja.params] 158 | author = "石見 優丞" 159 | description = "石見 優丞のサイト" 160 | keywords = "blog,developer, ブログ, エンジニア" 161 | info = "WEBとアプリのエンジニア" 162 | 163 | [languages.ja.menu] 164 | 165 | [[languages.ja.menu.main]] 166 | name = "石見とは" 167 | weight = 1.0 168 | url = "ja/about" 169 | 170 | [[languages.ja.menu.main]] 171 | name = "ブログ" 172 | weight = 2.0 173 | url = "ja/posts" 174 | 175 | 176 | ``` 177 | 178 | It is possible to force Hugo to render all default language content under the language code with `defaultContentLanguageInSubdir = true`. 179 | In this case, remember to update your menus URLs (i.e. `/en/about/`). 180 | 181 | ### Build & Test 182 | 183 | It is necessary to have `less` and `uglifycss` installed to build and run the demo. 184 | Assuming that already have NodeJS/NPM installed, run `npm install -g less uglifycss`. 185 | 186 | To update or generate the minified CSS file: 187 | 188 | ``` 189 | make build 190 | ``` 191 | 192 | To build your site and test, run: 193 | 194 | ``` 195 | hugo server 196 | ``` 197 | 198 | To preview the exampleSite, run 199 | 200 | ``` 201 | make demo 202 | ``` 203 | 204 | The above command copies current state of the theme to exampleSite/themes and starts hugo with hugo serve -D (Go does not support Symlink directories) 205 | 206 | ### Disqus 207 | 208 | Add the following line to your config, ```disqusShortname = "yourdiscussshortname"``` When this is set, all posts are disqus enabled 209 | You can disable comments for a post by adding the following to your page meta data: ```disable_comments: true```. 210 | 211 | 212 | ## License 213 | 214 | Coder is licensed under the [MIT license](https://github.com/naro143/hugo-coder-portfolio/blob/master/LICENSE.md). 215 | 216 | ## Author 217 | 218 | [Yusuke Ishimi](https://github.com/naro143) 219 | 220 | ## Contributors 221 | 222 | ## Special Thanks 223 | 224 | - All contributors, for every PR and Issue reported. 225 | -------------------------------------------------------------------------------- /static/less/normalize.less: -------------------------------------------------------------------------------- 1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ 2 | 3 | /* Document 4 | ========================================================================== */ 5 | 6 | /** 7 | * 1. Correct the line height in all browsers. 8 | * 2. Prevent adjustments of font size after orientation changes in iOS. 9 | */ 10 | 11 | html { 12 | line-height: 1.15; /* 1 */ 13 | -webkit-text-size-adjust: 100%; /* 2 */ 14 | } 15 | 16 | /* Sections 17 | ========================================================================== */ 18 | 19 | /** 20 | * Remove the margin in all browsers. 21 | */ 22 | 23 | body { 24 | margin: 0; 25 | } 26 | 27 | /** 28 | * Render the `main` element consistently in IE. 29 | */ 30 | 31 | main { 32 | display: block; 33 | } 34 | 35 | /** 36 | * Correct the font size and margin on `h1` elements within `section` and 37 | * `article` contexts in Chrome, Firefox, and Safari. 38 | */ 39 | 40 | h1 { 41 | font-size: 2em; 42 | margin: 0.67em 0; 43 | } 44 | 45 | /* Grouping content 46 | ========================================================================== */ 47 | 48 | /** 49 | * 1. Add the correct box sizing in Firefox. 50 | * 2. Show the overflow in Edge and IE. 51 | */ 52 | 53 | hr { 54 | box-sizing: content-box; /* 1 */ 55 | height: 0; /* 1 */ 56 | overflow: visible; /* 2 */ 57 | } 58 | 59 | /** 60 | * 1. Correct the inheritance and scaling of font size in all browsers. 61 | * 2. Correct the odd `em` font sizing in all browsers. 62 | */ 63 | 64 | pre { 65 | font-family: monospace, monospace; /* 1 */ 66 | font-size: 1em; /* 2 */ 67 | } 68 | 69 | /* Text-level semantics 70 | ========================================================================== */ 71 | 72 | /** 73 | * Remove the gray background on active links in IE 10. 74 | */ 75 | 76 | a { 77 | background-color: transparent; 78 | } 79 | 80 | /** 81 | * 1. Remove the bottom border in Chrome 57- 82 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. 83 | */ 84 | 85 | abbr[title] { 86 | border-bottom: none; /* 1 */ 87 | text-decoration: underline; /* 2 */ 88 | text-decoration: underline dotted; /* 2 */ 89 | } 90 | 91 | /** 92 | * Add the correct font weight in Chrome, Edge, and Safari. 93 | */ 94 | 95 | b, 96 | strong { 97 | font-weight: bolder; 98 | } 99 | 100 | /** 101 | * 1. Correct the inheritance and scaling of font size in all browsers. 102 | * 2. Correct the odd `em` font sizing in all browsers. 103 | */ 104 | 105 | code, 106 | kbd, 107 | samp { 108 | font-family: monospace, monospace; /* 1 */ 109 | font-size: 1em; /* 2 */ 110 | } 111 | 112 | /** 113 | * Add the correct font size in all browsers. 114 | */ 115 | 116 | small { 117 | font-size: 80%; 118 | } 119 | 120 | /** 121 | * Prevent `sub` and `sup` elements from affecting the line height in 122 | * all browsers. 123 | */ 124 | 125 | sub, 126 | sup { 127 | font-size: 75%; 128 | line-height: 0; 129 | position: relative; 130 | vertical-align: baseline; 131 | } 132 | 133 | sub { 134 | bottom: -0.25em; 135 | } 136 | 137 | sup { 138 | top: -0.5em; 139 | } 140 | 141 | /* Embedded content 142 | ========================================================================== */ 143 | 144 | /** 145 | * Remove the border on images inside links in IE 10. 146 | */ 147 | 148 | img { 149 | border-style: none; 150 | } 151 | 152 | /* Forms 153 | ========================================================================== */ 154 | 155 | /** 156 | * 1. Change the font styles in all browsers. 157 | * 2. Remove the margin in Firefox and Safari. 158 | */ 159 | 160 | button, 161 | input, 162 | optgroup, 163 | select, 164 | textarea { 165 | font-family: inherit; /* 1 */ 166 | font-size: 100%; /* 1 */ 167 | line-height: 1.15; /* 1 */ 168 | margin: 0; /* 2 */ 169 | } 170 | 171 | /** 172 | * Show the overflow in IE. 173 | * 1. Show the overflow in Edge. 174 | */ 175 | 176 | button, 177 | input { /* 1 */ 178 | overflow: visible; 179 | } 180 | 181 | /** 182 | * Remove the inheritance of text transform in Edge, Firefox, and IE. 183 | * 1. Remove the inheritance of text transform in Firefox. 184 | */ 185 | 186 | button, 187 | select { /* 1 */ 188 | text-transform: none; 189 | } 190 | 191 | /** 192 | * Correct the inability to style clickable types in iOS and Safari. 193 | */ 194 | 195 | button, 196 | [type="button"], 197 | [type="reset"], 198 | [type="submit"] { 199 | -webkit-appearance: button; 200 | } 201 | 202 | /** 203 | * Remove the inner border and padding in Firefox. 204 | */ 205 | 206 | button::-moz-focus-inner, 207 | [type="button"]::-moz-focus-inner, 208 | [type="reset"]::-moz-focus-inner, 209 | [type="submit"]::-moz-focus-inner { 210 | border-style: none; 211 | padding: 0; 212 | } 213 | 214 | /** 215 | * Restore the focus styles unset by the previous rule. 216 | */ 217 | 218 | button:-moz-focusring, 219 | [type="button"]:-moz-focusring, 220 | [type="reset"]:-moz-focusring, 221 | [type="submit"]:-moz-focusring { 222 | outline: 1px dotted ButtonText; 223 | } 224 | 225 | /** 226 | * Correct the padding in Firefox. 227 | */ 228 | 229 | fieldset { 230 | padding: 0.35em 0.75em 0.625em; 231 | } 232 | 233 | /** 234 | * 1. Correct the text wrapping in Edge and IE. 235 | * 2. Correct the color inheritance from `fieldset` elements in IE. 236 | * 3. Remove the padding so developers are not caught out when they zero out 237 | * `fieldset` elements in all browsers. 238 | */ 239 | 240 | legend { 241 | box-sizing: border-box; /* 1 */ 242 | color: inherit; /* 2 */ 243 | display: table; /* 1 */ 244 | max-width: 100%; /* 1 */ 245 | padding: 0; /* 3 */ 246 | white-space: normal; /* 1 */ 247 | } 248 | 249 | /** 250 | * Add the correct vertical alignment in Chrome, Firefox, and Opera. 251 | */ 252 | 253 | progress { 254 | vertical-align: baseline; 255 | } 256 | 257 | /** 258 | * Remove the default vertical scrollbar in IE 10+. 259 | */ 260 | 261 | textarea { 262 | overflow: auto; 263 | } 264 | 265 | /** 266 | * 1. Add the correct box sizing in IE 10. 267 | * 2. Remove the padding in IE 10. 268 | */ 269 | 270 | [type="checkbox"], 271 | [type="radio"] { 272 | box-sizing: border-box; /* 1 */ 273 | padding: 0; /* 2 */ 274 | } 275 | 276 | /** 277 | * Correct the cursor style of increment and decrement buttons in Chrome. 278 | */ 279 | 280 | [type="number"]::-webkit-inner-spin-button, 281 | [type="number"]::-webkit-outer-spin-button { 282 | height: auto; 283 | } 284 | 285 | /** 286 | * 1. Correct the odd appearance in Chrome and Safari. 287 | * 2. Correct the outline style in Safari. 288 | */ 289 | 290 | [type="search"] { 291 | -webkit-appearance: textfield; /* 1 */ 292 | outline-offset: -2px; /* 2 */ 293 | } 294 | 295 | /** 296 | * Remove the inner padding in Chrome and Safari on macOS. 297 | */ 298 | 299 | [type="search"]::-webkit-search-decoration { 300 | -webkit-appearance: none; 301 | } 302 | 303 | /** 304 | * 1. Correct the inability to style clickable types in iOS and Safari. 305 | * 2. Change font properties to `inherit` in Safari. 306 | */ 307 | 308 | ::-webkit-file-upload-button { 309 | -webkit-appearance: button; /* 1 */ 310 | font: inherit; /* 2 */ 311 | } 312 | 313 | /* Interactive 314 | ========================================================================== */ 315 | 316 | /* 317 | * Add the correct display in Edge, IE 10+, and Firefox. 318 | */ 319 | 320 | details { 321 | display: block; 322 | } 323 | 324 | /* 325 | * Add the correct display in all browsers. 326 | */ 327 | 328 | summary { 329 | display: list-item; 330 | } 331 | 332 | /* Misc 333 | ========================================================================== */ 334 | 335 | /** 336 | * Add the correct display in IE 10+. 337 | */ 338 | 339 | template { 340 | display: none; 341 | } 342 | 343 | /** 344 | * Add the correct display in IE 10. 345 | */ 346 | 347 | [hidden] { 348 | display: none; 349 | } 350 | -------------------------------------------------------------------------------- /static/css/style.min.css: -------------------------------------------------------------------------------- 1 | *,*:after,*:before{box-sizing:inherit}html{box-sizing:border-box;font-size:62.5%}body{display:flex;color:#323232;background-color:#fefefe;font-family:'Fira Mono',monospace;font-size:1.6em;font-weight:400;letter-spacing:.0625em;line-height:1.8em}@media only screen and (min-device-width:320px) and (max-device-width:480px){body{font-size:1.4em;line-height:1.6em}}a{font-weight:700;color:#000;text-decoration:none}a:focus,a:hover{text-decoration:underline}p{margin:1.6rem 0 1.6rem 0}p a{font-weight:400;color:#000;text-decoration:underline;text-underline-position:under}p a:focus,p a:hover{color:#36c}h1,h2,h3,h4,h5,h6{color:#000;text-transform:uppercase;letter-spacing:.0625em;margin:3.2rem 0 1.6rem 0}h1{font-size:3.2rem;line-height:3.2rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){h1{font-size:2.8rem;line-height:2.8rem}}h2{font-size:2.8rem;line-height:2.8rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){h2{font-size:2.4rem;line-height:2.4rem}}h3{font-size:2.4rem;line-height:2.4rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){h3{font-size:2rem;line-height:2rem}}h4{font-size:2.2rem;line-height:2.2rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){h4{font-size:1.8rem;line-height:1.8rem}}h5{font-size:2rem;line-height:2rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){h5{font-size:1.6rem;line-height:1.6rem}}h6{font-size:1.4rem;line-height:1.4rem}pre{margin:1.6rem 0 1rem 0;padding:1.6rem;overflow-x:auto}code{display:inline-block;background-color:#000;color:#fefefe;padding:.4rem .8rem .4rem .8rem}blockquote{border-left:2px solid #dcdcdc;padding-left:1.6rem;font-style:italic}th,td{padding:1.6rem}table{border-collapse:collapse}table td,table th{border:2px solid #000}table tr:first-child th{border-top:0}table tr:last-child td{border-bottom:0}table tr td:first-child,table tr th:first-child{border-left:0}table tr td:last-child,table tr th:last-child{border-right:0}img{max-width:100%}.wrapper{display:flex;flex-direction:column;min-height:100vh;width:100%}.container{margin:0 auto;max-width:120rem;width:100%;padding-left:2rem;padding-right:2rem}.navigation{height:6rem;width:100%}.navigation a{display:inline;font-size:1.6rem;text-transform:uppercase;line-height:6rem;letter-spacing:.1rem}@media only screen and (min-device-width:320px) and (max-device-width:768px){.navigation a{font-size:1.6rem}}.navigation ul{list-style:none;margin-bottom:0;margin-top:0}.navigation ul li{float:left;margin:0;position:relative}.navigation ul li a{margin-left:1rem;margin-right:1rem}@media only screen and (min-device-width:320px) and (max-device-width:768px){.navigation ul li{float:none !important}}@media only screen and (min-device-width:320px) and (max-device-width:768px){.navigation ul{visibility:hidden;opacity:0;max-height:0;z-index:5;top:5rem;right:0;width:100%;position:absolute;background-color:rgba(254,254,254,0.98);padding:0;border-bottom:solid 2px #e2dfe1;transition:opacity .25s,max-height .15s linear}}#menu-control{display:none}.btn-mobile{display:none}.mobile-menu-lang-separator-centered{display:none}@media only screen and (min-device-width:320px) and (max-device-width:768px){.btn-mobile{display:block;font-size:2rem;color:black;cursor:pointer;margin-top:1.5rem}#menu-control:checked+label .btn-mobile{color:#e2dfe1}#menu-control:checked+label ul{visibility:visible;opacity:1;max-height:100rem}.navigation-item{position:relative}.mobile-menu-lang-separator-centered{display:block;padding-left:7rem;padding-right:7rem}.mobile-menu-lang-separator-full{padding-left:1.5rem;padding-right:1.5rem}.multilingual-separator{display:none}.align-left{text-align:left;padding-left:1rem}.align-right{text-align:right;padding-right:1rem}.align-center{text-align:center}}.content{flex:1;margin-top:1.6rem;margin-bottom:3.2rem}.content article header{margin-top:3.2rem;margin-bottom:3.2rem}.content article header h1,.content article header h2{margin:0}.content article header h2{margin-top:1rem;font-size:1.8rem;color:#323232}@media only screen and (min-device-width:320px) and (max-device-width:480px){.content article header h2{font-size:1.6rem}}.avatar img{width:20rem;height:auto;border-radius:50%}@media only screen and (max-device-width:768px){.avatar img{width:10rem}}.list ul{margin:3.2rem 0 3.2rem 0;list-style:none;padding:0}.list ul li{font-size:1.6rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){.list ul li{font-size:1.4rem;margin:1.6rem 0 1.6rem 0}}.list ul li span{display:inline-block;text-align:right;width:20rem;margin-right:3rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){.list ul li span{display:block;text-align:left}}.list ul li a{text-transform:uppercase}.pagination{margin-top:6rem;text-align:center}.pagination li{display:inline;text-align:center}.pagination li span{margin:0;text-align:center;width:3.2rem}.pagination li a span{margin:0;text-align:center;width:3.2rem}.centered{display:flex;height:100%;align-items:center;justify-content:center}.centered .about{text-align:center}.centered .about h1{margin-top:2rem;margin-bottom:.5rem}.centered .about h2{margin-top:1rem;margin-bottom:.5rem;font-size:2.4rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){.centered .about h2{font-size:2rem}}.centered .about ul{list-style:none;margin:3rem 0 1rem 0;padding:0}.centered .about ul li{display:inline-block;position:relative}.centered .about ul li a{text-transform:uppercase;margin-left:1rem;margin-right:1rem;font-size:1.6rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){.centered .about ul li a{font-size:1.4rem}}.centered .error{text-align:center}.centered .error h1{margin-top:2rem;margin-bottom:.5rem;font-size:4.6rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){.centered .error h1{font-size:3.2rem}}.centered .error h2{margin-top:2rem;margin-bottom:3.2rem;font-size:3.2rem}@media only screen and (min-device-width:320px) and (max-device-width:480px){.centered .error h2{font-size:2.8rem}}.footer{width:100%;text-align:center;line-height:2rem;margin-bottom:1rem}.float-right{float:right}.float-left{float:left}.title{font-weight:bold}a{position:relative;transition:.5s}a:before,a:after{position:absolute;bottom:-2px;content:"";display:inline-block;width:0;height:2px;background:#f30034;transition:.5s}a:before{left:50%}a:after{right:50%}a:hover{text-decoration:none}a:hover:before,a:hover:after{width:50%}.private{display:none}.private-inner{display:table-cell}.portfolio .portfolio-inner{display:flex;align-items:stretch}.portfolio .portfolio-inner .portfolio-image{display:flex;align-items:center;margin-right:5%;width:45%}.portfolio .portfolio-inner .portfolio-content{flex:1}#privateTrigger{cursor:pointer}#privateTrigger:hover:before,#privateTrigger:hover:after{width:0}.navigation{height:auto;box-shadow:0 0 1px rgba(0,0,0,0.08);border-bottom:1px solid rgba(0,0,0,0.15)}.fixed-bar{position:fixed;bottom:0;margin:0;height:65px;width:100%;border-top:1px solid rgba(0,0,0,0.05);background:#fefefe}.fixed-bar .container{display:flex;justify-content:center;align-items:center;position:relative;height:65px}code{background:#364549 !important}.social-list .social-item i{font-size:30px}.sns-shares{display:flex;align-items:center;justify-content:space-around;position:absolute;right:0}.sns-shares .sns-share{display:flex;align-items:center;justify-content:space-around;height:56px;width:56px;text-decoration:none}.sns-shares .sns-share:hover:before,.sns-shares .sns-share:hover:after{width:0}.sns-shares .twitter-share .fa-twitter{font-size:24px}.sns-shares .fb-share .fa-facebook-f{font-size:24px}.sns-shares .hatena-share .fa-bookmark{font-size:24px}.sns-shares .line-share .fa-line{font-size:30px}.sns-shares .linkedIn-share .fa-linkedin{font-size:30px}.sp-sns-shares{display:none}@media(max-width:920px){.pc-sns-shares{display:none}.sp-sns-shares{display:flex;position:relative;justify-content:space-around;width:100%}.portfolio .portfolio-inner{display:block}.portfolio .portfolio-inner .portfolio-image{width:100%}}.chroma{color:#e3e3e3;background-color:#364549}.chroma .err{color:#ddd;border-bottom:2px dotted #c01b1b}.chroma .lntd{vertical-align:top;padding:0;margin:0;border:0}.chroma .lntable{border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block}.chroma .hl{display:block;width:100%;background-color:#ffc}.chroma .lnt{margin-right:.4em;padding:0 .4em 0 .4em}.chroma .ln{margin-right:.4em;padding:0 .4em 0 .4em}.chroma .k{color:#ebd247}.chroma .kc{color:#ebd247}.chroma .kd{color:#ebd247}.chroma .kn{color:#ff8095}.chroma .kp{color:#ebd247}.chroma .kr{color:#ebd247}.chroma .kt{color:#ebd247}.chroma .na{color:#8bdf4c}.chroma .nc{color:#8bdf4c}.chroma .no{color:#ebd247}.chroma .nd{color:#8bdf4c}.chroma .ne{color:#8bdf4c}.chroma .nf{color:#8bdf4c}.chroma .nx{color:#8bdf4c}.chroma .nt{color:#ff8095}.chroma .l{color:#a980f5}.chroma .ld{color:#41b7d7}.chroma .s{color:#41b7d7}.chroma .sa{color:#41b7d7}.chroma .sb{color:#41b7d7}.chroma .sc{color:#41b7d7}.chroma .dl{color:#41b7d7}.chroma .sd{color:#41b7d7}.chroma .s2{color:#41b7d7}.chroma .se{color:#a980f5}.chroma .sh{color:#41b7d7}.chroma .si{color:#41b7d7}.chroma .sx{color:#41b7d7}.chroma .sr{color:#41b7d7}.chroma .s1{color:#41b7d7}.chroma .ss{color:#41b7d7}.chroma .m{color:#a980f5}.chroma .mb{color:#a980f5}.chroma .mf{color:#a980f5}.chroma .mh{color:#a980f5}.chroma .mi{color:#a980f5}.chroma .il{color:#a980f5}.chroma .mo{color:#a980f5}.chroma .o{color:#ff8095}.chroma .ow{color:#ff8095}.chroma .c{color:#9dabae}.chroma .ch{color:#9dabae}.chroma .cm{color:#9dabae}.chroma .c1{color:#9dabae}.chroma .cs{color:#9dabae}.chroma .cp{color:#9dabae}.chroma .cpf{color:#9dabae}.chroma .gd{color:#ff8095}.chroma .ge{font-style:italic}.chroma .gi{color:#8bdf4c}.chroma .gs{font-weight:bold}.chroma .gu{color:#9dabae} 2 | -------------------------------------------------------------------------------- /exampleSite/content/posts/goisforlovers.md: -------------------------------------------------------------------------------- 1 | +++ 2 | date = "2014-04-02" 3 | title = "(Hu)go Template Primer" 4 | slug = "hugo-template-primer" 5 | tags = [ 6 | "go", 7 | "golang", 8 | "templates", 9 | "themes", 10 | "development", 11 | ] 12 | categories = [ 13 | "Development", 14 | "golang", 15 | ] 16 | +++ 17 | 18 | Hugo uses the excellent [go][] [html/template][gohtmltemplate] library for 19 | its template engine. It is an extremely lightweight engine that provides a very 20 | small amount of logic. In our experience that it is just the right amount of 21 | logic to be able to create a good static website. If you have used other 22 | template systems from different languages or frameworks you will find a lot of 23 | similarities in go templates. 24 | 25 | This document is a brief primer on using go templates. The [go docs][gohtmltemplate] 26 | provide more details. 27 | 28 | ## Introduction to Go Templates 29 | 30 | Go templates provide an extremely simple template language. It adheres to the 31 | belief that only the most basic of logic belongs in the template or view layer. 32 | One consequence of this simplicity is that go templates parse very quickly. 33 | 34 | A unique characteristic of go templates is they are content aware. Variables and 35 | content will be sanitized depending on the context of where they are used. More 36 | details can be found in the [go docs][gohtmltemplate]. 37 | 38 | ## Basic Syntax 39 | 40 | Go lang templates are html files with the addition of variables and 41 | functions. 42 | 43 | **Go variables and functions are accessible within {{ }}** 44 | 45 | Accessing a predefined variable "foo": 46 | 47 | {{ foo }} 48 | 49 | **Parameters are separated using spaces** 50 | 51 | Calling the add function with input of 1, 2: 52 | 53 | {{ add 1 2 }} 54 | 55 | **Methods and fields are accessed via dot notation** 56 | 57 | Accessing the Page Parameter "bar" 58 | 59 | {{ .Params.bar }} 60 | 61 | **Parentheses can be used to group items together** 62 | 63 | {{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }} 64 | 65 | 66 | ## Variables 67 | 68 | Each go template has a struct (object) made available to it. In hugo each 69 | template is passed either a page or a node struct depending on which type of 70 | page you are rendering. More details are available on the 71 | [variables](/layout/variables) page. 72 | 73 | A variable is accessed by referencing the variable name. 74 | 75 | {{ .Title }} 76 | 77 | Variables can also be defined and referenced. 78 | 79 | {{ $address := "123 Main St."}} 80 | {{ $address }} 81 | 82 | 83 | ## Functions 84 | 85 | Go template ship with a few functions which provide basic functionality. The go 86 | template system also provides a mechanism for applications to extend the 87 | available functions with their own. [Hugo template 88 | functions](/layout/functions) provide some additional functionality we believe 89 | are useful for building websites. Functions are called by using their name 90 | followed by the required parameters separated by spaces. Template 91 | functions cannot be added without recompiling hugo. 92 | 93 | **Example:** 94 | 95 | {{ add 1 2 }} 96 | 97 | ## Includes 98 | 99 | When including another template you will pass to it the data it will be 100 | able to access. To pass along the current context please remember to 101 | include a trailing dot. The templates location will always be starting at 102 | the /layout/ directory within Hugo. 103 | 104 | **Example:** 105 | 106 | {{ template "chrome/header.html" . }} 107 | 108 | 109 | ## Logic 110 | 111 | Go templates provide the most basic iteration and conditional logic. 112 | 113 | ### Iteration 114 | 115 | Just like in go, the go templates make heavy use of range to iterate over 116 | a map, array or slice. The following are different examples of how to use 117 | range. 118 | 119 | **Example 1: Using Context** 120 | 121 | {{ range array }} 122 | {{ . }} 123 | {{ end }} 124 | 125 | **Example 2: Declaring value variable name** 126 | 127 | {{range $element := array}} 128 | {{ $element }} 129 | {{ end }} 130 | 131 | **Example 2: Declaring key and value variable name** 132 | 133 | {{range $index, $element := array}} 134 | {{ $index }} 135 | {{ $element }} 136 | {{ end }} 137 | 138 | ### Conditionals 139 | 140 | If, else, with, or, & and provide the framework for handling conditional 141 | logic in Go Templates. Like range, each statement is closed with `end`. 142 | 143 | 144 | Go Templates treat the following values as false: 145 | 146 | * false 147 | * 0 148 | * any array, slice, map, or string of length zero 149 | 150 | **Example 1: If** 151 | 152 | {{ if isset .Params "title" }}

{{ index .Params "title" }}

{{ end }} 153 | 154 | **Example 2: If -> Else** 155 | 156 | {{ if isset .Params "alt" }} 157 | {{ index .Params "alt" }} 158 | {{else}} 159 | {{ index .Params "caption" }} 160 | {{ end }} 161 | 162 | **Example 3: And & Or** 163 | 164 | {{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}} 165 | 166 | **Example 4: With** 167 | 168 | An alternative way of writing "if" and then referencing the same value 169 | is to use "with" instead. With rebinds the context `.` within its scope, 170 | and skips the block if the variable is absent. 171 | 172 | The first example above could be simplified as: 173 | 174 | {{ with .Params.title }}

{{ . }}

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