├── exampleSite ├── data │ └── .gitkeep ├── static │ └── .gitkeep ├── content │ ├── post │ │ ├── featured-image │ │ │ ├── featured.png │ │ │ └── index.md │ │ ├── mathjax.md │ │ ├── hugoisforlovers.md │ │ ├── basic-elements.md │ │ ├── migrate-from-jekyll.md │ │ ├── goisforlovers.md │ │ └── creating-a-new-theme.md │ └── about.md └── config.toml ├── images ├── tn.png └── screenshot.png ├── static ├── favicon.ico ├── icons │ ├── 16.png │ ├── 32.png │ ├── 48.png │ ├── 144.png │ ├── 192.png │ ├── 512.png │ ├── 72x72.png │ └── 96x96.png └── js │ └── menu.js ├── archetypes └── default.md ├── layouts ├── partials │ ├── header_logo.html │ ├── body_custom.html │ ├── head_custom.html │ ├── header.html │ ├── footer.html │ ├── comments.html │ ├── scripts.html │ ├── svg │ │ ├── facebook.svg │ │ ├── gitlab.svg │ │ ├── instagram.svg │ │ ├── stackoverflow.svg │ │ ├── email.svg │ │ ├── linkedin.svg │ │ ├── medium.svg │ │ ├── telegram.svg │ │ ├── twitter.svg │ │ ├── pocket.svg │ │ ├── pinterest.svg │ │ ├── vk.svg │ │ ├── mastodon.svg │ │ ├── github.svg │ │ └── reddit.svg │ ├── mathjax.html │ ├── entry │ │ ├── meta.html │ │ ├── tags.html │ │ ├── meta │ │ │ └── date.html │ │ ├── share.html │ │ └── featured.html │ ├── footer_copyright.html │ ├── widgets │ │ ├── sidemenu.html │ │ ├── categories.html │ │ ├── tags.html │ │ └── recent.html │ ├── related.html │ ├── footer_social.html │ ├── header_menu.html │ ├── pagination.html │ ├── breadcrumb.html │ └── sidebar.html ├── 404.html ├── _default │ ├── summary.html │ ├── list.html │ ├── single.html │ └── baseof.html ├── index.html └── index.manifest.json ├── .gitignore ├── theme.toml ├── .editorconfig ├── LICENSE ├── data ├── share.toml └── social.toml ├── i18n └── en.yaml ├── package.json ├── .github └── workflows │ └── ci-test.yml ├── assets └── css │ ├── reboot.css │ └── main.css ├── CONTRIBUTING.md ├── .stylelintrc └── README.md /exampleSite/data/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exampleSite/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/tn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/images/tn.png -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/static/favicon.ico -------------------------------------------------------------------------------- /static/icons/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/static/icons/16.png -------------------------------------------------------------------------------- /static/icons/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/static/icons/32.png -------------------------------------------------------------------------------- /static/icons/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/static/icons/48.png -------------------------------------------------------------------------------- /images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/images/screenshot.png -------------------------------------------------------------------------------- /static/icons/144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/static/icons/144.png -------------------------------------------------------------------------------- /static/icons/192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/static/icons/192.png -------------------------------------------------------------------------------- /static/icons/512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/static/icons/512.png -------------------------------------------------------------------------------- /static/icons/72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/static/icons/72x72.png -------------------------------------------------------------------------------- /static/icons/96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/static/icons/96x96.png -------------------------------------------------------------------------------- /archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .Name "-" " " | title }}" 3 | date: "{{ .Date }}" 4 | --- 5 | -------------------------------------------------------------------------------- /layouts/partials/header_logo.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exampleSite/content/post/featured-image/featured.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vimux/Amnix/master/exampleSite/content/post/featured-image/featured.png -------------------------------------------------------------------------------- /layouts/partials/body_custom.html: -------------------------------------------------------------------------------- 1 | {{/* 2 | Do not touch this file directly! 3 | 4 | Instead, create a `layouts/partials/body_custom.html` file in your site directory. 5 | */}} -------------------------------------------------------------------------------- /layouts/partials/head_custom.html: -------------------------------------------------------------------------------- 1 | {{/* 2 | Do not touch this file directly! 3 | 4 | Instead, create a `layouts/partials/head_custom.html` file in your site directory. 5 | */}} -------------------------------------------------------------------------------- /layouts/partials/header.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | {{- partial "header_logo.html" . }} 4 | {{- partial "header_menu.html" . }} 5 |
6 |
-------------------------------------------------------------------------------- /layouts/partials/footer.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/comments.html: -------------------------------------------------------------------------------- 1 | {{ if and (.Site.Config.Services.Disqus.Shortname) (.Param "comments") (not .Site.IsServer) }} 2 |
3 | {{ template "_internal/disqus.html" . }} 4 |
5 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/scripts.html: -------------------------------------------------------------------------------- 1 | {{- if .Site.Menus.main }} 2 | 3 | {{- end }} 4 | {{- partial "mathjax.html" . }} 5 | {{- range .Site.Params.customJS }} 6 | 7 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/svg/facebook.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Node/npm 2 | node_modules/ 3 | npm-debug.log 4 | 5 | # IDE 6 | .idea 7 | *.sublime-project 8 | *.sublime-workspace 9 | .vscode/* 10 | 11 | # OS 12 | ._* 13 | Thumbs.db 14 | .DS_Store 15 | .Trashes 16 | .Spotlight-V100 17 | .AppleDouble 18 | .LSOverride 19 | Desktop.ini 20 | -------------------------------------------------------------------------------- /layouts/partials/svg/gitlab.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/mathjax.html: -------------------------------------------------------------------------------- 1 | {{ if and .IsPage (eq (.Param "mathjax") true) }} 2 | 3 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/svg/instagram.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/svg/stackoverflow.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/svg/email.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/svg/linkedin.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/entry/meta.html: -------------------------------------------------------------------------------- 1 | {{- $page := . -}} 2 | {{- $pageMeta := default .Site.Params.Entry.meta .Params.meta -}} 3 | 4 | {{- with $pageMeta }} 5 |
6 | {{- range . }} 7 | {{- $metaFieldPath := printf "entry/meta/%s.html" . -}} 8 | {{- partial $metaFieldPath $page -}} 9 | {{- end }} 10 |
11 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/svg/medium.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/svg/telegram.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/footer_copyright.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/404.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 |
3 |
4 |
5 |

{{ T "page404_title" }}

6 |

{{ T "page404_lead" }}

7 | {{ T "page404_link" }} 8 |
9 |
10 |
11 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/svg/twitter.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/entry/tags.html: -------------------------------------------------------------------------------- 1 | {{- $taxo := "tags" -}} 2 | {{- with .Param $taxo }} 3 |
4 | {{- range . }} 5 | {{- $url := urls.Parse (. | urlize) -}} 6 | {{- $path := $url.Path -}} 7 | {{- with $.Site.GetPage (printf "/%s/%s" $taxo $path) }} 8 | {{ .Title }} 9 | {{- end }} 10 | {{- end }} 11 |
12 | {{- end }} -------------------------------------------------------------------------------- /theme.toml: -------------------------------------------------------------------------------- 1 | name = "Amnix" 2 | license = "MIT" 3 | licenselink = "https://github.com/vimux/amnix/blob/master/LICENSE" 4 | description = "Responsive and configurable Hugo theme" 5 | homepage = "https://github.com/vimux/amnix/" 6 | tags = ["blog", "light", "disqus", "google analytics", "responsive"] 7 | features = [] 8 | min_version = "0.54.0" 9 | 10 | [author] 11 | name = "Vimux" 12 | homepage = "https://github.com/vimux" 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = tab 7 | end_of_line = lf 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{json,yaml,yml,toml,md,babelrc,eslintrc,stylelintrc}] 15 | indent_style = space 16 | indent_size = 2 17 | 18 | [layouts/**.{html,svg}] 19 | insert_final_newline = false 20 | -------------------------------------------------------------------------------- /static/js/menu.js: -------------------------------------------------------------------------------- 1 | const toggle = document.getElementById('toggle'); 2 | const menu = document.getElementById('menu'); 3 | 4 | function toggleMenu() { 5 | menu.classList.toggle('main-nav__list--active'); 6 | this.classList.toggle('main-nav__btn--active'); 7 | this.setAttribute( 8 | 'aria-expanded', 9 | this.getAttribute('aria-expanded') === 'true' ? 'false' : 'true' 10 | ); 11 | } 12 | 13 | toggle.addEventListener('click', toggleMenu, false); 14 | -------------------------------------------------------------------------------- /exampleSite/config.toml: -------------------------------------------------------------------------------- 1 | baseURL = "https://example.com/" 2 | languageCode = "en-us" 3 | title = "Amnix" 4 | theme = "amnix" 5 | paginate = 10 6 | 7 | [Params] 8 | description = "Responsive and configurable Hugo theme" 9 | columns = 2 10 | 11 | [Params.Entry] 12 | meta = ["date"] 13 | share = ["facebook", "twitter", "reddit"] 14 | 15 | [Params.Sidebar] 16 | widgets = ["recent", "categories", "tags"] 17 | 18 | [Params.Widgets] 19 | recentDate = true 20 | -------------------------------------------------------------------------------- /layouts/_default/summary.html: -------------------------------------------------------------------------------- 1 |
2 | {{- partial "entry/featured.html" (dict "page" . "link" .RelPermalink) }} 3 |
4 |

5 | {{ .Title }} 6 |

7 | {{ partial "entry/meta.html" . }} 8 |
9 | {{- with .Summary }} 10 |
{{ . }}
11 | {{- end }} 12 |
-------------------------------------------------------------------------------- /layouts/partials/svg/pocket.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/widgets/sidemenu.html: -------------------------------------------------------------------------------- 1 | {{- with .Site.Menus.side }} 2 |
3 |
4 |

{{ T "widget-sidemenu_title" }}

5 | 14 |
15 |
16 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/svg/pinterest.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/svg/vk.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/svg/mastodon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/svg/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/related.html: -------------------------------------------------------------------------------- 1 | {{- $relatedMax := (.Site.Params.relatedMax | default 5) }} 2 | {{- $related := .Site.RegularPages.Related . | first $relatedMax }} 3 | {{- if and ($related) (.Param "related") }} 4 | 12 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/footer_social.html: -------------------------------------------------------------------------------- 1 | {{- if .Site.Params.social }} 2 | 14 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/svg/reddit.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/entry/meta/date.html: -------------------------------------------------------------------------------- 1 | {{- if or (not .Date.IsZero) (ne .Date .Lastmod) }} 2 | {{- if not .Date.IsZero }} 3 | 6 | {{- end }} 7 | {{- if ne .Date .Lastmod }} 8 | 9 | 12 | {{- end }} 13 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/widgets/categories.html: -------------------------------------------------------------------------------- 1 | {{- $categories := .Site.Taxonomies.categories }} 2 | {{- if gt (len $categories) 0 }} 3 |
4 |
5 |

{{ T "widget-categories_title" }}

6 |
7 |
    8 | {{- range $name, $taxonomy := $categories }} 9 | {{- with $.Site.GetPage (printf "/categories/%s" $name) }} 10 |
  • 11 | {{ .Title }} 12 |
  • 13 | {{- end }} 14 | {{- end }} 15 |
16 |
17 |
18 |
19 | {{- end }} -------------------------------------------------------------------------------- /layouts/_default/list.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 |
3 | {{ partial "breadcrumb.html" . }} 4 | {{ if or .Title .Content }} 5 |
6 | {{ with .Title }}

{{ . }}

{{ end }} 7 | {{ with .Content }} 8 |
9 | {{ . }} 10 |
11 | {{ end }} 12 |
13 | {{ end }} 14 |
15 | {{ range .Paginator.Pages }} 16 |
17 | {{ .Render "summary" }} 18 |
19 | {{ end }} 20 |
21 | {{ partial "pagination.html" (dict "page" . "class" "block") }} 22 |
23 | {{ end }} -------------------------------------------------------------------------------- /layouts/_default/single.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 |
3 | {{ partial "breadcrumb.html" . }} 4 |
5 |
6 | {{- partial "entry/featured.html" (dict "page" . "IsSingle" true) }} 7 |
8 |

{{ .Title }}

9 | {{ partial "entry/meta.html" . }} 10 |
11 |
{{ .Content }}
12 | {{ if or (isset $.Params "tags") (default .Site.Params.Entry.share .Params.share) }} 13 | 17 | {{ end }} 18 |
19 | {{ partial "related.html" . }} 20 | {{ partial "comments.html" . }} 21 |
22 |
23 | {{ end }} -------------------------------------------------------------------------------- /exampleSite/content/post/mathjax.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: MathJax 3 | description: Simple MathJax example test article 4 | date: 2018-04-14 5 | lastmod: 2018-04-15 6 | mathjax: true 7 | tags: 8 | - "MathJax" 9 | --- 10 | 11 | MathJax JavaScript library allows you to include mathematics in your web pages for viewing in any modern browser. 12 | 13 | 14 | ## How to enable MathJax 15 | 16 | For enabling MathJax, add this to your content's frontmatter: 17 | 18 | ```yaml 19 | mathjax: true 20 | ``` 21 | 22 | ## MathJax example 23 | 24 | **Input**: 25 | 26 | ``` 27 | When \\( a \ne 0 \\), there are two solutions to 28 | 29 | $$ ax^2 + bx + c = 0 $$ 30 | 31 | and they are: 32 | 33 | \\[ x = {-b \pm \sqrt{b^2-4ac} \over 2a} \\] 34 | ``` 35 | 36 | **Output**: 37 | 38 | When \\( a \ne 0 \\), there are two solutions to 39 | 40 | $$ ax^2 + bx + c = 0 $$ 41 | 42 | and they are: 43 | 44 | \\[ x = {-b \pm \sqrt{b^2-4ac} \over 2a} \\] 45 | -------------------------------------------------------------------------------- /layouts/partials/widgets/tags.html: -------------------------------------------------------------------------------- 1 | {{- $tags := .Site.Taxonomies.tags }} 2 | {{- if gt (len $tags) 0 }} 3 |
4 |
5 |

{{ T "widget-tags_title" }}

6 |
7 | 21 |
22 |
23 |
24 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/entry/share.html: -------------------------------------------------------------------------------- 1 | {{- if and .IsPage ($share := default .Site.Params.Entry.share .Params.share) }} 2 |
3 | {{- $size := 28 }} 4 | 5 | {{- range $share }} 6 | {{- range (where $.Site.Data.share.items ".id" "eq" .) }} 7 | {{- $svgClass := printf `%s %s%s %s` "share__icon" "share__icon--" .id "transition" }} 8 | {{- $href := replace .url "{{ .Permalink }}" ($.Permalink | htmlEscape) }} 9 | {{- $href = replace $href "{{ .Title }}" ($.Title | htmlEscape) }} 10 | 18 | {{ partial .icon (dict "class" $svgClass "size" $size) }} 19 | 20 | {{- end }} 21 | {{- end }} 22 |
23 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/widgets/recent.html: -------------------------------------------------------------------------------- 1 | {{ $recent := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} 2 | {{- if $recent }} 3 |
4 |
5 |

{{ T "widget-recent_title" }}

6 |
7 |
    8 | {{- $recentNum := .Site.Params.widgets.recentNum | default 5 }} 9 | {{- range first $recentNum $recent }} 10 | {{- if .Title }} 11 |
  • 12 | {{ .Title }} 13 | {{- if .Site.Params.Widgets.recentDate }} 14 |
    15 | 18 |
    19 | {{- end }} 20 |
  • 21 | {{- end }} 22 | {{- end }} 23 |
24 |
25 |
26 |
27 | {{- end }} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Vimux 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /layouts/index.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 | {{- $mainSections := .Site.Params.mainSections }} 3 | {{- $paginator := .Paginate (where .Site.RegularPages "Type" "in" $mainSections) }} 4 | {{- if ge $paginator.TotalNumberOfElements 1 }} 5 |
6 |
7 | {{- range $paginator.Pages }} 8 |
9 | {{ .Render "summary" }} 10 |
11 | {{- end }} 12 |
13 | {{ partial "pagination.html" (dict "page" . "class" "block") }} 14 |
15 | {{- else }} 16 |
17 |
18 |
19 |
¯\_(ツ)_/¯
20 |

{{ T "empty_title" }}

21 |

{{ T "empty_text_start" | safeHTML }} ({{ delimit (apply $mainSections "printf" "content/%s" ".") ", " | safeHTML }}), {{ T "empty_text_end" }}.

22 |

{{ T "empty_tip" | safeHTML }}

23 |
24 |
25 |
26 | {{- end }} 27 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/header_menu.html: -------------------------------------------------------------------------------- 1 | {{- if .Site.Menus.main }} 2 | 25 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/pagination.html: -------------------------------------------------------------------------------- 1 | {{- $pag := .page.Paginator }} 2 | {{- if gt $pag.TotalPages 1 }} 3 |
4 | {{- $ellipsed := false }} 5 | {{- $shouldEllipse := false }} 6 | {{- range $pag.Pagers }} 7 | {{- $right := sub .TotalPages .PageNumber }} 8 | {{- $showNumber := or (le .PageNumber 3) (eq $right 0) }} 9 | {{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) }} 10 | {{- if $showNumber }} 11 | {{- $ellipsed = false }} 12 | {{- $shouldEllipse = false }} 13 | {{- else }} 14 | {{- $shouldEllipse = not $ellipsed }} 15 | {{- $ellipsed = true }} 16 | {{- end }} 17 | {{- if $showNumber }} 18 | {{- if eq . $pag }} 19 | 20 | {{- .PageNumber -}} 21 | 22 | {{- else }} 23 | {{ .PageNumber }} 24 | {{- end }} 25 | {{- else if $shouldEllipse }} 26 | 27 | {{- end }} 28 | {{- end }} 29 |
30 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/breadcrumb.html: -------------------------------------------------------------------------------- 1 | {{- $breadcrumb := default .Site.Params.Breadcrumb.enable .Params.breadcrumb -}} 2 | 3 | {{- define "breadcrumbnav" }} 4 | {{- if .p1.Parent -}} 5 | {{- template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2) -}} 6 | {{- else if not .p1.IsHome }} 7 | {{- template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2) -}} 8 | {{- end }} 9 | 10 | {{- $crumbTitle := .p1.Title | default "..." -}} 11 | {{- $crumbTitleHome := .p1.Site.Params.Breadcrumb.homeText | default .p1.Site.Title -}} 12 | {{- if .p1.IsHome -}} 13 | {{- $crumbTitle = $crumbTitleHome -}} 14 | {{- end -}} 15 | 16 | {{- if ne .p1 .p2 }} 17 | 20 | {{- else }} 21 | 22 | {{- end }} 23 | {{- end }} 24 | 25 | {{- if $breadcrumb }} 26 | 31 | {{- end }} -------------------------------------------------------------------------------- /data/share.toml: -------------------------------------------------------------------------------- 1 | [[items]] 2 | id = "facebook" 3 | title = "Facebook" 4 | url = "https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" 5 | icon = "svg/facebook.svg" 6 | 7 | [[items]] 8 | id = "twitter" 9 | title = "Twitter" 10 | url = "https://twitter.com/intent/tweet/?url={{ .Permalink }}&text={{ .Title }}" 11 | icon = "svg/twitter.svg" 12 | 13 | [[items]] 14 | id = "reddit" 15 | title = "Reddit" 16 | url = "https://www.reddit.com/submit?url={{ .Permalink }}&title={{ .Title }}" 17 | icon = "svg/reddit.svg" 18 | 19 | [[items]] 20 | id = "telegram" 21 | title = "Telegram" 22 | url = "https://t.me/share/url?url={{ .Permalink }}&title={{ .Title }}" 23 | icon = "svg/telegram.svg" 24 | 25 | [[items]] 26 | id = "linkedin" 27 | title = "LinkedIn" 28 | url = "https://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink }}&title={{ .Title }}" 29 | icon = "svg/linkedin.svg" 30 | 31 | [[items]] 32 | id = "vk" 33 | title = "VK" 34 | url = "https://vk.com/share.php?url={{ .Permalink }}" 35 | icon = "svg/vk.svg" 36 | 37 | [[items]] 38 | id = "pocket" 39 | title = "Pocket" 40 | url = "https://getpocket.com/edit?url={{ .Permalink }}&title={{ .Title }}" 41 | icon = "svg/pocket.svg" 42 | -------------------------------------------------------------------------------- /layouts/partials/sidebar.html: -------------------------------------------------------------------------------- 1 | {{- $page := . }} 2 | {{- $sidebarFront := .Params.sidebar }} 3 | {{- $sidebarPositionSite := .Site.Params.sidebar.position | default "right" }} 4 | {{- $sidebarPositionKind := "" }} 5 | {{- $sidebarPositionFront := "" }} 6 | 7 | {{- if reflect.IsMap $sidebarFront }} 8 | {{ $sidebarPositionFront = $sidebarFront.position }} 9 | {{ $sidebarFront = $sidebarFront.widgets }} 10 | {{- end }} 11 | 12 | {{- if eq $.Kind "page" }} 13 | {{ $sidebarPositionKind = .Site.Params.sidebar.positionSingle }} 14 | {{- else if eq $.Kind "home" }} 15 | {{ $sidebarPositionKind = .Site.Params.sidebar.positionHome }} 16 | {{- else }} 17 | {{ $sidebarPositionKind = .Site.Params.sidebar.positionList }} 18 | {{- end }} 19 | 20 | {{- $sidebarPosition := default (default $sidebarPositionSite $sidebarPositionKind) $sidebarPositionFront }} 21 | {{- $widgetsList := default .Site.Params.sidebar.widgets $sidebarFront }} 22 | 23 | {{- if and $widgetsList $sidebarPosition -}} 24 | 30 | {{- end }} -------------------------------------------------------------------------------- /i18n/en.yaml: -------------------------------------------------------------------------------- 1 | # Meta 2 | - id: lastmod-caption 3 | translation: "Updated" 4 | 5 | # Related 6 | - id: related_title 7 | translation: "Related" 8 | 9 | # Widgets 10 | - id: widget-recent_title 11 | translation: "Recent Posts" 12 | 13 | - id: widget-categories_title 14 | translation: "Categories" 15 | 16 | - id: widget-tags_title 17 | translation: "Tags" 18 | 19 | - id: widget-sidemenu_title 20 | translation: "Menu" 21 | 22 | # Share 23 | - id: share-caption 24 | translation: "Share on" 25 | 26 | # Footer 27 | - id: footer_credits 28 | translation: "Powered by Hugo and \ 29 | Amnix theme." 30 | 31 | # "No posts" empty state 32 | - id: empty_title 33 | translation: "You don't have any posts yet!" 34 | 35 | - id: empty_text_start 36 | translation: "As posts are added in your mainSection folders" 37 | 38 | - id: empty_text_end 39 | translation: "they'll appear here" 40 | 41 | - id: empty_tip 42 | translation: "Tip: You could change mainSection folders in your site config file." 43 | 44 | # 404 45 | - id: page404_title 46 | translation: "404 Page not found" 47 | 48 | - id: page404_lead 49 | translation: "Sorry, the page you were looking for doesn't exist." 50 | 51 | - id: page404_link 52 | translation: "Go back to main page" 53 | -------------------------------------------------------------------------------- /exampleSite/content/about.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: About Hugo 3 | description: Hugo, the world’s fastest framework for building websites 4 | date: 2019-02-28 5 | author: Hugo Authors 6 | menu: main 7 | --- 8 | 9 | Written in Go, Hugo is an open source static site generator available under the [Apache Licence 2.0.](https://github.com/gohugoio/hugo/blob/master/LICENSE) Hugo supports TOML, YAML and JSON data file types, Markdown and HTML content files and uses shortcodes to add rich content. Other notable features are taxonomies, multilingual mode, image processing, custom output formats, HTML/CSS/JS minification and support for Sass SCSS workflows. 10 | 11 | Hugo makes use of a variety of open source projects including: 12 | 13 | * https://github.com/russross/blackfriday 14 | * https://github.com/alecthomas/chroma 15 | * https://github.com/muesli/smartcrop 16 | * https://github.com/spf13/cobra 17 | * https://github.com/spf13/viper 18 | 19 | Hugo is ideal for blogs, corporate websites, creative portfolios, online magazines, single page applications or even a website with thousands of pages. 20 | 21 | Hugo is for people who want to hand code their own website without worrying about setting up complicated runtimes, dependencies and databases. 22 | 23 | Websites built with Hugo are extremelly fast, secure and can be deployed anywhere including, AWS, GitHub Pages, Heroku, Netlify and any other hosting provider. 24 | 25 | Learn more and contribute on [GitHub](https://github.com/gohugoio). 26 | -------------------------------------------------------------------------------- /layouts/index.manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{ .Site.Params.Manifest.name | default .Site.Title }}", 3 | "short_name": "{{ .Site.Params.Manifest.shortName | default .Site.Title }}", 4 | "display": "{{ .Site.Params.Manifest.display | default "standalone" }}", 5 | "start_url": "{{ .Site.Params.Manifest.startUrl | default "/" }}", 6 | "background_color": "{{ .Site.Params.Manifest.backgroundColor | default "#33333a" }}", 7 | "theme_color": "{{ .Site.Params.Manifest.themeColor | default "#5b5b67" }}", 8 | {{- with .Site.Params.Manifest.description }} 9 | "description": "{{ . }}", 10 | {{- end }} 11 | {{- with .Site.Params.Manifest.orientation }} 12 | "orientation": "{{ . }}", 13 | {{- end }} 14 | {{- with .Site.Params.Manifest.scope }} 15 | "scope": "{{ . }}", 16 | {{- end }} 17 | "icons": [ 18 | { 19 | "src": "icons/48.png", 20 | "sizes": "48x48", 21 | "type": "image/png" 22 | }, 23 | { 24 | "src": "icons/72.png", 25 | "sizes": "72x72", 26 | "type": "image/png" 27 | }, 28 | { 29 | "src": "icons/96.png", 30 | "sizes": "96x96", 31 | "type": "image/png" 32 | }, 33 | { 34 | "src": "icons/144.png", 35 | "sizes": "144x144", 36 | "type": "image/png" 37 | }, 38 | { 39 | "src": "icons/192.png", 40 | "sizes": "192x192", 41 | "type": "image/png" 42 | }, 43 | { 44 | "src": "icons/512.png", 45 | "sizes": "512x512", 46 | "type": "image/png" 47 | } 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /data/social.toml: -------------------------------------------------------------------------------- 1 | [[icons]] 2 | id = "email" 3 | url = "mailto:%s" 4 | icon = "svg/email.svg" 5 | weight = 10 6 | 7 | [[icons]] 8 | id = "facebook" 9 | url = "https://www.facebook.com/%s" 10 | icon = "svg/facebook.svg" 11 | weight = 20 12 | 13 | [[icons]] 14 | id = "twitter" 15 | url = "https://twitter.com/%s" 16 | icon = "svg/twitter.svg" 17 | weight = 30 18 | 19 | [[icons]] 20 | id = "telegram" 21 | url = "https://t.me/%s" 22 | icon = "svg/telegram.svg" 23 | weight = 40 24 | 25 | [[icons]] 26 | id = "instagram" 27 | url = "https://www.instagram.com/%s" 28 | icon = "svg/instagram.svg" 29 | weight = 50 30 | 31 | [[icons]] 32 | id = "pinterest" 33 | url = "https://www.pinterest.com/%s" 34 | icon = "svg/pinterest.svg" 35 | weight = 60 36 | 37 | [[icons]] 38 | id = "vk" 39 | url = "https://vk.com/%s" 40 | icon = "svg/vk.svg" 41 | weight = 70 42 | 43 | [[icons]] 44 | id = "linkedin" 45 | url = "https://linkedin.com/in/%s" 46 | icon = "svg/linkedin.svg" 47 | weight = 80 48 | 49 | [[icons]] 50 | id = "github" 51 | url = "https://github.com/%s" 52 | icon = "svg/github.svg" 53 | weight = 90 54 | 55 | [[icons]] 56 | id = "gitlab" 57 | url = "https://gitlab.com/%s" 58 | icon = "svg/gitlab.svg" 59 | weight = 100 60 | 61 | [[icons]] 62 | id = "stackoverflow" 63 | url = "https://stackoverflow.com/users/%s" 64 | icon = "svg/stackoverflow.svg" 65 | weight = 110 66 | 67 | [[icons]] 68 | id = "mastodon" 69 | url = "%s" 70 | icon = "svg/mastodon.svg" 71 | weight = 120 72 | 73 | [[icons]] 74 | id = "medium" 75 | url = "https://medium.com/@%s" 76 | icon = "svg/medium.svg" 77 | weight = 130 78 | -------------------------------------------------------------------------------- /layouts/partials/entry/featured.html: -------------------------------------------------------------------------------- 1 | {{- with .page.Resources.ByType "image" }} 2 | {{- $link := $.link -}} 3 | {{- $IsSingle := $.IsSingle -}} 4 | {{- $match := $.page.Params.featured -}} 5 | {{- $featuredMap := "" -}} 6 | 7 | {{- $IsMap := reflect.IsMap $match -}} 8 | {{- if $IsMap }} 9 | {{- $featuredMap = $match -}} 10 | {{- $match = $match.url -}} 11 | {{- end }} 12 | 13 | {{- $featured := .GetMatch ($match | default "{featured.*,thumbnail.*}") -}} 14 | {{ if and $featured (not (and $IsSingle ($.page.Param "featured.previewOnly"))) }} 15 | {{ $featured320 := $featured.Resize "320x" }} 16 | {{ $featured600 := $featured.Resize "600x" }} 17 | {{ $featured900 := $featured.Resize "900x" }} 18 |
19 | {{- with $link }}{{ end }} 20 | 
21 | 					{{- with $featuredMap -}}
22 | 						{{- .alt | default $featured.Title -}}
23 | 					{{- else -}}
24 | 						{{- $featured.Title -}}
25 | 					{{- end -}}
26 | 				27 | {{- with $link }}{{ end }} 28 | {{- with $IsSingle }} 29 | {{- with $featuredMap }} 30 | {{- if or .caption .credit }} 31 | 39 | {{- end }} 40 | {{- end }} 41 | {{- end }} 42 |
43 | {{- end }} 44 | {{- end }} -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "amnix", 3 | "version": "1.0.0", 4 | "description": "Responsive and configurable Hugo theme", 5 | "license": "MIT", 6 | "dependencies": {}, 7 | "devDependencies": { 8 | "autoprefixer": "^10.4.16", 9 | "editorconfig-checker": "^5.1.1", 10 | "eslint": "^8.52.0", 11 | "eslint-config-airbnb-base": "^15.0.0", 12 | "eslint-plugin-import": "^2.29.0", 13 | "postcss": "^8.4.31", 14 | "postcss-cli": "^10.1.0", 15 | "stylelint": "^15.11.0", 16 | "stylelint-order": "^6.0.3" 17 | }, 18 | "browserslist": [ 19 | "> 0.25%", 20 | "last 2 version", 21 | "not dead", 22 | "IE 11", 23 | "iOS >= 9" 24 | ], 25 | "postcss": { 26 | "plugins": { 27 | "autoprefixer": { 28 | "cascade": false 29 | } 30 | } 31 | }, 32 | "eslintConfig": { 33 | "extends": "airbnb-base", 34 | "env": { 35 | "browser": true 36 | }, 37 | "rules": { 38 | "indent": [ 39 | 2, 40 | "tab" 41 | ], 42 | "comma-dangle": [ 43 | "error", 44 | { 45 | "arrays": "always-multiline", 46 | "objects": "always-multiline", 47 | "imports": "always-multiline", 48 | "exports": "always-multiline", 49 | "functions": "ignore" 50 | } 51 | ], 52 | "no-tabs": 0 53 | } 54 | }, 55 | "scripts": { 56 | "lint": "npm run lint:css && npm run lint:js && npm run lint:editorconfig", 57 | "lint:css": "stylelint assets/css/*.css", 58 | "lint:js": "eslint static/js/*.js", 59 | "lint:editorconfig": "editorconfig-checker", 60 | "fix": "npm run fix:prefixes && npm run fix:css && npm run fix:js", 61 | "fix:prefixes": "postcss -r assets/css/*.css", 62 | "fix:css": "stylelint assets/css/*.css --fix", 63 | "fix:js": "eslint static/js/*.js --fix", 64 | "test": "npm run lint" 65 | }, 66 | "repository": { 67 | "type": "git", 68 | "url": "git+https://github.com/vimux/amnix.git" 69 | }, 70 | "bugs": { 71 | "url": "https://github.com/vimux/amnix/issues" 72 | }, 73 | "homepage": "https://github.com/vimux/amnix" 74 | } 75 | -------------------------------------------------------------------------------- /.github/workflows/ci-test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths-ignore: 8 | - "README.md" 9 | pull_request: 10 | paths-ignore: 11 | - "README.md" 12 | 13 | jobs: 14 | lint: 15 | runs-on: ubuntu-latest 16 | strategy: 17 | matrix: 18 | node: 19 | - '20.x' 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | - uses: actions/setup-node@v4 24 | with: 25 | node-version: ${{ matrix.node }} 26 | 27 | - name: Install npm dependencies 28 | run: npm ci 29 | 30 | - name: Lint 31 | run: npm run lint 32 | 33 | test-hugo: 34 | runs-on: ubuntu-latest 35 | strategy: 36 | matrix: 37 | hugo: 38 | - '0.54.0' # min version 39 | - '0.58.2' # https://github.com/gohugoio/hugoThemes/issues/682 40 | - '0.59.1' # last major version without goldmark renderer 41 | - '0.60.1' # first major version with goldmark renderer 42 | - '0.76.5' # https://github.com/gohugoio/hugo/issues/7822 43 | # - '0.80.0' # https://github.com/gohugoio/hugo/issues/8340 44 | - '0.86.1' # https://github.com/gohugoio/hugo/issues/9150 45 | - '0.93.3' # https://github.com/gohugoio/hugo/commit/837fdfdf45014e3d5ef3b00b01548b68a4489c5f 46 | - 'latest' 47 | fail-fast: true 48 | 49 | steps: 50 | - uses: actions/checkout@v4 51 | 52 | # https://github.com/peaceiris/actions-hugo (community action) 53 | - name: Run Hugo ${{ matrix.hugo }} 54 | uses: peaceiris/actions-hugo@v3 55 | with: 56 | hugo-version: ${{ matrix.hugo }} 57 | # extended: true 58 | 59 | - name: Build with Hugo ${{ matrix.hugo }} 60 | working-directory: exampleSite 61 | run: | 62 | function ver { printf "%03d%03d%03d" $(echo "$1" | tr '.' ' '); } 63 | HUGO_VERSION=$(hugo version | grep -Eo '[0-9]\.[0-9]+\.[0-9]+') 64 | # The option changed in 0.93.0: https://github.com/gohugoio/hugo/releases/tag/v0.93.0 65 | I18N_OPT=$([ $(ver $HUGO_VERSION) -lt $(ver 0.93.0) ] && echo "--i18n-warnings" || echo "--printI18nWarnings") 66 | # The option deprecated in v0.114.0 (WARNs >= 0.120.0): https://github.com/gohugoio/hugo/releases/tag/v0.114.0 67 | LOG_OPT=$([ $(ver $HUGO_VERSION) -lt $(ver 0.114.0) ] && echo "--verbose" || echo "--logLevel info") 68 | HUGO_THEME="Amnix" hugo --themesDir ../.. $I18N_OPT $LOG_OPT 69 | -------------------------------------------------------------------------------- /exampleSite/content/post/featured-image/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Featured Image 3 | description: "In this page, we will explain what featured images are and show you some examples how to add a featured \ 4 | image for a page." 5 | date: 2018-04-13 6 | --- 7 | 8 | Featured image is the image that appears on summaries at the list pages and the top of content pages. Every content page 9 | in this theme can have a featured image. 10 | 11 | 12 | 13 | ## How to add a featured image 14 | 15 | Content pages in Hugo can have their images or any other files stored under the same directory of the page itself. 16 | In Hugo's terms, it's called **page bundle** and allows us to keep all assets together with a page content file. 17 | 18 | This theme uses [page bundles](https://gohugo.io/content-management/organization/#page-bundles) for featured images. 19 | There are two main different ways to add a featured image. 20 | 21 | ### Option 1. Put `featured.*` or `thumbnail.*` image in the page bundle 22 | 23 | This theme considers `featured` or `thumbnail` image in any popular graphic format in the root of the page bundle as 24 | a featured image. 25 | 26 | Directory structure of this page: 27 | 28 | ``` 29 | content 30 | └── post 31 | └── featured-image // single page folder (page bundle) 32 | ├── featured.png // featured image 33 | └── index.md // page content file 34 | ``` 35 | 36 | ### Option 2. Put any image in the page bundle & specify `featured` param 37 | 38 | You may put any image in the page bundle and specify `featured` param in the page's front matter: 39 | 40 | ```yaml 41 | featured: image.jpg 42 | ``` 43 | 44 | - `featured` [`String`]: relative path of the image 45 | 46 | Or you can add some additional params like `alt`, `caption`, `credit` and `previewOnly`: 47 | 48 | ```yaml 49 | featured: 50 | url: image.jpg 51 | alt: A scale model of the Eiffel tower standing on a map 52 | caption: Eiffel tower model 53 | credit: Unknown author 54 | previewOnly: false 55 | ``` 56 | 57 | - `featured` [`Map`]: 58 | - `url` [`String`]: relative path of the image 59 | - `alt` [`String`]: alternate text for the image 60 | - `caption` [`String`]: image caption 61 | - `credit` [`String`]: image credit 62 | - `previewOnly` [`Boolean`]: show only preview image 63 | 64 | ## FAQ 65 | 66 | **Q**: _What will happen if I specify `alt`, `caption`, `credit` params, but miss `url`? Featured image will be shown or 67 | not?_\ 68 | **A**: In that case, featured image would appear only if the page bundle contains `featured.*` or `thumbnail.*` image. 69 | Otherwise, you'll get nothing. 70 | 71 | **Q**: _Is featured image path case sensitive or insensitive? Featured.png and featured.png are different image relative 72 | paths for Hugo?_\ 73 | **A**: The image matching is case-insensitive. In that case, Featured.png and featured.png are identical for Hugo. 74 | -------------------------------------------------------------------------------- /layouts/_default/baseof.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{ block "title" . }}{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }}{{ end }} 8 | 9 | 10 | {{- if .Site.Params.opengraph }} 11 | {{ template "_internal/opengraph.html" . }} 12 | {{- end }} 13 | {{- if .Site.Params.schema }} 14 | {{ template "_internal/schema.html" . }} 15 | {{- end }} 16 | {{- if .Site.Params.twitterCards }} 17 | {{ template "_internal/twitter_cards.html" . }} 18 | {{- end }} 19 | 20 | {{- $cssReboot := resources.Get "css/reboot.css" }} 21 | {{- $cssMain := resources.Get "css/main.css" }} 22 | {{- $style := slice $cssReboot $cssMain | resources.Concat "css/bundle.css" }} 23 | 24 | 25 | {{- range .Site.Params.customCSS }} 26 | 27 | {{- end }} 28 | {{ with .OutputFormats.Get "rss" -}} 29 | {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} 30 | {{- end }} 31 | 32 | 33 | 34 | {{- with ((.Site.GetPage "home").OutputFormats.Get "manifest") }} 35 | 36 | {{- end }} 37 | {{- if not .Site.IsServer }} 38 | {{ template "_internal/google_analytics.html" . }} 39 | {{- end }} 40 | {{ partial "head_custom.html" . }} 41 | 42 | 43 | {{ block "header" . }}{{ partial "header" . }}{{ end }} 44 |
45 | {{ block "main" . }} 46 | {{- if or .Title .Content }} 47 |
48 | {{ with .Title }}

{{ . }}

{{ end }} 49 | {{ with .Content }}
{{ . }}
{{ end }} 50 |
51 | {{ end }} 52 | {{ end }} 53 | {{ block "sidebar" . }} 54 | {{ partial "sidebar.html" . }} 55 | {{ end }} 56 |
57 | {{ block "footer" . }}{{ partial "footer" . }}{{ end }} 58 | {{ partial "scripts.html" . }} 59 | {{ partial "body_custom.html" . }} 60 | 61 | -------------------------------------------------------------------------------- /exampleSite/content/post/hugoisforlovers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Getting Started with Hugo 3 | date: 2014-04-02 4 | tags: 5 | - "go" 6 | - "golang" 7 | - "hugo" 8 | - "development" 9 | categories: 10 | - "Development" 11 | - "golang" 12 | menu: main 13 | --- 14 | 15 | ## Step 1. Install Hugo 16 | 17 | Go to [Hugo releases](https://github.com/spf13/hugo/releases) and download the 18 | appropriate version for your OS and architecture. 19 | 20 | Save it somewhere specific as we will be using it in the next step. 21 | 22 | More complete instructions are available at [Install Hugo](https://gohugo.io/getting-started/installing/) 23 | 24 | ## Step 2. Build the Docs 25 | 26 | Hugo has its own example site which happens to also be the documentation site 27 | you are reading right now. 28 | 29 | Follow the following steps: 30 | 31 | 1. Clone the [Hugo repository](https://github.com/spf13/hugo) 32 | 2. Go into the repo 33 | 3. Run hugo in server mode and build the docs 34 | 4. Open your browser to http://localhost:1313 35 | 36 | Corresponding pseudo commands: 37 | 38 | git clone https://github.com/spf13/hugo 39 | cd hugo 40 | /path/to/where/you/installed/hugo server --source=./docs 41 | > 29 pages created 42 | > 0 tags index created 43 | > in 27 ms 44 | > Web Server is available at http://localhost:1313 45 | > Press ctrl+c to stop 46 | 47 | Once you've gotten here, follow along the rest of this page on your local build. 48 | 49 | ## Step 3. Change the docs site 50 | 51 | Stop the Hugo process by hitting Ctrl+C. 52 | 53 | Now we are going to run hugo again, but this time with hugo in watch mode. 54 | 55 | /path/to/hugo/from/step/1/hugo server --source=./docs --watch 56 | > 29 pages created 57 | > 0 tags index created 58 | > in 27 ms 59 | > Web Server is available at http://localhost:1313 60 | > Watching for changes in /Users/spf13/Code/hugo/docs/content 61 | > Press ctrl+c to stop 62 | 63 | 64 | Open your [favorite editor](http://vim.spf13.com) and change one of the source 65 | content pages. How about changing this very file to *fix the typo*. How about changing this very file to *fix the typo*. 66 | 67 | Content files are found in `docs/content/`. Unless otherwise specified, files 68 | are located at the same relative location as the url, in our case 69 | `docs/content/overview/quickstart.md`. 70 | 71 | Change and save this file.. Notice what happened in your terminal. 72 | 73 | > Change detected, rebuilding site 74 | 75 | > 29 pages created 76 | > 0 tags index created 77 | > in 26 ms 78 | 79 | Refresh the browser and observe that the typo is now fixed. 80 | 81 | Notice how quick that was. Try to refresh the site before it's finished building. I double dare you. 82 | Having nearly instant feedback enables you to have your creativity flow without waiting for long builds. 83 | 84 | ## Step 4. Have fun 85 | 86 | The best way to learn something is to play with it. 87 | -------------------------------------------------------------------------------- /exampleSite/content/post/basic-elements.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Basic HTML Elements 3 | description: Example test article that contains basic HTML elements for text formatting on the Web. 4 | date: 2018-04-16 5 | categories: 6 | - "Development" 7 | tags: 8 | - "HTML" 9 | - "CSS" 10 | - "Basic Elements" 11 | --- 12 | 13 | The main purpose of this article is to make sure that all basic HTML Elements are decorated with CSS so as to not miss any possible elements when creating new themes for Hugo. 14 | 15 | 16 | ## Headings 17 | 18 | Let's start with all possible headings. The HTML `

`—`

` elements represent six levels of section headings. `

` is the highest section level and `

` is the lowest. 19 | 20 | # Heading 1 21 | ## Heading 2 22 | ### Heading 3 23 | #### Heading 4 24 | ##### Heading 5 25 | ###### Heading 6 26 | 27 | *** 28 | 29 | ## Paragraph 30 | 31 | According to the [HTML5 specification](https://www.w3.org/TR/html5/dom.html#elements) by [W3C](https://www.w3.org/), **HTML documents consist of a tree of elements and text**. Each element is denoted in the source by a [start tag](https://www.w3.org/TR/html5/syntax.html#syntax-start-tags), such as ``, and an [end tag](https://www.w3.org/TR/html5/syntax.html#syntax-end-tags), such as ``. (*Certain start tags and end tags can in certain cases be omitted and are implied by other tags.*) 32 | 33 | Elements can have attributes, which control how the elements work. For example, hyperlink are formed using the `a` element and its `href` attribute. 34 | 35 | ## List Types 36 | 37 | ### Ordered List 38 | 39 | 1. First item 40 | 2. Second item 41 | 3. Third item 42 | 43 | ### Unordered List 44 | 45 | * List item 46 | * Another item 47 | * And another item 48 | 49 | ### Nested list 50 | 51 | 73 | 74 | ### Definition List 75 | 76 | HTML also supports definition lists. 77 | 78 |
79 |
Blanco tequila
80 |
The purest form of the blue agave spirit...
81 |
Reposado tequila
82 |
Typically aged in wooden barrels for between two and eleven months...
83 |
84 | 85 | ## Blockquotes 86 | 87 | The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a `footer` or `cite` element, and optionally with in-line changes such as annotations and abbreviations. 88 | 89 | > Quoted text. 90 | > This line is part of the same quote. 91 | > Also you can *put* **Markdown** into a blockquote. 92 | 93 | Blockquote with a citation. 94 | 95 |
96 |

My goal wasn't to make a ton of money. It was to build good computers. I only started the company when I realized I could be an engineer forever.

97 |
Steve Wozniak
98 |
99 | 100 | According to Mozilla's website, Firefox 1.0 was released in 2004 and became a big success. 101 | 102 | ## Tables 103 | 104 | Tables aren't part of the core Markdown spec, but Hugo supports them. 105 | 106 | | ID | Make | Model | Year | 107 | | --- | --------- | ------- | ---- | 108 | | 1 | Honda | Accord | 2009 | 109 | | 2 | Toyota | Camry | 2012 | 110 | | 3 | Hyundai | Elantra | 2010 | 111 | 112 | Colons can be used to align columns. 113 | 114 | | Tables | Are | Cool | 115 | |:----------- |:-------------:| ------------:| 116 | | align: left | align: center | align: right | 117 | | align: left | align: center | align: right | 118 | | align: left | align: center | align: right | 119 | 120 | You can also use inline Markdown. 121 | 122 | | Inline | Markdown | In | Table | 123 | | ---------- | --------- | ----------------- | ---------- | 124 | | *italics* | **bold** | ~~strikethrough~~ | `code` | 125 | 126 | ## Code 127 | 128 | ```html 129 | 130 | 131 | 132 | 133 | Example HTML5 Document 134 | 135 | 136 |

Test

137 | 138 | 139 | ``` 140 | 141 | {{< highlight html >}} 142 | 143 | 144 | 145 | 146 | Example HTML5 Document 147 | 148 | 149 |

Test

150 | 151 | 152 | {{< /highlight >}} 153 | 154 | ## Other stuff — abbr, sub, sup, kbd, etc. 155 | 156 | GIF is a bitmap image format. 157 | 158 | H2O 159 | 160 | C6H12O6 161 | 162 | Xn + Yn = Zn 163 | 164 | Press X to win. Or press CTRL+ALT+F to show FPS counter. 165 | 166 | As a unit of information in information theory, the bit has alternatively been called a shannon, named after Claude Shannon, the founder of field of information theory. 167 | -------------------------------------------------------------------------------- /assets/css/reboot.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Based on Bootstrap Reboot v4.3.1 (https://github.com/twbs/bootstrap/blob/1770691b339b/dist/css/bootstrap-reboot.css) 3 | * Licensed under MIT 4 | */ 5 | *, 6 | *::before, 7 | *::after { 8 | box-sizing: border-box; 9 | } 10 | 11 | body { 12 | margin: 0; 13 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 14 | font-size: 1rem; 15 | font-weight: 400; 16 | line-height: 1.5; 17 | color: #212529; 18 | text-align: left; 19 | background-color: #fff; 20 | -webkit-text-size-adjust: 100%; 21 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 22 | } 23 | 24 | [tabindex="-1"]:focus:not(:focus-visible) { 25 | outline: 0 !important; 26 | } 27 | 28 | hr { 29 | margin: 1rem 0; 30 | color: inherit; 31 | background-color: currentColor; 32 | border: 0; 33 | } 34 | 35 | hr:not([size]) { 36 | height: 1px; 37 | } 38 | 39 | h1, 40 | h2, 41 | h3, 42 | h4, 43 | h5, 44 | h6 { 45 | margin-top: 0; 46 | margin-bottom: .5rem; 47 | font-weight: 600; 48 | } 49 | 50 | h1 { 51 | font-size: 2rem; 52 | } 53 | 54 | h2 { 55 | font-size: 1.75rem; 56 | } 57 | 58 | h3 { 59 | font-size: 1.5rem; 60 | } 61 | 62 | h4 { 63 | font-size: 1.375rem; 64 | } 65 | 66 | h5 { 67 | font-size: 1.25rem; 68 | } 69 | 70 | h6 { 71 | font-size: 1.125rem; 72 | } 73 | 74 | p { 75 | margin-top: 0; 76 | margin-bottom: 1rem; 77 | } 78 | 79 | abbr { 80 | text-decoration: none; 81 | cursor: help; 82 | -webkit-text-decoration-skip-ink: none; 83 | text-decoration-skip-ink: none; 84 | } 85 | 86 | address { 87 | margin-bottom: 1rem; 88 | font-style: normal; 89 | line-height: inherit; 90 | } 91 | 92 | ol, 93 | ul { 94 | padding-left: 2rem; 95 | } 96 | 97 | ol, 98 | ul, 99 | dl { 100 | margin-top: 0; 101 | margin-bottom: 1rem; 102 | } 103 | 104 | ol ol, 105 | ul ul, 106 | ol ul, 107 | ul ol { 108 | margin-bottom: 0; 109 | } 110 | 111 | dt { 112 | font-weight: 700; 113 | } 114 | 115 | dd { 116 | margin-bottom: .5rem; 117 | margin-left: 0; 118 | } 119 | 120 | blockquote { 121 | margin: 0 0 1rem; 122 | } 123 | 124 | b, 125 | strong { 126 | font-weight: bolder; 127 | } 128 | 129 | small { 130 | font-size: .875em; 131 | } 132 | 133 | sub, 134 | sup { 135 | position: relative; 136 | font-size: .75em; 137 | line-height: 0; 138 | vertical-align: baseline; 139 | } 140 | 141 | sub { 142 | bottom: -.25em; 143 | } 144 | 145 | sup { 146 | top: -.5em; 147 | } 148 | 149 | a { 150 | color: #006fc6; 151 | text-decoration: none; 152 | } 153 | 154 | a:hover { 155 | color: #0056b3; 156 | text-decoration: underline; 157 | } 158 | 159 | a:not([href]), 160 | a:not([href]):hover { 161 | color: inherit; 162 | text-decoration: none; 163 | } 164 | 165 | pre, 166 | code, 167 | kbd, 168 | samp { 169 | font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 170 | font-size: 1em; 171 | } 172 | 173 | pre { 174 | display: block; 175 | margin-top: 0; 176 | margin-bottom: 1rem; 177 | overflow: auto; 178 | } 179 | 180 | pre code { 181 | font-size: inherit; 182 | color: inherit; 183 | word-break: normal; 184 | } 185 | 186 | code { 187 | color: #c33; 188 | word-wrap: break-word; 189 | } 190 | 191 | a > code { 192 | color: inherit; 193 | } 194 | 195 | kbd { 196 | padding: .125rem .1875rem; 197 | color: #fff; 198 | background-color: #222; 199 | } 200 | 201 | kbd kbd { 202 | padding: 0; 203 | } 204 | 205 | figure { 206 | margin: 0 0 1rem; 207 | } 208 | 209 | img { 210 | vertical-align: middle; 211 | } 212 | 213 | svg { 214 | overflow: hidden; 215 | vertical-align: middle; 216 | } 217 | 218 | table { 219 | border-collapse: collapse; 220 | } 221 | 222 | caption { 223 | padding: 0 0 .5rem; 224 | text-align: left; 225 | caption-side: top; 226 | } 227 | 228 | label { 229 | display: inline-block; 230 | margin-bottom: .5rem; 231 | } 232 | 233 | button { 234 | border-radius: 0; 235 | } 236 | 237 | button:focus { 238 | outline: 1px dotted; 239 | outline: 5px auto -webkit-focus-ring-color; 240 | } 241 | 242 | input, 243 | button, 244 | select, 245 | optgroup, 246 | textarea { 247 | margin: 0; 248 | font-family: inherit; 249 | font-size: inherit; 250 | line-height: inherit; 251 | } 252 | 253 | button, 254 | input { 255 | overflow: visible; 256 | } 257 | 258 | button, 259 | select { 260 | text-transform: none; 261 | } 262 | 263 | select { 264 | word-wrap: normal; 265 | } 266 | 267 | [list]::-webkit-calendar-picker-indicator { 268 | display: none; 269 | } 270 | 271 | button, 272 | [type="button"], 273 | [type="reset"], 274 | [type="submit"] { 275 | -webkit-appearance: button; 276 | } 277 | 278 | button:not(:disabled), 279 | [type="button"]:not(:disabled), 280 | [type="reset"]:not(:disabled), 281 | [type="submit"]:not(:disabled) { 282 | cursor: pointer; 283 | } 284 | 285 | ::-moz-focus-inner { 286 | padding: 0; 287 | border-style: none; 288 | } 289 | 290 | input[type="date"], 291 | input[type="time"], 292 | input[type="datetime-local"], 293 | input[type="month"] { 294 | -webkit-appearance: textfield; 295 | } 296 | 297 | textarea { 298 | overflow: auto; 299 | resize: vertical; 300 | } 301 | 302 | fieldset { 303 | min-width: 0; 304 | padding: 0; 305 | margin: 0; 306 | border: 0; 307 | } 308 | 309 | legend { 310 | float: left; 311 | width: 100%; 312 | padding: 0; 313 | margin-bottom: .5rem; 314 | font-size: 1.5rem; 315 | line-height: inherit; 316 | color: inherit; 317 | white-space: normal; 318 | } 319 | 320 | mark { 321 | padding: .2em 0; 322 | background-color: #fc3; 323 | } 324 | 325 | progress { 326 | vertical-align: baseline; 327 | } 328 | 329 | ::-webkit-datetime-edit { 330 | overflow: visible; 331 | line-height: 0; 332 | } 333 | 334 | [type="search"] { 335 | outline-offset: -2px; 336 | -webkit-appearance: textfield; 337 | } 338 | 339 | ::-webkit-search-decoration { 340 | -webkit-appearance: none; 341 | } 342 | 343 | ::-webkit-color-swatch-wrapper { 344 | padding: 0; 345 | } 346 | 347 | ::-webkit-file-upload-button { 348 | font: inherit; 349 | -webkit-appearance: button; 350 | } 351 | 352 | output { 353 | display: inline-block; 354 | } 355 | 356 | summary { 357 | display: list-item; 358 | cursor: pointer; 359 | } 360 | 361 | template { 362 | display: none; 363 | } 364 | 365 | main { 366 | display: block; 367 | } 368 | 369 | [hidden] { 370 | display: none !important; 371 | } 372 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Amnix 2 | 3 | **Amnix** welcomes contributions and corrections. Before contributing, please make sure you have read the guidelines 4 | below. If you're a newcomer to open source and you haven't contributed to other projects or used 5 | [Git](https://git-scm.com/) before, you should make yourself familiar before proceeding. 6 | 7 | ## Issues 8 | 9 | The [issue tracker](https://github.com/vimux/amnix/issues) is the preferred channel for bug reports and features 10 | requests, but please respect the following restrictions: 11 | 12 | ### General requirements 13 | 14 | * Issue must be written in English. 15 | * Please **do not** combine a few problems or feature requests in one issue. Create separate issues if needed. 16 | * Please **do not** create an issue that contains only title. Write a clear title and useful description. 17 | * Please **do not** use the issue tracker for personal support requests. 18 | * Please **do not** post comments consisting solely of "+1" or emoji. The project maintainer reserve the right to delete 19 | such comments. Use 20 | [GitHub's reactions feature](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) instead. 21 | * Search first before filing a new issue. Please check existing open or recently closed issues to make sure somebody 22 | else hasn't already reported the issue. 23 | 24 | ### Reporting bugs 25 | 26 | When creating a new bug issue make sure to include the following information: 27 | 28 | * Your environment e.g. OS version, Hugo version, theme is up to date? Anything unusual about your environment or 29 | deployment. 30 | * Specify the exact steps to reproduce the bug in as many details as possible with code examples. Include links to files 31 | or demo projects, or copy/pasteable snippets, which you use in those examples. 32 | * Any message or error you get from Hugo, if you do. 33 | * A screenshot of any visual bug. 34 | 35 | Please, take in consideration the next template to report your bug: 36 | 37 | > **Hugo version**\ 38 | > _Run `hugo version` and paste output here._ 39 | > 40 | > **Theme is up to date?**\ 41 | > _No | Yes_ 42 | > 43 | > **Expected behavior**\ 44 | > _A short and expressive description of what behavior you're expecting._ 45 | > 46 | > **Current behavior**\ 47 | > _A short sentence explaining what's actually happening, possibly containing screenshots._ 48 | > 49 | > **Steps to reproduce / Code to reproduce**\ 50 | > _A step by step description of how to trigger this bug. / Provide link to a demo project which reproduces this bug._ 51 | > 52 | > **Additional info**\ 53 | > _Anything unusual about your environment or deployment process? Anything else do we need to know? Optional._ 54 | 55 | **Note:** If you find a **Closed** issue that seems like it is the same bug that you're experiencing, open a new issue 56 | and include a link to the original issue in the body of your new one. 57 | 58 | ### Proposing features** 59 | 60 | * Explain the proposed feature, what it should do, why it is useful, and alternatives considered if possible. Please 61 | note that the project maintainer may close this issue or ask you to create a Pull Request if this is not something that 62 | the project maintainer sees as a sufficiently high priority. 63 | 64 | Following these guidelines helps maintainer and the community understand your suggestion and find related suggestions. 65 | 66 | ## Pull Requests (PR) 67 | 68 | **Please ask first** before embarking on any significant pull request (e.g. implementing features or refactoring code), 69 | otherwise, you risk spending a lot of time working on something that the project maintainer might not want to merge into 70 | the project. 71 | 72 | Please respect our Pull Request Acceptance Criteria. For larger changes, you will likely receive multiple rounds of 73 | comments and it may take some time to complete. 74 | 75 | ### Pull Request Acceptance Criteria 76 | 77 | * Keep the change in a single PR as small as possible 78 | * 1 PR = 1 FIX or FEATURE (do not combine things, send separate PR if needed) 79 | * PR with irrelevant changes won't be merged. If you do want to fix formatting or style, do that in a separate PR 80 | * Use a clear and descriptive branch name (e.g. **NOT** "patch-1" or "update") 81 | * Don't create a Pull Request from master branch 82 | * Provide a reasonable PR title and description 83 | * PR must be written in English 84 | * If the PR changes the UI it should include before-and-after screenshots or a link to a video 85 | * Keep PR up to date with upstream/master 86 | * Pay attention to any automated CI failures reported in the Pull Request 87 | * PR solves a common use case that several users will need in their real-life projects, not only your specific problems 88 | * If you've added or modify SVG, ensure that each SVG file: 89 | * Be less than 2048 bytes 90 | * Be minified to a single line with no formatting 91 | * Not contain any JS or CSS section inside it 92 | * Not contain any additional transformations (matrix, translate, scale) or negative viewBox position values 93 | * Сompatible with [MIT License](LICENSE) 94 | * Maintain clean commit history and use meaningful commit messages. Pull Requests with messy commit history (with 95 | commit messages like "update", "another update", etc) are difficult to review and won't be merged, even if the changes 96 | are good enough 97 | * Be prepared to answer questions and make code changes. The project maintainer expect you to be reasonably responsive 98 | to those feedback, otherwise the PR will be closed after 2-4 weeks of inactivity 99 | 100 | ### Pull Request Contribution Prerequisites 101 | 102 | * You have Node & npm installed 103 | * You have Hugo installed at v0.48.0+ 104 | * You are familiar with Git 105 | 106 | ### Pull Request Process 107 | 108 | 1. Fork the repository 109 | 1. Clone down the repository to your local system 110 | 1. Run `npm i` in the repository root 111 | 1. Create a new *dedicated branch* with descriptive name from `master` 112 | 1. Make your change and commit to the new branch from the previous step 113 | 1. Write a clear commit message 114 | 1. If you've added code that need documentation, update the README.md 115 | 1. Make sure your code lints (`npm test`) 116 | 1. Push to your fork 117 | 1. Submit a Pull Request (PR) to the upstream 118 | 119 | --- 120 | 121 | **⚠️ IMPORTANT: No guarantees can be made that your pull request will be accepted.** 122 | 123 | ## License 124 | 125 | By contributing to Amnix, you agree that your contributions will be licensed under [MIT License](LICENSE). 126 | -------------------------------------------------------------------------------- /exampleSite/content/post/migrate-from-jekyll.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Migrate to Hugo from Jekyll 3 | date: 2014-03-10 4 | linktitle: Migrating from Jekyll 5 | menu: 6 | main: 7 | name: Jekyll migration 8 | weight: 10 9 | --- 10 | 11 | ## Move static content to `static` 12 | 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. 13 | With Jekyll, something that looked like 14 | 15 | ▾ / 16 | ▾ images/ 17 | logo.png 18 | 19 | should become 20 | 21 | ▾ / 22 | ▾ static/ 23 | ▾ images/ 24 | logo.png 25 | 26 | Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`. 27 | 28 | ## Create your Hugo configuration file 29 | 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. 30 | 31 | ## Set your configuration publish folder to `_site` 32 | 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: 33 | 34 | 1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended). 35 | 36 | git submodule deinit _site 37 | git rm _site 38 | git submodule add -b gh-pages git@github.com:your-username/your-repo.git public 39 | 40 | 2. Or, change the Hugo configuration to use `_site` instead of `public`. 41 | 42 | { 43 | .. 44 | "publishdir": "_site", 45 | .. 46 | } 47 | 48 | ## Convert Jekyll templates to Hugo templates 49 | 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. 50 | 51 | As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours. 52 | 53 | ## Convert Jekyll plugins to Hugo shortcodes 54 | Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port. 55 | 56 | ### Implementation 57 | 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. 58 | 59 | Jekyll's plugin: 60 | 61 | module Jekyll 62 | class ImageTag < Liquid::Tag 63 | @url = nil 64 | @caption = nil 65 | @class = nil 66 | @link = nil 67 | // Patterns 68 | IMAGE_URL_WITH_CLASS_AND_CAPTION = 69 | IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i 70 | IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i 71 | IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i 72 | IMAGE_URL = /((https?:\/\/|\/)(\S+))/i 73 | def initialize(tag_name, markup, tokens) 74 | super 75 | if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK 76 | @class = $1 77 | @url = $3 78 | @caption = $7 79 | @link = $9 80 | elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION 81 | @class = $1 82 | @url = $3 83 | @caption = $7 84 | elsif markup =~ IMAGE_URL_WITH_CAPTION 85 | @url = $1 86 | @caption = $5 87 | elsif markup =~ IMAGE_URL_WITH_CLASS 88 | @class = $1 89 | @url = $3 90 | elsif markup =~ IMAGE_URL 91 | @url = $1 92 | end 93 | end 94 | def render(context) 95 | if @class 96 | source = "
" 97 | else 98 | source = "
" 99 | end 100 | if @link 101 | source += "" 102 | end 103 | source += "" 104 | if @link 105 | source += "" 106 | end 107 | source += "
#{@caption}
" if @caption 108 | source += "
" 109 | source 110 | end 111 | end 112 | end 113 | Liquid::Template.register_tag('image', Jekyll::ImageTag) 114 | 115 | is written as this Hugo shortcode: 116 | 117 | 118 |
119 | {{ with .Get "link"}}{{ end }} 120 | 121 | {{ if .Get "link"}}{{ end }} 122 | {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} 123 |
{{ if isset .Params "title" }} 124 | {{ .Get "title" }}{{ end }} 125 | {{ if or (.Get "caption") (.Get "attr")}}

126 | {{ .Get "caption" }} 127 | {{ with .Get "attrlink"}} {{ end }} 128 | {{ .Get "attr" }} 129 | {{ if .Get "attrlink"}} {{ end }} 130 |

{{ end }} 131 |
132 | {{ end }} 133 |
134 | 135 | 136 | ### Usage 137 | I simply changed: 138 | 139 | {% 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/ %} 140 | 141 | to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`): 142 | 143 | {{%/* 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/" */%}} 144 | 145 | As a bonus, the shortcode named parameters are, arguably, more readable. 146 | 147 | ## Finishing touches 148 | ### Fix content 149 | 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. 150 | 151 | ### Clean up 152 | You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it. 153 | 154 | ## A practical example in a diff 155 | [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). 156 | -------------------------------------------------------------------------------- /.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "stylelint-order" 4 | ], 5 | "rules": { 6 | "at-rule-empty-line-before": [ 7 | "always", 8 | { 9 | "except": [ 10 | "blockless-after-same-name-blockless", 11 | "first-nested" 12 | ], 13 | "ignore": [ 14 | "after-comment" 15 | ] 16 | } 17 | ], 18 | "at-rule-name-case": "lower", 19 | "at-rule-name-space-after": "always-single-line", 20 | "at-rule-semicolon-newline-after": "always", 21 | "block-closing-brace-newline-after": "always", 22 | "block-closing-brace-empty-line-before": "never", 23 | "block-no-empty": true, 24 | "block-opening-brace-newline-after": "always-multi-line", 25 | "color-hex-case": "lower", 26 | "color-hex-length": "short", 27 | "color-no-invalid-hex": true, 28 | "comment-no-empty": true, 29 | "declaration-bang-space-after": "never", 30 | "declaration-bang-space-before": "always", 31 | "declaration-block-no-duplicate-properties": [ 32 | true, 33 | { 34 | "ignore": [ 35 | "consecutive-duplicates-with-different-values" 36 | ] 37 | } 38 | ], 39 | "declaration-block-no-shorthand-property-overrides": true, 40 | "declaration-block-semicolon-newline-after": "always-multi-line", 41 | "declaration-block-semicolon-space-after": "always-single-line", 42 | "declaration-block-semicolon-space-before": "never", 43 | "declaration-block-single-line-max-declarations": 1, 44 | "declaration-block-trailing-semicolon": "always", 45 | "declaration-colon-newline-after": "always-multi-line", 46 | "declaration-colon-space-after": "always-single-line", 47 | "declaration-colon-space-before": "never", 48 | "font-family-no-duplicate-names": true, 49 | "function-calc-no-unspaced-operator": true, 50 | "function-comma-newline-after": "always-multi-line", 51 | "function-comma-space-after": "always-single-line", 52 | "function-comma-space-before": "never", 53 | "function-linear-gradient-no-nonstandard-direction": true, 54 | "function-max-empty-lines": 0, 55 | "function-name-case": "lower", 56 | "function-parentheses-newline-inside": "always-multi-line", 57 | "function-parentheses-space-inside": "never-single-line", 58 | "function-whitespace-after": "always", 59 | "indentation": "tab", 60 | "keyframe-declaration-no-important": true, 61 | "length-zero-no-unit": true, 62 | "max-empty-lines": 1, 63 | "media-feature-colon-space-after": "always", 64 | "media-feature-colon-space-before": "never", 65 | "media-feature-name-case": "lower", 66 | "media-feature-name-no-unknown": true, 67 | "media-feature-parentheses-space-inside": "never", 68 | "media-feature-range-operator-space-after": "always", 69 | "media-feature-range-operator-space-before": "always", 70 | "media-query-list-comma-newline-after": "always-multi-line", 71 | "media-query-list-comma-space-after": "always-single-line", 72 | "media-query-list-comma-space-before": "never", 73 | "no-empty-source": true, 74 | "no-eol-whitespace": true, 75 | "no-extra-semicolons": true, 76 | "no-invalid-double-slash-comments": true, 77 | "no-missing-end-of-source-newline": true, 78 | "number-no-trailing-zeros": true, 79 | "property-case": "lower", 80 | "property-no-unknown": true, 81 | "selector-attribute-brackets-space-inside": "never", 82 | "selector-attribute-operator-space-after": "never", 83 | "selector-attribute-operator-space-before": "never", 84 | "selector-combinator-space-after": "always", 85 | "selector-combinator-space-before": "always", 86 | "selector-descendant-combinator-no-non-space": true, 87 | "selector-list-comma-newline-after": "always", 88 | "selector-list-comma-space-before": "never", 89 | "selector-pseudo-class-case": "lower", 90 | "selector-pseudo-class-no-unknown": true, 91 | "selector-pseudo-class-parentheses-space-inside": "never", 92 | "selector-pseudo-element-case": "lower", 93 | "selector-pseudo-element-colon-notation": "double", 94 | "selector-pseudo-element-no-unknown": true, 95 | "selector-type-case": "lower", 96 | "selector-type-no-unknown": true, 97 | "shorthand-property-no-redundant-values": true, 98 | "string-no-newline": true, 99 | "unit-case": "lower", 100 | "unit-no-unknown": true, 101 | "value-list-comma-newline-after": "always-multi-line", 102 | "value-list-comma-space-after": "always-single-line", 103 | "value-list-comma-space-before": "never", 104 | "value-list-max-empty-lines": 0, 105 | "order/properties-order": [ 106 | "position", 107 | "top", 108 | "right", 109 | "bottom", 110 | "left", 111 | "z-index", 112 | "box-sizing", 113 | "display", 114 | "flex", 115 | "flex-align", 116 | "flex-basis", 117 | "flex-direction", 118 | "flex-wrap", 119 | "flex-flow", 120 | "flex-shrink", 121 | "flex-grow", 122 | "flex-wrap", 123 | "align-content", 124 | "align-items", 125 | "align-self", 126 | "justify-content", 127 | "order", 128 | "float", 129 | "width", 130 | "min-width", 131 | "max-width", 132 | "height", 133 | "min-height", 134 | "max-height", 135 | "padding", 136 | "padding-top", 137 | "padding-right", 138 | "padding-bottom", 139 | "padding-left", 140 | "margin", 141 | "margin-top", 142 | "margin-right", 143 | "margin-bottom", 144 | "margin-left", 145 | "overflow", 146 | "overflow-x", 147 | "overflow-y", 148 | "-webkit-overflow-scrolling", 149 | "-ms-overflow-x", 150 | "-ms-overflow-y", 151 | "-ms-overflow-style", 152 | "columns", 153 | "column-count", 154 | "column-fill", 155 | "column-gap", 156 | "column-rule", 157 | "column-rule-width", 158 | "column-rule-style", 159 | "column-rule-color", 160 | "column-span", 161 | "column-width", 162 | "orphans", 163 | "widows", 164 | "clip", 165 | "clear", 166 | "font", 167 | "font-family", 168 | "font-size", 169 | "font-style", 170 | "font-weight", 171 | "font-variant", 172 | "font-size-adjust", 173 | "font-stretch", 174 | "font-effect", 175 | "font-emphasize", 176 | "font-emphasize-position", 177 | "font-emphasize-style", 178 | "font-smooth", 179 | "src", 180 | "hyphens", 181 | "line-height", 182 | "color", 183 | "text-align", 184 | "text-align-last", 185 | "text-emphasis", 186 | "text-emphasis-color", 187 | "text-emphasis-style", 188 | "text-emphasis-position", 189 | "text-decoration", 190 | "text-indent", 191 | "text-justify", 192 | "text-outline", 193 | "-ms-text-overflow", 194 | "text-overflow", 195 | "text-overflow-ellipsis", 196 | "text-overflow-mode", 197 | "text-shadow", 198 | "text-transform", 199 | "text-wrap", 200 | "-webkit-text-size-adjust", 201 | "-ms-text-size-adjust", 202 | "letter-spacing", 203 | "-ms-word-break", 204 | "word-break", 205 | "word-spacing", 206 | "-ms-word-wrap", 207 | "word-wrap", 208 | "overflow-wrap", 209 | "tab-size", 210 | "white-space", 211 | "vertical-align", 212 | "direction", 213 | "unicode-bidi", 214 | "list-style", 215 | "list-style-position", 216 | "list-style-type", 217 | "list-style-image", 218 | "pointer-events", 219 | "-ms-touch-action", 220 | "touch-action", 221 | "cursor", 222 | "visibility", 223 | "zoom", 224 | "table-layout", 225 | "empty-cells", 226 | "caption-side", 227 | "border-spacing", 228 | "border-collapse", 229 | "content", 230 | "quotes", 231 | "counter-reset", 232 | "counter-increment", 233 | "resize", 234 | "user-select", 235 | "nav-index", 236 | "nav-up", 237 | "nav-right", 238 | "nav-down", 239 | "nav-left", 240 | "background", 241 | "background-color", 242 | "background-image", 243 | "filter", 244 | "background-repeat", 245 | "background-attachment", 246 | "background-position", 247 | "background-position-x", 248 | "background-position-y", 249 | "background-clip", 250 | "background-origin", 251 | "background-size", 252 | "border", 253 | "border-color", 254 | "border-style", 255 | "border-width", 256 | "border-top", 257 | "border-top-color", 258 | "border-top-style", 259 | "border-top-width", 260 | "border-right", 261 | "border-right-color", 262 | "border-right-style", 263 | "border-right-width", 264 | "border-bottom", 265 | "border-bottom-color", 266 | "border-bottom-style", 267 | "border-bottom-width", 268 | "border-left", 269 | "border-left-color", 270 | "border-left-style", 271 | "border-left-width", 272 | "border-radius", 273 | "border-top-left-radius", 274 | "border-top-right-radius", 275 | "border-bottom-right-radius", 276 | "border-bottom-left-radius", 277 | "border-image", 278 | "border-image-source", 279 | "border-image-slice", 280 | "border-image-width", 281 | "border-image-outset", 282 | "border-image-repeat", 283 | "outline", 284 | "outline-width", 285 | "outline-style", 286 | "outline-color", 287 | "outline-offset", 288 | "box-shadow", 289 | "opacity", 290 | "-ms-interpolation-mode", 291 | "page-break-after", 292 | "page-break-before", 293 | "page-break-inside", 294 | "transition", 295 | "transition-delay", 296 | "transition-timing-function", 297 | "transition-duration", 298 | "transition-property", 299 | "transform", 300 | "transform-origin", 301 | "perspective", 302 | "appearance", 303 | "animation", 304 | "animation-name", 305 | "animation-duration", 306 | "animation-play-state", 307 | "animation-timing-function", 308 | "animation-delay", 309 | "animation-iteration-count", 310 | "animation-direction", 311 | "animation-fill-mode", 312 | "quotes", 313 | "will-change", 314 | "fill", 315 | "fill-rule", 316 | "stroke" 317 | ] 318 | } 319 | } 320 | -------------------------------------------------------------------------------- /exampleSite/content/post/goisforlovers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "(Hu)go Template Primer" 3 | date: 2014-04-02 4 | tags: 5 | - "go" 6 | - "golang" 7 | - "templates" 8 | - "themes" 9 | - "development" 10 | categories: 11 | - "Development" 12 | - "golang" 13 | menu: main 14 | --- 15 | 16 | Hugo uses the excellent [Go][] [html/template][gohtmltemplate] library for 17 | its template engine. It is an extremely lightweight engine that provides a very 18 | small amount of logic. In our experience that it is just the right amount of 19 | logic to be able to create a good static website. If you have used other 20 | template systems from different languages or frameworks you will find a lot of 21 | similarities in Go templates. 22 | 23 | 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 | Golang 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 `