├── exampleSite ├── static │ └── .gitkeep ├── .gitignore ├── content │ └── post │ │ ├── hugo-is-for-lovers.md │ │ ├── migrate-from-jekyll.md │ │ ├── go-is-for-lovers.md │ │ └── creating-a-new-theme.md └── config.toml ├── archetypes └── default.md ├── images ├── tn.png └── screenshot.png ├── static ├── images │ ├── bg.jpg │ ├── avatar.jpg │ ├── fulls │ │ ├── 01.jpg │ │ ├── 02.jpg │ │ ├── 03.jpg │ │ ├── 04.jpg │ │ ├── 05.jpg │ │ └── 06.jpg │ └── thumbs │ │ ├── 01.jpg │ │ ├── 02.jpg │ │ ├── 03.jpg │ │ ├── 04.jpg │ │ ├── 05.jpg │ │ └── 06.jpg ├── css │ ├── images │ │ └── overlay.png │ └── ie8.css └── js │ ├── ie │ ├── html5shiv.js │ ├── backgroundsize.min.htc │ ├── respond.min.js │ └── PIE.htc │ ├── main.js │ ├── skel.min.js │ ├── jquery.poptrox.min.js │ └── util.js ├── layouts ├── _default │ ├── summary.html │ ├── single.html │ ├── list.html │ └── baseof.html ├── partials │ ├── about.html │ ├── recent-posts.html │ ├── portfolio.html │ ├── pagination.html │ ├── header.html │ ├── post-meta.html │ ├── head.html │ ├── contact.html │ └── footer.html ├── index.html └── 404.html ├── theme.toml ├── CHANGELOG.md ├── README.md └── LICENSE.md /exampleSite/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exampleSite/.gitignore: -------------------------------------------------------------------------------- 1 | public/ 2 | themes -------------------------------------------------------------------------------- /archetypes/default.md: -------------------------------------------------------------------------------- 1 | +++ 2 | tags = [] 3 | categories = [] 4 | +++ 5 | -------------------------------------------------------------------------------- /images/tn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/images/tn.png -------------------------------------------------------------------------------- /static/images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/bg.jpg -------------------------------------------------------------------------------- /images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/images/screenshot.png -------------------------------------------------------------------------------- /static/images/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/avatar.jpg -------------------------------------------------------------------------------- /static/images/fulls/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/fulls/01.jpg -------------------------------------------------------------------------------- /static/images/fulls/02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/fulls/02.jpg -------------------------------------------------------------------------------- /static/images/fulls/03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/fulls/03.jpg -------------------------------------------------------------------------------- /static/images/fulls/04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/fulls/04.jpg -------------------------------------------------------------------------------- /static/images/fulls/05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/fulls/05.jpg -------------------------------------------------------------------------------- /static/images/fulls/06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/fulls/06.jpg -------------------------------------------------------------------------------- /static/images/thumbs/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/thumbs/01.jpg -------------------------------------------------------------------------------- /static/images/thumbs/02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/thumbs/02.jpg -------------------------------------------------------------------------------- /static/images/thumbs/03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/thumbs/03.jpg -------------------------------------------------------------------------------- /static/images/thumbs/04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/thumbs/04.jpg -------------------------------------------------------------------------------- /static/images/thumbs/05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/thumbs/05.jpg -------------------------------------------------------------------------------- /static/images/thumbs/06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/images/thumbs/06.jpg -------------------------------------------------------------------------------- /static/css/images/overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalcraftsman/hugo-strata-theme/master/static/css/images/overlay.png -------------------------------------------------------------------------------- /layouts/_default/summary.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | {{ .Title }} 4 |

5 | 6 | {{ partial "post-meta" . }} 7 |
8 | 9 |

{{ .Summary }}

10 |
11 | -------------------------------------------------------------------------------- /layouts/partials/about.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | {{ with .Site.Params.about.title }}

{{ . | markdownify }}

{{ end }} 4 |
5 | {{ with .Site.Params.about.content }}

{{ . | markdownify }}

{{ end }} 6 |
7 | -------------------------------------------------------------------------------- /layouts/_default/single.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 | 3 |

{{ .Title }}

4 | 5 | {{ partial "post-meta" . }} 6 |
7 | 8 |

9 | {{ .Content }} 10 |

11 | 12 | {{ template "_internal/disqus.html" . }} 13 | {{ end }} 14 | -------------------------------------------------------------------------------- /layouts/_default/list.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 | {{ .Content }} 3 | 4 | {{ $paginator := .Paginate .Data.Pages }} 5 | {{ range $paginator.Pages }} 6 | {{ .Render "summary" }} 7 | {{ end }} 8 | 9 | {{ partial "pagination" . }} 10 | {{ end }} 11 | -------------------------------------------------------------------------------- /layouts/_default/baseof.html: -------------------------------------------------------------------------------- 1 | {{ partial "head" . }} 2 | 3 | {{ partial "header" . }} 4 | 5 | {{ "" | safeHTML }} 6 |
7 | {{ block "main" . }}{{ end }} 8 |
9 | 10 | {{ partial "footer" . }} 11 | 12 | 13 | -------------------------------------------------------------------------------- /layouts/index.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 | {{ if not .Site.Params.about.hide }} 3 | {{ partial "about" . }} 4 | {{ end }} 5 | 6 | {{ if not .Site.Params.portfolio.hide }} 7 | {{ partial "portfolio" . }} 8 | {{ end }} 9 | 10 | {{ if not .Site.Params.recentposts.hide }} 11 | {{ partial "recent-posts" . }} 12 | {{ end }} 13 | 14 | {{ if not .Site.Params.contact.hide }} 15 | {{ partial "contact" . }} 16 | {{ end }} 17 | {{ end }} 18 | -------------------------------------------------------------------------------- /layouts/partials/recent-posts.html: -------------------------------------------------------------------------------- 1 |
2 | {{ with .Site.Params.recentposts.title }} 3 |

{{ . }}

4 | {{ end }} 5 | 6 |
7 |
8 |

9 |

    10 | {{ range first 5 (where .Data.Pages "Section" "post") }} 11 |
  1. {{ .Title }}
  2. 12 | {{ end }} 13 |
14 |

15 |
16 |
17 | -------------------------------------------------------------------------------- /layouts/404.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 |

Page not found

3 | 4 |

Uh-oh, you seem to have taken a wrong turn! It looks like this was the result of either:

5 | 6 | 11 | 12 |

I suggest that you head to my Home page from here.

13 | {{ end }} 14 | -------------------------------------------------------------------------------- /layouts/partials/portfolio.html: -------------------------------------------------------------------------------- 1 | {{ "" | safeHTML }} 2 |
3 | {{ with .Site.Params.portfolio.title }}

{{ . | markdownify }}

{{ end }} 4 |
5 | {{ range .Site.Params.portfolio.gallery }} 6 |
7 | 8 |

{{ .title | markdownify }}

9 |

{{ .description | markdownify }}

10 |
11 | {{ end }} 12 |
13 |
14 | -------------------------------------------------------------------------------- /layouts/partials/pagination.html: -------------------------------------------------------------------------------- 1 | {{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} 2 | {{ if .Paginator.HasPrev }} 3 | 6 | {{ end }} 7 | 8 | {{ if and (.Paginator.HasPrev) (.Paginator.HasNext) }} 9 | 10 | {{ end }} 11 | 12 | {{ if .Paginator.HasNext }} 13 | 16 | {{ end }} 17 | {{ end }} 18 | -------------------------------------------------------------------------------- /layouts/partials/header.html: -------------------------------------------------------------------------------- 1 | {{ "" | safeHTML }} 2 | 20 | -------------------------------------------------------------------------------- /theme.toml: -------------------------------------------------------------------------------- 1 | name = "Strata" 2 | license = "Creative Commons Attribution 3.0 Unported" 3 | licenselink = "//github.com/digitalcraftsman/hugo-strata-theme/blob/master/LICENSE.md" 4 | description = "A responsive and minimal single-page portfolio with blogging capabilities." 5 | homepage = "//github.com/digitalcraftsman/hugo-strata-theme" 6 | tags = ["image gallery", "contact form", "google analytics", "customizable", "blog", "single-page"] 7 | features = ["", ""] 8 | min_version = 0.16 9 | 10 | [author] 11 | name = "digitalcraftsman" 12 | homepage = "//github.com/digitalcraftsman" 13 | 14 | # If porting an existing theme 15 | [original] 16 | name = "AJ" 17 | homepage = "//html5up.net/" 18 | repo = "" 19 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ### 4th August 2016 4 | 5 | **With the following updates the theme requires Hugo v0.16 or greater.** 6 | 7 | - Additions of menu in the sidebar 8 | - Functionality for a simple blog has been added 9 | - Comments are powered by Disqus 10 | - Sections on the homepage can now be hidden (look for the variable `hide` in example config file) 11 | - Use of template inheritance (hence the required update to Hugo v0.16) 12 | - A 404 page informs visitors about non-existing pages 13 | - Google Analytics is now implemented with Hugo's internal template. **You have to move the `googleAnalytics` variable in order to use this feature ([Show diff](https://github.com/digitalcraftsman/hugo-strata-theme/commit/5bdca7d81b13348ad95f89d4bc4f2a7c928d3dbd))** 14 | - Custom stylesheets and JS scripts can now be added with the `custom_css` and `custom_js` variable in the config file. 15 | -------------------------------------------------------------------------------- /layouts/partials/post-meta.html: -------------------------------------------------------------------------------- 1 |    2 |    3 | 4 | {{ if .Site.Params.Show_read_time }}{{ .ReadingTime }} min read  {{ end }} 5 | 6 | {{ if isset .Params "categories" }} 7 | {{ $categoriesLen := len .Params.categories }} 8 | {{ if gt $categoriesLen 0 }} 9 |    10 | {{ range $k, $v := .Params.categories }} 11 | {{ . }} 12 | {{ if lt $k (sub $categoriesLen 1) }}·{{ end }} 13 | {{ end }} 14 | {{ end }} 15 | {{ end }} 16 | 17 | {{ if isset .Params "tags" }} 18 | {{ $tagsLen := len .Params.tags }} 19 | {{ if gt $tagsLen 0 }} 20 |      21 | {{ range $k, $v := .Params.tags }} 22 | {{ . }} 23 | {{ if lt $k (sub $tagsLen 1) }}·{{ end }} 24 | {{ end }} 25 | {{ end }} 26 | {{ end }} 27 | -------------------------------------------------------------------------------- /static/css/ie8.css: -------------------------------------------------------------------------------- 1 | /* 2 | Strata by HTML5 UP 3 | html5up.net | @n33co 4 | Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) 5 | */ 6 | 7 | /* Button */ 8 | 9 | input[type="submit"], 10 | input[type="reset"], 11 | input[type="button"], 12 | .button { 13 | position: relative; 14 | -ms-behavior: url("assets/js/ie/PIE.htc"); 15 | } 16 | 17 | /* Form */ 18 | 19 | input[type="text"], 20 | input[type="password"], 21 | input[type="email"], 22 | select, 23 | textarea { 24 | position: relative; 25 | -ms-behavior: url("assets/js/ie/PIE.htc"); 26 | } 27 | 28 | input[type="text"], 29 | input[type="password"], 30 | input[type="email"], 31 | select { 32 | height: 2.75em; 33 | line-height: 2.75em; 34 | } 35 | 36 | input[type="checkbox"] + label:before, 37 | input[type="radio"] + label:before { 38 | display: none; 39 | } 40 | 41 | /* Image */ 42 | 43 | .image { 44 | position: relative; 45 | -ms-behavior: url("assets/js/ie/PIE.htc"); 46 | } 47 | 48 | .image:before, .image:after { 49 | display: none !important; 50 | } 51 | 52 | .image img { 53 | position: relative; 54 | -ms-behavior: url("assets/js/ie/PIE.htc"); 55 | } 56 | 57 | /* Header */ 58 | 59 | #header { 60 | background-image: url("../../images/bg.jpg"); 61 | background-repeat: no-repeat; 62 | background-size: cover; 63 | -ms-behavior: url("assets/js/ie/backgroundsize.min.htc"); 64 | } 65 | 66 | #header h1 { 67 | color: #ffffff; 68 | } 69 | 70 | /* Footer */ 71 | 72 | #footer .icons a { 73 | color: #ffffff; 74 | } -------------------------------------------------------------------------------- /layouts/partials/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ "" | safeHTML }} 8 | 9 | 10 | {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} · {{ .Site.Title }}{{ end }} 11 | 12 | 13 | {{ with .Site.Params.name }}{{ end }} 14 | {{ with .Site.Params.description }}{{ end }} 15 | {{ with .Site.LanguageCode }}{{ end }} 16 | 17 | {{ if not .Site.Params.OpenGraph.hide }} 18 | 19 | 20 | 21 | {{ if not .Site.Params.avatar.hide }} 22 | 23 | {{ end }} 24 | {{ end }} 25 | 26 | {{ .Hugo.Generator }} 27 | 28 | {{ "" | safeHTML}} 29 | 30 | 31 | {{ "" | safeHTML}} 32 | 33 | {{ with .RSSLink }} 34 | 35 | 36 | {{ end }} 37 | {{ range .Site.Params.custom_css }} 38 | 39 | {{ end }} 40 | 41 | -------------------------------------------------------------------------------- /static/js/ie/html5shiv.js: -------------------------------------------------------------------------------- 1 | /* 2 | HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); 8 | for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d 2 |
3 | {{ if isset .Site.Params.contact "email" }} 4 | {{ with .Site.Params.contact.title }}

{{ . }}

{{ end }} 5 | {{ with .Site.Params.contact.content }}

{{ . | markdownify }}

{{ end }} 6 | {{ end }} 7 |
8 | {{ if (isset .Site.Params.contact "email") | and (gt (len .Site.Params.contact.email) 0) }} 9 |
10 |
11 |
12 | 13 |
14 |
15 |
16 | 17 | 18 |
    19 |
  • 20 |
21 |
22 |
23 |
24 | {{ else }} 25 |
 
26 | {{ end }} 27 |
28 | 62 |
63 |
64 |
65 | -------------------------------------------------------------------------------- /layouts/partials/footer.html: -------------------------------------------------------------------------------- 1 | {{ "" | safeHTML }} 2 | 42 | 43 | {{ "" | safeHTML }} 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | {{ template "_internal/google_analytics_async.html" . }} 52 | 53 | {{ range .Site.Params.custom_js }} 54 | 55 | {{ end }} 56 | -------------------------------------------------------------------------------- /exampleSite/content/post/hugo-is-for-lovers.md: -------------------------------------------------------------------------------- 1 | +++ 2 | banner = "banners/placeholder.png" 3 | categories = ["Lorem"] 4 | date = "2015-08-03T13:39:46+02:00" 5 | menu = "" 6 | tags = [] 7 | title = "Hugo is for lovers" 8 | +++ 9 | 10 | ## Step 1. Install Hugo 11 | 12 | Goto [hugo releases](https://github.com/spf13/hugo/releases) and download the 13 | appropriate version for your os and architecture. 14 | 15 | Save it somewhere specific as we will be using it in the next step. 16 | 17 | More complete instructions are available at [installing hugo](/overview/installing/) 18 | 19 | ## Step 2. Build the Docs 20 | 21 | Hugo has its own example site which happens to also be the documentation site 22 | you are reading right now. 23 | 24 | Follow the following steps: 25 | 26 | 1. Clone the [hugo repository](http://github.com/spf13/hugo) 27 | 2. Go into the repo 28 | 3. Run hugo in server mode and build the docs 29 | 4. Open your browser to http://localhost:1313 30 | 31 | Corresponding pseudo commands: 32 | 33 | git clone https://github.com/spf13/hugo 34 | cd hugo 35 | /path/to/where/you/installed/hugo server --source=./docs 36 | > 29 pages created 37 | > 0 tags index created 38 | > in 27 ms 39 | > Web Server is available at http://localhost:1313 40 | > Press ctrl+c to stop 41 | 42 | Once you've gotten here, follow along the rest of this page on your local build. 43 | 44 | ## Step 3. Change the docs site 45 | 46 | Stop the Hugo process by hitting ctrl+c. 47 | 48 | Now we are going to run hugo again, but this time with hugo in watch mode. 49 | 50 | /path/to/hugo/from/step/1/hugo server --source=./docs --watch 51 | > 29 pages created 52 | > 0 tags index created 53 | > in 27 ms 54 | > Web Server is available at http://localhost:1313 55 | > Watching for changes in /Users/spf13/Code/hugo/docs/content 56 | > Press ctrl+c to stop 57 | 58 | 59 | Open your [favorite editor](http://vim.spf13.com) and change one of the source 60 | content pages. How about changing this very file to *fix the typo*. How about changing this very file to *fix the typo*. 61 | 62 | Content files are found in `docs/content/`. Unless otherwise specified, files 63 | are located at the same relative location as the url, in our case 64 | `docs/content/overview/quickstart.md`. 65 | 66 | Change and save this file.. Notice what happened in your terminal. 67 | 68 | > Change detected, rebuilding site 69 | 70 | > 29 pages created 71 | > 0 tags index created 72 | > in 26 ms 73 | 74 | Refresh the browser and observe that the typo is now fixed. 75 | 76 | Notice how quick that was. Try to refresh the site before it's finished building.. I double dare you. 77 | Having nearly instant feedback enables you to have your creativity flow without waiting for long builds. 78 | 79 | ## Step 4. Have fun 80 | 81 | The best way to learn something is to play with it. 82 | -------------------------------------------------------------------------------- /static/js/main.js: -------------------------------------------------------------------------------- 1 | /* 2 | Strata by HTML5 UP 3 | html5up.net | @n33co 4 | Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) 5 | */ 6 | 7 | (function($) { 8 | 9 | var settings = { 10 | 11 | // Parallax background effect? 12 | parallax: true, 13 | 14 | // Parallax factor (lower = more intense, higher = less intense). 15 | parallaxFactor: 20 16 | 17 | }; 18 | 19 | skel.breakpoints({ 20 | xlarge: '(max-width: 1800px)', 21 | large: '(max-width: 1280px)', 22 | medium: '(max-width: 980px)', 23 | small: '(max-width: 736px)', 24 | xsmall: '(max-width: 480px)' 25 | }); 26 | 27 | $(function() { 28 | 29 | var $window = $(window), 30 | $body = $('body'), 31 | $header = $('#header'); 32 | 33 | // Disable animations/transitions until the page has loaded. 34 | $body.addClass('is-loading'); 35 | 36 | $window.on('load', function() { 37 | $body.removeClass('is-loading'); 38 | }); 39 | 40 | // Touch? 41 | if (skel.vars.mobile) { 42 | 43 | // Turn on touch mode. 44 | $body.addClass('is-touch'); 45 | 46 | // Height fix (mostly for iOS). 47 | window.setTimeout(function() { 48 | $window.scrollTop($window.scrollTop() + 1); 49 | }, 0); 50 | 51 | } 52 | 53 | // Fix: Placeholder polyfill. 54 | $('form').placeholder(); 55 | 56 | // Prioritize "important" elements on medium. 57 | skel.on('+medium -medium', function() { 58 | $.prioritize( 59 | '.important\\28 medium\\29', 60 | skel.breakpoint('medium').active 61 | ); 62 | }); 63 | 64 | // Header. 65 | 66 | // Parallax background. 67 | 68 | // Disable parallax on IE (smooth scrolling is jerky), and on mobile platforms (= better performance). 69 | if (skel.vars.browser == 'ie' 70 | || skel.vars.mobile) 71 | settings.parallax = false; 72 | 73 | if (settings.parallax) { 74 | 75 | skel.on('change', function() { 76 | 77 | if (skel.breakpoint('medium').active) { 78 | 79 | $window.off('scroll.strata_parallax'); 80 | $header.css('background-position', 'top left, center center'); 81 | 82 | } 83 | else { 84 | 85 | $header.css('background-position', 'left 0px'); 86 | 87 | $window.on('scroll.strata_parallax', function() { 88 | $header.css('background-position', 'left ' + (-1 * (parseInt($window.scrollTop()) / settings.parallaxFactor)) + 'px'); 89 | }); 90 | 91 | } 92 | 93 | }); 94 | 95 | } 96 | 97 | // Main Sections: Two. 98 | 99 | // Lightbox gallery. 100 | $window.on('load', function() { 101 | 102 | $('#two').poptrox({ 103 | caption: function($a) { return $a.next('h3').text(); }, 104 | overlayColor: '#2c2c2c', 105 | overlayOpacity: 0.85, 106 | popupCloserText: '', 107 | popupLoaderText: '', 108 | selector: '.work-item a.image', 109 | usePopupCaption: true, 110 | usePopupDefaultStyling: false, 111 | usePopupEasyClose: false, 112 | usePopupNav: true, 113 | windowMargin: (skel.breakpoint('small').active ? 0 : 50) 114 | }); 115 | 116 | }); 117 | 118 | }); 119 | 120 | })(jQuery); -------------------------------------------------------------------------------- /static/js/ie/backgroundsize.min.htc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/js/ie/respond.min.js: -------------------------------------------------------------------------------- 1 | /*! Respond.js v1.4.2: min/max-width media query polyfill 2 | * Copyright 2014 Scott Jehl 3 | * Licensed under MIT 4 | * http://j.mp/respondjs */ 5 | 6 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){v(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},g=function(a){return a.replace(c.regex.minmaxwh,"").match(c.regex.other)};if(c.ajax=f,c.queue=d,c.unsupportedmq=g,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var h,i,j,k=a.document,l=k.documentElement,m=[],n=[],o=[],p={},q=30,r=k.getElementsByTagName("head")[0]||l,s=k.getElementsByTagName("base")[0],t=r.getElementsByTagName("link"),u=function(){var a,b=k.createElement("div"),c=k.body,d=l.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=k.createElement("body"),c.style.background="none"),l.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&l.insertBefore(c,l.firstChild),a=b.offsetWidth,f?l.removeChild(c):c.removeChild(b),l.style.fontSize=d,e&&(c.style.fontSize=e),a=j=parseFloat(a)},v=function(b){var c="clientWidth",d=l[c],e="CSS1Compat"===k.compatMode&&d||k.body[c]||d,f={},g=t[t.length-1],p=(new Date).getTime();if(b&&h&&q>p-h)return a.clearTimeout(i),i=a.setTimeout(v,q),void 0;h=p;for(var s in m)if(m.hasOwnProperty(s)){var w=m[s],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?j||u():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?j||u():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(n[w.rules]))}for(var C in o)o.hasOwnProperty(C)&&o[C]&&o[C].parentNode===r&&r.removeChild(o[C]);o.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=k.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,r.insertBefore(E,g.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(k.createTextNode(F)),o.push(E)}},w=function(a,b,d){var e=a.replace(c.regex.comments,"").replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},i=!f&&d;b.length&&(b+="/"),i&&(f=1);for(var j=0;f>j;j++){var k,l,o,p;i?(k=d,n.push(h(a))):(k=e[j].match(c.regex.findStyles)&&RegExp.$1,n.push(RegExp.$2&&h(RegExp.$2))),o=k.split(","),p=o.length;for(var q=0;p>q;q++)l=o[q],g(l)||m.push({media:l.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:n.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}v()},x=function(){if(d.length){var b=d.shift();f(b.href,function(c){w(c,b.href,b.media),p[b.href]=!0,a.setTimeout(function(){x()},0)})}},y=function(){for(var b=0;b/ 15 | ▾ images/ 16 | logo.png 17 | 18 | should become 19 | 20 | ▾ / 21 | ▾ static/ 22 | ▾ images/ 23 | logo.png 24 | 25 | Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`. 26 | 27 | ## Create your Hugo configuration file 28 | 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. 29 | 30 | ## Set your configuration publish folder to `_site` 31 | 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: 32 | 33 | 1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended). 34 | 35 | git submodule deinit _site 36 | git rm _site 37 | git submodule add -b gh-pages git@github.com:your-username/your-repo.git public 38 | 39 | 2. Or, change the Hugo configuration to use `_site` instead of `public`. 40 | 41 | { 42 | .. 43 | "publishdir": "_site", 44 | .. 45 | } 46 | 47 | ## Convert Jekyll templates to Hugo templates 48 | 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. 49 | 50 | As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours. 51 | 52 | ## Convert Jekyll plugins to Hugo shortcodes 53 | Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port. 54 | 55 | ### Implementation 56 | 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. 57 | 58 | Jekyll's plugin: 59 | 60 | module Jekyll 61 | class ImageTag < Liquid::Tag 62 | @url = nil 63 | @caption = nil 64 | @class = nil 65 | @link = nil 66 | // Patterns 67 | IMAGE_URL_WITH_CLASS_AND_CAPTION = 68 | IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i 69 | IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i 70 | IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i 71 | IMAGE_URL = /((https?:\/\/|\/)(\S+))/i 72 | def initialize(tag_name, markup, tokens) 73 | super 74 | if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK 75 | @class = $1 76 | @url = $3 77 | @caption = $7 78 | @link = $9 79 | elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION 80 | @class = $1 81 | @url = $3 82 | @caption = $7 83 | elsif markup =~ IMAGE_URL_WITH_CAPTION 84 | @url = $1 85 | @caption = $5 86 | elsif markup =~ IMAGE_URL_WITH_CLASS 87 | @class = $1 88 | @url = $3 89 | elsif markup =~ IMAGE_URL 90 | @url = $1 91 | end 92 | end 93 | def render(context) 94 | if @class 95 | source = "
" 96 | else 97 | source = "
" 98 | end 99 | if @link 100 | source += "" 101 | end 102 | source += "" 103 | if @link 104 | source += "" 105 | end 106 | source += "
#{@caption}
" if @caption 107 | source += "
" 108 | source 109 | end 110 | end 111 | end 112 | Liquid::Template.register_tag('image', Jekyll::ImageTag) 113 | 114 | is written as this Hugo shortcode: 115 | 116 | 117 |
118 | {{ with .Get "link"}}{{ end }} 119 | 120 | {{ if .Get "link"}}{{ end }} 121 | {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} 122 |
{{ if isset .Params "title" }} 123 | {{ .Get "title" }}{{ end }} 124 | {{ if or (.Get "caption") (.Get "attr")}}

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

{{ end }} 130 |
131 | {{ end }} 132 |
133 | 134 | 135 | ### Usage 136 | I simply changed: 137 | 138 | {% 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/ %} 139 | 140 | to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`): 141 | 142 | {{%/* 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/" */%}} 143 | 144 | As a bonus, the shortcode named parameters are, arguably, more readable. 145 | 146 | ## Finishing touches 147 | ### Fix content 148 | 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. 149 | 150 | ### Clean up 151 | You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it. 152 | 153 | ## A practical example in a diff 154 | [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). 155 | -------------------------------------------------------------------------------- /static/js/skel.min.js: -------------------------------------------------------------------------------- 1 | /* skel.js v3.0.0-dev | (c) n33 | skel.io | MIT licensed */ 2 | var skel=function(){"use strict";var t={breakpointIds:null,events:{},isInit:!1,obj:{attachments:{},breakpoints:{},head:null,states:{}},sd:"/",state:null,stateHandlers:{},stateId:"",vars:{},DOMReady:null,indexOf:null,isArray:null,iterate:null,matchesMedia:null,extend:function(e,n){t.iterate(n,function(i){t.isArray(n[i])?(t.isArray(e[i])||(e[i]=[]),t.extend(e[i],n[i])):"object"==typeof n[i]?("object"!=typeof e[i]&&(e[i]={}),t.extend(e[i],n[i])):e[i]=n[i]})},newStyle:function(t){var e=document.createElement("style");return e.type="text/css",e.innerHTML=t,e},_canUse:null,canUse:function(e){t._canUse||(t._canUse=document.createElement("div"));var n=t._canUse.style,i=e.charAt(0).toUpperCase()+e.slice(1);return e in n||"Moz"+i in n||"Webkit"+i in n||"O"+i in n||"ms"+i in n},on:function(e,n){var i=e.split(/[\s]+/);return t.iterate(i,function(e){var a=i[e];if(t.isInit){if("init"==a)return void n();if("change"==a)n();else{var r=a.charAt(0);if("+"==r||"!"==r){var o=a.substring(1);if(o in t.obj.breakpoints)if("+"==r&&t.obj.breakpoints[o].active)n();else if("!"==r&&!t.obj.breakpoints[o].active)return void n()}}}t.events[a]||(t.events[a]=[]),t.events[a].push(n)}),t},trigger:function(e){return t.events[e]&&0!=t.events[e].length?(t.iterate(t.events[e],function(n){t.events[e][n]()}),t):void 0},breakpoint:function(e){return t.obj.breakpoints[e]},breakpoints:function(e){function n(t,e){this.name=this.id=t,this.media=e,this.active=!1,this.wasActive=!1}return n.prototype.matches=function(){return t.matchesMedia(this.media)},n.prototype.sync=function(){this.wasActive=this.active,this.active=this.matches()},t.iterate(e,function(i){t.obj.breakpoints[i]=new n(i,e[i])}),window.setTimeout(function(){t.poll()},0),t},addStateHandler:function(e,n){t.stateHandlers[e]=n},callStateHandler:function(e){var n=t.stateHandlers[e]();t.iterate(n,function(e){t.state.attachments.push(n[e])})},changeState:function(e){t.iterate(t.obj.breakpoints,function(e){t.obj.breakpoints[e].sync()}),t.vars.lastStateId=t.stateId,t.stateId=e,t.breakpointIds=t.stateId===t.sd?[]:t.stateId.substring(1).split(t.sd),t.obj.states[t.stateId]?t.state=t.obj.states[t.stateId]:(t.obj.states[t.stateId]={attachments:[]},t.state=t.obj.states[t.stateId],t.iterate(t.stateHandlers,t.callStateHandler)),t.detachAll(t.state.attachments),t.attachAll(t.state.attachments),t.vars.stateId=t.stateId,t.vars.state=t.state,t.trigger("change"),t.iterate(t.obj.breakpoints,function(e){t.obj.breakpoints[e].active?t.obj.breakpoints[e].wasActive||t.trigger("+"+e):t.obj.breakpoints[e].wasActive&&t.trigger("-"+e)})},generateStateConfig:function(e,n){var i={};return t.extend(i,e),t.iterate(t.breakpointIds,function(e){t.extend(i,n[t.breakpointIds[e]])}),i},getStateId:function(){var e="";return t.iterate(t.obj.breakpoints,function(n){var i=t.obj.breakpoints[n];i.matches()&&(e+=t.sd+i.id)}),e},poll:function(){var e="";e=t.getStateId(),""===e&&(e=t.sd),e!==t.stateId&&t.changeState(e)},_attach:null,attach:function(e){var n=t.obj.head,i=e.element;return i.parentNode&&i.parentNode.tagName?!1:(t._attach||(t._attach=n.firstChild),n.insertBefore(i,t._attach.nextSibling),e.permanent&&(t._attach=i),!0)},attachAll:function(e){var n=[];t.iterate(e,function(t){n[e[t].priority]||(n[e[t].priority]=[]),n[e[t].priority].push(e[t])}),n.reverse(),t.iterate(n,function(e){t.iterate(n[e],function(i){t.attach(n[e][i])})})},detach:function(t){var e=t.element;return t.permanent||!e.parentNode||e.parentNode&&!e.parentNode.tagName?!1:(e.parentNode.removeChild(e),!0)},detachAll:function(e){var n={};t.iterate(e,function(t){n[e[t].id]=!0}),t.iterate(t.obj.attachments,function(e){e in n||t.detach(t.obj.attachments[e])})},attachment:function(e){return e in t.obj.attachments?t.obj.attachments[e]:null},newAttachment:function(e,n,i,a){return t.obj.attachments[e]={id:e,element:n,priority:i,permanent:a}},init:function(){t.initMethods(),t.initVars(),t.initEvents(),t.obj.head=document.getElementsByTagName("head")[0],t.isInit=!0,t.trigger("init")},initEvents:function(){t.on("resize",function(){t.poll()}),t.on("orientationChange",function(){t.poll()}),t.DOMReady(function(){t.trigger("ready")}),window.onload&&t.on("load",window.onload),window.onload=function(){t.trigger("load")},window.onresize&&t.on("resize",window.onresize),window.onresize=function(){t.trigger("resize")},window.onorientationchange&&t.on("orientationChange",window.onorientationchange),window.onorientationchange=function(){t.trigger("orientationChange")}},initMethods:function(){document.addEventListener?!function(e,n){t.DOMReady=n()}("domready",function(){function t(t){for(r=1;t=n.shift();)t()}var e,n=[],i=document,a="DOMContentLoaded",r=/^loaded|^c/.test(i.readyState);return i.addEventListener(a,e=function(){i.removeEventListener(a,e),t()}),function(t){r?t():n.push(t)}}):!function(e,n){t.DOMReady=n()}("domready",function(t){function e(t){for(h=1;t=i.shift();)t()}var n,i=[],a=!1,r=document,o=r.documentElement,s=o.doScroll,c="DOMContentLoaded",d="addEventListener",u="onreadystatechange",l="readyState",f=s?/^loaded|^c/:/^loaded|c/,h=f.test(r[l]);return r[d]&&r[d](c,n=function(){r.removeEventListener(c,n,a),e()},a),s&&r.attachEvent(u,n=function(){/^c/.test(r[l])&&(r.detachEvent(u,n),e())}),t=s?function(e){self!=top?h?e():i.push(e):function(){try{o.doScroll("left")}catch(n){return setTimeout(function(){t(e)},50)}e()}()}:function(t){h?t():i.push(t)}}),t.indexOf=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){if("string"==typeof t)return t.indexOf(e);var n,i,a=e?e:0;if(!this)throw new TypeError;if(i=this.length,0===i||a>=i)return-1;for(0>a&&(a=i-Math.abs(a)),n=a;i>n;n++)if(this[n]===t)return n;return-1},t.isArray=Array.isArray?function(t){return Array.isArray(t)}:function(t){return"[object Array]"===Object.prototype.toString.call(t)},t.iterate=Object.keys?function(t,e){if(!t)return[];var n,i=Object.keys(t);for(n=0;i[n]&&e(i[n],t[i[n]])!==!1;n++);}:function(t,e){if(!t)return[];var n;for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])===!1)break},t.matchesMedia=window.matchMedia?function(t){return""==t?!0:window.matchMedia(t).matches}:window.styleMedia||window.media?function(t){if(""==t)return!0;var e=window.styleMedia||window.media;return e.matchMedium(t||"all")}:window.getComputedStyle?function(t){if(""==t)return!0;var e=document.createElement("style"),n=document.getElementsByTagName("script")[0],i=null;e.type="text/css",e.id="matchmediajs-test",n.parentNode.insertBefore(e,n),i="getComputedStyle"in window&&window.getComputedStyle(e,null)||e.currentStyle;var a="@media "+t+"{ #matchmediajs-test { width: 1px; } }";return e.styleSheet?e.styleSheet.cssText=a:e.textContent=a,"1px"===i.width}:function(t){if(""==t)return!0;var e,n,i,a,r={"min-width":null,"max-width":null},o=!1;n=t.split(/\s+and\s+/);for(a in n)e=n[a],"("==e.charAt(0)&&(e=e.substring(1,e.length-1),i=e.split(/:\s+/),2==i.length&&(r[i[0].replace(/^\s+|\s+$/g,"")]=parseInt(i[1]),o=!0));if(!o)return!1;var s=document.documentElement.clientWidth,c=document.documentElement.clientHeight;return null!==r["min-width"]&&sr["max-width"]||null!==r["min-height"]&&cr["max-height"]?!1:!0},navigator.userAgent.match(/MSIE ([0-9]+)/)&&RegExp.$1<9&&(t.newStyle=function(t){var e=document.createElement("span");return e.innerHTML=' ",e})},initVars:function(){var e,n,i,a=navigator.userAgent;e="other",n=0,i=[["firefox",/Firefox\/([0-9\.]+)/],["bb",/BlackBerry.+Version\/([0-9\.]+)/],["bb",/BB[0-9]+.+Version\/([0-9\.]+)/],["opera",/OPR\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)/],["edge",/Edge\/([0-9\.]+)/],["safari",/Version\/([0-9\.]+).+Safari/],["chrome",/Chrome\/([0-9\.]+)/],["ie",/MSIE ([0-9]+)/],["ie",/Trident\/.+rv:([0-9]+)/]],t.iterate(i,function(t,i){return a.match(i[1])?(e=i[0],n=parseFloat(RegExp.$1),!1):void 0}),t.vars.browser=e,t.vars.browserVersion=n,e="other",n=0,i=[["ios",/([0-9_]+) like Mac OS X/,function(t){return t.replace("_",".").replace("_","")}],["ios",/CPU like Mac OS X/,function(t){return 0}],["android",/Android ([0-9\.]+)/,null],["mac",/Macintosh.+Mac OS X ([0-9_]+)/,function(t){return t.replace("_",".").replace("_","")}],["wp",/Windows Phone ([0-9\.]+)/,null],["windows",/Windows NT ([0-9\.]+)/,null],["bb",/BlackBerry.+Version\/([0-9\.]+)/,null],["bb",/BB[0-9]+.+Version\/([0-9\.]+)/,null]],t.iterate(i,function(t,i){return a.match(i[1])?(e=i[0],n=parseFloat(i[2]?i[2](RegExp.$1):RegExp.$1),!1):void 0}),t.vars.os=e,t.vars.osVersion=n,t.vars.IEVersion="ie"==t.vars.browser?t.vars.browserVersion:99,t.vars.touch="wp"==t.vars.os?navigator.msMaxTouchPoints>0:!!("ontouchstart"in window),t.vars.mobile="wp"==t.vars.os||"android"==t.vars.os||"ios"==t.vars.os||"bb"==t.vars.os}};return t.init(),t}();!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():t.skel=e()}(this,function(){return skel}); -------------------------------------------------------------------------------- /exampleSite/content/post/go-is-for-lovers.md: -------------------------------------------------------------------------------- 1 | +++ 2 | banner = "banners/placeholder.png" 3 | categories = ["Ipsum"] 4 | date = "2015-09-17T13:47:08+02:00" 5 | menu = "" 6 | tags = [] 7 | title = "Go is for lovers" 8 | +++ 9 | 10 | Hugo uses the excellent [go][] [html/template][gohtmltemplate] library for 11 | its template engine. It is an extremely lightweight engine that provides a very 12 | small amount of logic. In our experience that it is just the right amount of 13 | logic to be able to create a good static website. If you have used other 14 | template systems from different languages or frameworks you will find a lot of 15 | similarities in go templates. 16 | 17 | This document is a brief primer on using go templates. The [go docs][gohtmltemplate] 18 | provide more details. 19 | 20 | ## Introduction to Go Templates 21 | 22 | Go templates provide an extremely simple template language. It adheres to the 23 | belief that only the most basic of logic belongs in the template or view layer. 24 | One consequence of this simplicity is that go templates parse very quickly. 25 | 26 | A unique characteristic of go templates is they are content aware. Variables and 27 | content will be sanitized depending on the context of where they are used. More 28 | details can be found in the [go docs][gohtmltemplate]. 29 | 30 | ## Basic Syntax 31 | 32 | Go lang templates are html files with the addition of variables and 33 | functions. 34 | 35 | **Go variables and functions are accessible within {{ }}** 36 | 37 | Accessing a predefined variable "foo": 38 | 39 | {{ foo }} 40 | 41 | **Parameters are separated using spaces** 42 | 43 | Calling the add function with input of 1, 2: 44 | 45 | {{ add 1 2 }} 46 | 47 | **Methods and fields are accessed via dot notation** 48 | 49 | Accessing the Page Parameter "bar" 50 | 51 | {{ .Params.bar }} 52 | 53 | **Parentheses can be used to group items together** 54 | 55 | {{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }} 56 | 57 | 58 | ## Variables 59 | 60 | Each go template has a struct (object) made available to it. In hugo each 61 | template is passed either a page or a node struct depending on which type of 62 | page you are rendering. More details are available on the 63 | [variables](/layout/variables) page. 64 | 65 | A variable is accessed by referencing the variable name. 66 | 67 | {{ .Title }} 68 | 69 | Variables can also be defined and referenced. 70 | 71 | {{ $address := "123 Main St."}} 72 | {{ $address }} 73 | 74 | 75 | ## Functions 76 | 77 | Go template ship with a few functions which provide basic functionality. The go 78 | template system also provides a mechanism for applications to extend the 79 | available functions with their own. [Hugo template 80 | functions](/layout/functions) provide some additional functionality we believe 81 | are useful for building websites. Functions are called by using their name 82 | followed by the required parameters separated by spaces. Template 83 | functions cannot be added without recompiling hugo. 84 | 85 | **Example:** 86 | 87 | {{ add 1 2 }} 88 | 89 | ## Includes 90 | 91 | When including another template you will pass to it the data it will be 92 | able to access. To pass along the current context please remember to 93 | include a trailing dot. The templates location will always be starting at 94 | the /layout/ directory within Hugo. 95 | 96 | **Example:** 97 | 98 | {{ template "chrome/header.html" . }} 99 | 100 | 101 | ## Logic 102 | 103 | Go templates provide the most basic iteration and conditional logic. 104 | 105 | ### Iteration 106 | 107 | Just like in go, the go templates make heavy use of range to iterate over 108 | a map, array or slice. The following are different examples of how to use 109 | range. 110 | 111 | **Example 1: Using Context** 112 | 113 | {{ range array }} 114 | {{ . }} 115 | {{ end }} 116 | 117 | **Example 2: Declaring value variable name** 118 | 119 | {{range $element := array}} 120 | {{ $element }} 121 | {{ end }} 122 | 123 | **Example 2: Declaring key and value variable name** 124 | 125 | {{range $index, $element := array}} 126 | {{ $index }} 127 | {{ $element }} 128 | {{ end }} 129 | 130 | ### Conditionals 131 | 132 | If, else, with, or, & and provide the framework for handling conditional 133 | logic in Go Templates. Like range, each statement is closed with `end`. 134 | 135 | 136 | Go Templates treat the following values as false: 137 | 138 | * false 139 | * 0 140 | * any array, slice, map, or string of length zero 141 | 142 | **Example 1: If** 143 | 144 | {{ if isset .Params "title" }}

{{ index .Params "title" }}

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

{{ . }}

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