diff --git a/themes/distorsion/osprey/.gitignore b/themes/distorsion/osprey/.gitignore new file mode 100644 index 0000000..1e39d77 --- /dev/null +++ b/themes/distorsion/osprey/.gitignore @@ -0,0 +1 @@ +static/*/*-*.min.* diff --git a/themes/distorsion/osprey/LICENSE b/themes/distorsion/osprey/LICENSE new file mode 100644 index 0000000..323c4ff --- /dev/null +++ b/themes/distorsion/osprey/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 Toma Nistor + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/themes/distorsion/osprey/README.md b/themes/distorsion/osprey/README.md new file mode 100644 index 0000000..46328c7 --- /dev/null +++ b/themes/distorsion/osprey/README.md @@ -0,0 +1,191 @@ +![Logo](https://github.com/tomanistor/osprey/blob/master/images/osprey-logo.png) + +# Osprey +Osprey is a simple, clean, and fast one-page [Hugo](https://gohugo.io/) portfolio accompanied by a blog. + +## Features +* Minimalist, clean, and uncluttered theme +* Portfolio display gallery +* [Disqus](https://disqus.com) comments +* [Formspree](https://formspree.io) AJAX contact form (with Formspree Gold) +* [Basin](https://usebasin.com/) AJAX contact form (free) +* Responsive Flexbox Grid +* [SASS](http://sass-lang.com/) styling +* Minimized/compressed CSS and JavaScript files with cachebusting hash setup +* Syntax highlighting with [Highlight.js](https://highlightjs.org/) +* SEO-friendly construction +* [Google Analytics](https://analytics.google.com) and [Google Tag Manager](https://tagmanager.google.com) integration +* [OpenGraph](http://ogp.me/) and [Twitter Cards](https://dev.twitter.com/cards/overview) integration +* Quick loading speeds +* Custom CSS option + +## Screenshot +![Screenshot](https://github.com/tomanistor/osprey/blob/master/images/tn.png) + +## Installation +### Option 1: Clone Repository +In the root of your Hugo site directory run: + +```console +$ cd themes +$ git clone https://github.com/tomanistor/osprey.git +``` + +### Option 2: Create Submodule +Create a submodule linked directly to the theme's GitHub repository in order to receive updates: + +```console +$ git submodule add https://github.com/tomanistor/osprey.git themes/osprey +``` + +Then run: + +```console +$ git submodule update --init --recursive --remote +``` + +## Configuration +Osprey comes with several configuration options to aid in site customization. This is an example config.toml file: + +```toml +title = "Osprey Example Site" +baseURL = "https://tomanistor.com" +tags = ["portfolio", "web design", "blog"] +languageCode = "en-US" +config = "config.toml" +theme = "osprey" +canonifyURLS = true +googleAnalytics = "" +disqusShortname = "tomanistor" +disableKinds = ["taxonomy", "taxonomyTerm"] # This theme does not currently use "tag" and "category" taxonomies + +[Params] + tagline = "Osprey Example Site" + author = "Toma Nistor" + description = "Full-stack web developer and UI/UX enthusiast based in San Diego, CA." + logoBig = "/images/osprey-logo.png" + logoSmall = "/images/osprey-logo.png" + favicon = "favicon.ico" + opengraphImage = "/images/osprey.png" + email = "" + googleTagManager = "" + customCSS = false + + # Social media links in footer + twitter = "TomaNistor" + linkedin = "tomanistor" + github = "tomanistor" + facebook = "" + + # Copyright and theme author credit in footer + copyright = false + credit = false + + # Cache busting of static resources (additional set up required) + cacheBustCSS = true + cacheBustJS = true + + # Code highlighting with highlight.js + highlightJS = true + highlightJSStyle = "" # For custom highlight.js styles, add your /path/to/styles/default.css + highlightJSScript = "" # For custom highlight.js languages config, add your /path/to/highlight.pack.js + + # Choose either Formspree contact form or Basin contact form + ajaxFormspree = false + ajaxFormspreeGold = false + ajaxBasin = "https://usebasin.com/f/0eae7044d4c2" + + # Lazy loading with lazysizes + lazyloading = true + +[[menu.main]] + name = "About" + url = "/#about" + weight = 1 +[[menu.main]] + name = "Work" + url = "/#work" + weight = 2 +[[menu.main]] + name = "Blog" + url = "/#blog" + weight = 3 +[[menu.main]] + name = "Contact" + url = "/#contact" + weight = 4 +``` + +## Using Osprey +The two main content types are blog posts and gallery images. + +### About Section +To create an about section that renders on the home page, run: + +```console +$ hugo new about.md +``` + +### Blog Posts +To create a new blog post, run: + +```console +$ hugo new blog/post-title.md +``` + +### Gallery Images +To add a new image to your portfolio, run: + +```console +$ hugo new gallery/image-title.md +``` + +The gallery archetype comes with its own configuration. Here is an example: + +```md ++++ +date = "2017-05-10T21:35:17-07:00" +title = "Image Title" +image = "image-file.png" +alt = "This is a description of the image" +color = "#7ac143" +link1 = "https://tomanistor.com" +link2 = "https://github.com/tomanistor" ++++ +``` + +### Contact Form +Two contact forms services are offered as options: Formspree and Basin. + +#### Formspree +_Update 4/15/18 - [Formspree no longer offers newly set up AJAX contact forms for free. This is now a Formspree Gold feature.](https://github.com/formspree/formspree/pull/173)_ You can either use the non-AJAX version of Formspree (which redirects to a Captcha page on form submit) by setting the config.toml parameter `ajaxFormspreeGold` to `false`, sign up for Formspree Gold and set the parameter to `true`, or sign up for Basin and use their contact form service for free. + +The email address specified in the config.toml file will be the one receiving messages sent through the contact form. The contact form is operated by Formspree and requires that the form must be submitted once initially to confirm the email address being used. See instruction [here](https://formspree.io/). + +#### Basin +Basin is an alternative, free AJAX contact form service. To use Basin, [sign up for a free account](https://usebasin.com/users/sign_up) and create a form. Copy and paste your form's URL endpoint to the `ajaxBasin` config.toml parameter. Select the `Submit this form via AJAX` option on your Basin dashboard. + +![Basin AJAX setup](https://github.com/tomanistor/osprey/blob/master/images/basin-ajax-setup.png) + +### Custom CSS +To implement custom CSS sitewide, change the config.toml parameter `customCSS` from `false` to `true` and then create a `css.html` file in your `layouts/partials/` folder like the example below: + +```html + +``` + +This will render inline CSS in the head of your site and without adding an extra HTTP request. + +### Cache Busting +As of `v2.1.0`, this theme uses native [Hugo Pipes](https://gohugo.io/hugo-pipes/introduction/) for cache busting of assets. Generated assets will be served from the `resources` folder and will no longer require any additional setup with Gulp. + +## Contributions +If you'd like to help with the development of this theme, I encourage you to submit a pull request or create an issue if you find a bug. All help is appreciated. + +## License +This theme is released under the Apache 2.0 license. For more information read the [license](https://github.com/tomanistor/osprey/blob/master/LICENSE). diff --git a/themes/distorsion/osprey/archetypes/blog.md b/themes/distorsion/osprey/archetypes/blog.md new file mode 100644 index 0000000..6c66d49 --- /dev/null +++ b/themes/distorsion/osprey/archetypes/blog.md @@ -0,0 +1,6 @@ ++++ +title = "{{ replace .TranslationBaseName "-" " " | title }}" +date = {{ .Date }} +description = "" +draft = true ++++ diff --git a/themes/distorsion/osprey/archetypes/default.md b/themes/distorsion/osprey/archetypes/default.md new file mode 100644 index 0000000..2971d56 --- /dev/null +++ b/themes/distorsion/osprey/archetypes/default.md @@ -0,0 +1,5 @@ ++++ +title = "{{ replace .TranslationBaseName "-" " " | title }}" +date = {{ .Date }} +draft = true ++++ diff --git a/themes/distorsion/osprey/archetypes/gallery.md b/themes/distorsion/osprey/archetypes/gallery.md new file mode 100644 index 0000000..05b0558 --- /dev/null +++ b/themes/distorsion/osprey/archetypes/gallery.md @@ -0,0 +1,11 @@ ++++ +title = "{{ replace .TranslationBaseName "-" " " | title }}" +date = {{ .Date }} +image = "" +alt = "" +color = "" +link1 = "" +link2 = "" +projectDate = "" +draft = true ++++ diff --git a/themes/distorsion/osprey/assets/js/src/contact.js b/themes/distorsion/osprey/assets/js/src/contact.js new file mode 100644 index 0000000..cfd5e38 --- /dev/null +++ b/themes/distorsion/osprey/assets/js/src/contact.js @@ -0,0 +1,67 @@ +(function() { + var $ = document.querySelector.bind(document) + + $('#form-contact').addEventListener('submit', function(e) { + e.preventDefault() + + // Store form field values + var name = $('input[name=name]').value, + email = $('input[name=email]').value, + subject = $('input[name=_subject]').value, + message = $('textarea[name=message]').value, + + // AJAX request + request = new XMLHttpRequest(), + data = { + name: name, + _replyto: email, + email: email, + _subject: subject, + message: message + } + + // Send to Formspree or Basin + request.open('POST', '{{ if .Site.Params.ajaxFormspree }}https://formspree.io/{{ .Site.Params.email }}{{ else if .Site.Params.ajaxBasin }}{{ .Site.Params.ajaxBasin }}.json{{ end }}', true) + request.setRequestHeader('Content-Type', 'application/json') + request.setRequestHeader('Accept', 'application/json') + // Call function when the state changes + request.onreadystatechange = function() { + if (request.readyState === 4 && request.status === 200) { + // Reset form + $('#form-contact').reset() + + var submit = $('#form-submit'), + thanks = $('#form-thankyou') + + function thankYouFadeIn() { + // Fade out submit button + submit.style.visibility = 'hidden' + submit.classList.add('hide') + submit.classList.remove('show') + + // Fade in thank you message + thanks.style.visibility = 'visible' + thanks.classList.add('show') + thanks.classList.remove('hide') + setTimeout(thankYouFadeOut, 6000) + }; + + function thankYouFadeOut() { + // Fade out thank you message + thanks.style.visibility = 'hidden' + thanks.classList.add('hide') + thanks.classList.remove('show') + + // Fade in submit button + submit.style.visibility = 'visible' + submit.classList.add('show') + submit.classList.remove('hide') + }; + + thankYouFadeIn() + } + } + + request.send(JSON.stringify(data)) + }) +})() diff --git a/themes/distorsion/osprey/assets/js/src/index.js b/themes/distorsion/osprey/assets/js/src/index.js new file mode 100644 index 0000000..9a52ef2 --- /dev/null +++ b/themes/distorsion/osprey/assets/js/src/index.js @@ -0,0 +1,99 @@ +(function() { + var $ = document.querySelector.bind(document), + $$ = document.querySelectorAll.bind(document), + + menuActive = false + + // Nav starts at bottom then is fixed to top + // Logo and hamburger menus fade in and out + window.onscroll = function() { + var scrollPosition = window.pageYOffset || document.documentElement.scrollTop, + windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight, + navHeight = $('nav').clientHeight + + if (scrollPosition > windowHeight - navHeight) { + // Nav is fixed to top + $('nav').classList.add('nav-fixed') + $$('nav > .logo, nav > .nav-toggle').forEach(function(el) { + el.style.visibility = 'visible' + el.classList.add('show') + el.classList.remove('hide') + }) + } else { + // Nav is not fixed + $('nav').classList.remove('nav-fixed') + $$('nav > .logo, nav > .nav-toggle').forEach(function(el) { + el.style.visibility = 'hidden' + el.classList.add('hide') + el.classList.remove('show') + }) + } + } + + // Full screen nav open on click + $('.nav-icon').addEventListener('click', function() { + $$('.nav-full, main').forEach(function(el) { + el.classList.toggle('active') + }) + if (menuActive) { + this.querySelector('img:nth-of-type(1)').style.display = 'inline-block' + this.querySelector('img:nth-of-type(2)').style.display = 'none' + menuActive = false + } else { + this.querySelector('img:nth-of-type(1)').style.display = 'none' + this.querySelector('img:nth-of-type(2)').style.display = 'inline-block' + menuActive = true + } + }) + + // Full screen nav close on click + $$('.nav-full a').forEach(function(links) { + links.addEventListener('click', function() { + $$('.nav-full, main').forEach(function(el) { + el.classList.toggle('active') + }) + }) + }) + + // Fix logoBig drawing over nav when click on logoSmall while nav open + $('.logo').addEventListener('click', function() { + if ($('.nav-full').classList.contains('active')) { + $$('.nav-full, main').forEach(function(el) { + el.classList.toggle('active') + }) + } + }) + + // Disable scroll when full screen nav is open + $('body').addEventListener('click', function() { + if ($('.nav-full').classList.contains('active')) { + $('html').style.overflowY = 'hidden' + } else { + $('html').style.overflowY = 'scroll' + } + }) + + // Mobile browsers viewport height bug fix + function fullMobileViewport() { + var element = this, + viewportHeight = window.innerHeight, + heightChangeTolerance = 100 // Approximate address bar height in Chrome + + $(window).resize(function() { + if (Math.abs(viewportHeight - window.innerHeight) > heightChangeTolerance) { + viewportHeight = window.innerHeight + update() + } + }) + + function update() { + element.style.height = (viewportHeight + 'px') + } + + update() + } + + $$('header').forEach(function() { + fullMobileViewport + }) +})() diff --git a/themes/distorsion/osprey/assets/js/src/main.js b/themes/distorsion/osprey/assets/js/src/main.js new file mode 100644 index 0000000..d993884 --- /dev/null +++ b/themes/distorsion/osprey/assets/js/src/main.js @@ -0,0 +1,57 @@ +(function() { + var $ = document.querySelector.bind(document), + $$ = document.querySelectorAll.bind(document), + + menuActive = false + + // Nav is fixed to top + $('nav').classList.add('nav-fixed') + $$('nav > .logo, nav > .nav-toggle').forEach(function(el) { + el.style.visibility = 'visible' + el.classList.add('show') + el.classList.remove('hide') + }) + + // Full screen nav open on click + $('.nav-icon').addEventListener('click', function() { + $$('.nav-full, main').forEach(function(el) { + el.classList.toggle('active') + }) + if (menuActive) { + this.querySelector('img:nth-of-type(1)').style.display = 'inline-block' + this.querySelector('img:nth-of-type(2)').style.display = 'none' + menuActive = false + } else { + this.querySelector('img:nth-of-type(1)').style.display = 'none' + this.querySelector('img:nth-of-type(2)').style.display = 'inline-block' + menuActive = true + } + }) + + // Full screen nav close on click + $$('.nav-full a').forEach(function(links) { + links.addEventListener('click', function() { + $$('.nav-full, main').forEach(function(el) { + el.classList.toggle('active') + }) + }) + }) + + // Fix logoBig drawing over nav when click on logoSmall while nav open + $('.logo').addEventListener('click', function() { + if ($('.nav-full').classList.contains('active')) { + $$('.nav-full, main').forEach(function(el) { + el.classList.toggle('active') + }) + } + }) + + // Disable scroll when full screen nav is open + $('body').addEventListener('click', function() { + if ($('.nav-full').classList.contains('active')) { + $('html').style.overflowY = 'hidden' + } else { + $('html').style.overflowY = 'scroll' + } + }) +})() diff --git a/themes/distorsion/osprey/assets/js/src/modal.js b/themes/distorsion/osprey/assets/js/src/modal.js new file mode 100644 index 0000000..9fbdc57 --- /dev/null +++ b/themes/distorsion/osprey/assets/js/src/modal.js @@ -0,0 +1,68 @@ +(function() { + var $ = document.querySelector.bind(document), + $$ = document.querySelectorAll.bind(document), + + modal, + + modalBoxes = $$('.modal-box'), + + // Link that opens modal + openLinks = $$('.gallery-modal-link'), + + // Link that closes modal + closeLinks = $$('.close') + + // Modal open animation + function openModal() { + modalBoxes.forEach(function(box) { + box.classList.add('scale-in-center') + box.classList.remove('scale-out-center') + }) + } + + // Modal close animation + function closeModal() { + modalBoxes.forEach(function(box) { + box.classList.remove('scale-in-center') + box.classList.add('scale-out-center') + // Remove active class from modal after modal-box animation is done + // box.addEventListener('animationend', function() { + // console.log('animation ended') + // modal.classList.remove('active') + // }) + setTimeout(function() { modal.classList.remove('active') }, 500) + }) + } + + // Open modal on link click + openLinks.forEach(function(link) { + link.onclick = function(e) { + e.preventDefault() + modal = $(e.target.getAttribute('href')) + modal.classList.add('active') + openModal() + } + }) + + // Close modal on close link + closeLinks.forEach(function(link) { + link.onclick = function(e) { + e.preventDefault() + closeModal() + } + }) + + // Close modal on click outside modal + window.onclick = function(e) { + if (e.target === modal) { + closeModal() + } + } + + // Close modal on ESC key press + document.onkeydown = function(e) { + if (e.key === 'Escape') { + closeModal() + } + } +})() diff --git a/themes/distorsion/osprey/assets/js/vendor/lazysizes.min.js b/themes/distorsion/osprey/assets/js/vendor/lazysizes.min.js new file mode 100644 index 0000000..1d652e6 --- /dev/null +++ b/themes/distorsion/osprey/assets/js/vendor/lazysizes.min.js @@ -0,0 +1,2 @@ +/*! lazysizes - v4.1.5 */ +!(function(a, b) { var c = b(a, a.document); a.lazySizes = c, typeof module === 'object' && module.exports && (module.exports = c) }(window, function(a, b) { 'use strict'; if (b.getElementsByClassName) { var c, d, e = b.documentElement, f = a.Date, g = a.HTMLPictureElement, h = 'addEventListener', i = 'getAttribute', j = a[h], k = a.setTimeout, l = a.requestAnimationFrame || k, m = a.requestIdleCallback, n = /^picture$/i, o = ['load', 'error', 'lazyincluded', '_lazyloaded'], p = {}, q = Array.prototype.forEach, r = function(a, b) { return p[b] || (p[b] = new RegExp('(\\s|^)' + b + '(\\s|$)')), p[b].test(a[i]('class') || '') && p[b] }, s = function(a, b) { r(a, b) || a.setAttribute('class', (a[i]('class') || '').trim() + ' ' + b) }, t = function(a, b) { var c; (c = r(a, b)) && a.setAttribute('class', (a[i]('class') || '').replace(c, ' ')) }, u = function(a, b, c) { var d = c ? h : 'removeEventListener'; c && u(a, b), o.forEach(function(c) { a[d](c, b) }) }, v = function(a, d, e, f, g) { var h = b.createEvent('Event'); return e || (e = {}), e.instance = c, h.initEvent(d, !f, !g), h.detail = e, a.dispatchEvent(h), h }, w = function(b, c) { var e; !g && (e = a.picturefill || d.pf) ? (c && c.src && !b[i]('srcset') && b.setAttribute('srcset', c.src), e({ reevaluate: !0, elements: [b] })) : c && c.src && (b.src = c.src) }, x = function(a, b) { return (getComputedStyle(a, null) || {})[b] }, y = function(a, b, c) { for (c = c || a.offsetWidth; c < d.minSize && b && !a._lazysizesWidth;)c = b.offsetWidth, b = b.parentNode; return c }, z = (function() { var a, c, d = [], e = [], f = d, g = function() { var b = f; for (f = d.length ? e : d, a = !0, c = !1; b.length;)b.shift()(); a = !1 }, h = function(d, e) { a && !e ? d.apply(this, arguments) : (f.push(d), c || (c = !0, (b.hidden ? k : l)(g))) }; return h._lsFlush = g, h }()), A = function(a, b) { return b ? function() { z(a) } : function() { var b = this, c = arguments; z(function() { a.apply(b, c) }) } }, B = function(a) { var b, c = 0, e = d.throttleDelay, g = d.ricTimeout, h = function() { b = !1, c = f.now(), a() }, i = m && g > 49 ? function() { m(h, { timeout: g }), g !== d.ricTimeout && (g = d.ricTimeout) } : A(function() { k(h) }, !0); return function(a) { var d; (a = !0 === a) && (g = 33), b || (b = !0, d = e - (f.now() - c), d < 0 && (d = 0), a || d < 9 ? i() : k(i, d)) } }, C = function(a) { var b, c, d = 99, e = function() { b = null, a() }, g = function() { var a = f.now() - c; a < d ? k(g, d - a) : (m || e)(e) }; return function() { c = f.now(), b || (b = k(g, d)) } }; !(function() { var b, c = { lazyClass: 'lazyload', loadedClass: 'lazyloaded', loadingClass: 'lazyloading', preloadClass: 'lazypreload', errorClass: 'lazyerror', autosizesClass: 'lazyautosizes', srcAttr: 'data-src', srcsetAttr: 'data-srcset', sizesAttr: 'data-sizes', minSize: 40, customMedia: {}, init: !0, expFactor: 1.5, hFac: 0.8, loadMode: 2, loadHidden: !0, ricTimeout: 0, throttleDelay: 125 }; d = a.lazySizesConfig || a.lazysizesConfig || {}; for (b in c)b in d || (d[b] = c[b]); a.lazySizesConfig = d, k(function() { d.init && F() }) }()); var D = (function() { var g, l, m, o, p, y, D, F, G, H, I, J = /^img$/i, K = /^iframe$/i, L = 'onscroll' in a && !/(gle|ing)bot/.test(navigator.userAgent), M = 0, N = 0, O = 0, P = -1, Q = function(a) { O--, a && a.target && u(a.target, Q), (!a || O < 0 || !a.target) && (O = 0) }, R = function(a, c) { var d, f = a, g = x(b.body, 'visibility') == 'hidden' || x(a.parentNode, 'visibility') != 'hidden' && x(a, 'visibility') != 'hidden'; for (F -= c, I += c, G -= c, H += c; g && (f = f.offsetParent) && f != b.body && f != e;)(g = (x(f, 'opacity') || 1) > 0) && x(f, 'overflow') != 'visible' && (d = f.getBoundingClientRect(), g = H > d.left && G < d.right && I > d.top - 1 && F < d.bottom + 1); return g }, S = function() { var a, f, h, j, k, m, n, p, q, r, s, t, u = c.elements; if ((o = d.loadMode) && O < 8 && (a = u.length)) { for (f = 0, P++, r = !d.expand || d.expand < 1 ? e.clientHeight > 500 && e.clientWidth > 500 ? 500 : 370 : d.expand, s = r * d.expFactor, t = d.hFac, N < s && O < 1 && P > 2 && o > 2 && !b.hidden ? (N = s, P = 0) : N = o > 1 && P > 1 && O < 6 ? r : M; f < a; f++) if (u[f] && !u[f]._lazyRace) if (L) if ((p = u[f][i]('data-expand')) && (m = 1 * p) || (m = N), q !== m && (y = innerWidth + m * t, D = innerHeight + m, n = -1 * m, q = m), h = u[f].getBoundingClientRect(), (I = h.bottom) >= n && (F = h.top) <= D && (H = h.right) >= n * t && (G = h.left) <= y && (I || H || G || F) && (d.loadHidden || x(u[f], 'visibility') != 'hidden') && (l && O < 3 && !p && (o < 3 || P < 4) || R(u[f], m))) { if ($(u[f]), k = !0, O > 9) break } else !k && l && !j && O < 4 && P < 4 && o > 2 && (g[0] || d.preloadAfterLoad) && (g[0] || !p && (I || H || G || F || u[f][i](d.sizesAttr) != 'auto')) && (j = g[0] || u[f]); else $(u[f]); j && !k && $(j) } }, T = B(S), U = function(a) { s(a.target, d.loadedClass), t(a.target, d.loadingClass), u(a.target, W), v(a.target, 'lazyloaded') }, V = A(U), W = function(a) { V({ target: a.target }) }, X = function(a, b) { try { a.contentWindow.location.replace(b) } catch (c) { a.src = b } }, Y = function(a) { var b, c = a[i](d.srcsetAttr); (b = d.customMedia[a[i]('data-media') || a[i]('media')]) && a.setAttribute('media', b), c && a.setAttribute('srcset', c) }, Z = A(function(a, b, c, e, f) { var g, h, j, l, o, p; (o = v(a, 'lazybeforeunveil', b)).defaultPrevented || (e && (c ? s(a, d.autosizesClass) : a.setAttribute('sizes', e)), h = a[i](d.srcsetAttr), g = a[i](d.srcAttr), f && (j = a.parentNode, l = j && n.test(j.nodeName || '')), p = b.firesLoad || 'src' in a && (h || g || l), o = { target: a }, p && (u(a, Q, !0), clearTimeout(m), m = k(Q, 2500), s(a, d.loadingClass), u(a, W, !0)), l && q.call(j.getElementsByTagName('source'), Y), h ? a.setAttribute('srcset', h) : g && !l && (K.test(a.nodeName) ? X(a, g) : a.src = g), f && (h || l) && w(a, { src: g })), a._lazyRace && delete a._lazyRace, t(a, d.lazyClass), z(function() { (!p || a.complete && a.naturalWidth > 1) && (p ? Q(o) : O--, U(o)) }, !0) }), $ = function(a) { var b, c = J.test(a.nodeName), e = c && (a[i](d.sizesAttr) || a[i]('sizes')), f = e == 'auto'; (!f && l || !c || !a[i]('src') && !a.srcset || a.complete || r(a, d.errorClass) || !r(a, d.lazyClass)) && (b = v(a, 'lazyunveilread').detail, f && E.updateElem(a, !0, a.offsetWidth), a._lazyRace = !0, O++, Z(a, b, f, e, c)) }, _ = function() { if (!l) { if (f.now() - p < 999) return void k(_, 999); var a = C(function() { d.loadMode = 3, T() }); l = !0, d.loadMode = 3, T(), j('scroll', function() { d.loadMode == 3 && (d.loadMode = 2), a() }, !0) } }; return { _: function() { p = f.now(), c.elements = b.getElementsByClassName(d.lazyClass), g = b.getElementsByClassName(d.lazyClass + ' ' + d.preloadClass), j('scroll', T, !0), j('resize', T, !0), a.MutationObserver ? new MutationObserver(T).observe(e, { childList: !0, subtree: !0, attributes: !0 }) : (e[h]('DOMNodeInserted', T, !0), e[h]('DOMAttrModified', T, !0), setInterval(T, 999)), j('hashchange', T, !0), ['focus', 'mouseover', 'click', 'load', 'transitionend', 'animationend', 'webkitAnimationEnd'].forEach(function(a) { b[h](a, T, !0) }), /d$|^c/.test(b.readyState) ? _() : (j('load', _), b[h]('DOMContentLoaded', T), k(_, 2e4)), c.elements.length ? (S(), z._lsFlush()) : T() }, checkElems: T, unveil: $ } }()), E = (function() { var a, c = A(function(a, b, c, d) { var e, f, g; if (a._lazysizesWidth = d, d += 'px', a.setAttribute('sizes', d), n.test(b.nodeName || '')) for (e = b.getElementsByTagName('source'), f = 0, g = e.length; f < g; f++)e[f].setAttribute('sizes', d); c.detail.dataAttr || w(a, c.detail) }), e = function(a, b, d) { var e, f = a.parentNode; f && (d = y(a, f, d), e = v(a, 'lazybeforesizes', { width: d, dataAttr: !!b }), e.defaultPrevented || (d = e.detail.width) && d !== a._lazysizesWidth && c(a, f, e, d)) }, f = function() { var b, c = a.length; if (c) for (b = 0; b < c; b++)e(a[b]) }, g = C(f); return { _: function() { a = b.getElementsByClassName(d.autosizesClass), j('resize', g) }, checkElems: g, updateElem: e } }()), F = function() { F.i || (F.i = !0, E._(), D._()) }; return c = { cfg: d, autoSizer: E, loader: D, init: F, uP: w, aC: s, rC: t, hC: r, fire: v, gW: y, rAF: z } } })) diff --git a/themes/distorsion/osprey/assets/sass/_about.scss b/themes/distorsion/osprey/assets/sass/_about.scss new file mode 100644 index 0000000..faf4d67 --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/_about.scss @@ -0,0 +1,28 @@ +.about { + width: 100%; + background-color: $smoke; + + p { + @include size(h3); + margin-top: $vertical-rhythm; + } + + a { + background-image: linear-gradient($accent, $accent); + background-repeat: repeat-x; + background-position: 0 95%; + background-size: 2px 3px; + text-decoration: none; + text-shadow: .03em 0 $white, -.03em 0 $white, 0 .03em $white, 0 -.03em $white, + .06em 0 $white, -.06em 0 $white, .09em 0 $white, -.09em 0 $white, + .12em 0 $white, -.12em 0 $white, .15em 0 $white, -.15em 0 $white, + .03em .075em $white, -.03em .075em $white, .06em .075em $white, + -.06em .075em $white, .09em .075em $white, -.09em .075em $white, + .12em .075em $white, -.12em .075em $white, .15em .075em $white, + -.15em .075em $white; + + &:hover { + color: $accent; + } + } +} diff --git a/themes/distorsion/osprey/assets/sass/_animation.scss b/themes/distorsion/osprey/assets/sass/_animation.scss new file mode 100644 index 0000000..e998cc8 --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/_animation.scss @@ -0,0 +1,46 @@ +@keyframes blink { + from, + to { + color: transparent; + } + + 50% { + color: $black; + } +} + +@keyframes scale-in-center { + 0% { + transform: scale(0); + opacity: 1; + } + + 100% { + transform: scale(1); + opacity: 1; + } +} + +@keyframes scale-out-center { + 0% { + transform: scale(1); + opacity: 1; + } + + 100% { + transform: scale(0); + opacity: 1; + } +} + +.cursor { + animation: 1s blink step-end infinite; +} + +.scale-in-center { + animation: scale-in-center .3s cubic-bezier(.25, .46, .45, .94) both; +} + +.scale-out-center { + animation: scale-out-center .5s cubic-bezier(.895, .03, .685, .22) both; +} diff --git a/themes/distorsion/osprey/assets/sass/_base.scss b/themes/distorsion/osprey/assets/sass/_base.scss new file mode 100644 index 0000000..e35ffdc --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/_base.scss @@ -0,0 +1,162 @@ +// Font styles +strong { + font-weight: 600; +} + +del, +s { + text-decoration: line-through; +} + +em, +dfn { + font-style: italic; +} + +a { + transition: color .2s ease-out; + text-decoration: none; + + img { + border: 0; + } + + &:hover { + color: $accent; + } +} + + +// Code +pre { + margin-top: 0; + margin-bottom: $vertical-rhythm; + padding: 16px; + overflow: auto; + background-color: $smoke; + font: 12px "Consolas", "Liberation Mono", "Menlo", "Courier", monospace; + font-family: $font-code; + font-size: 85%; + line-height: 1.45; + word-wrap: normal; + + & > code { + margin: 0; + padding: 0; + border: 0; + background: transparent; + font-size: 100%; + word-break: normal; + white-space: pre; + } + + code { + display: inline; + margin: 0; + padding: 0; + overflow: visible; + border: 0; + background-color: transparent; + line-height: inherit; + word-wrap: normal; + + &::before, + &::after { + content: normal; + } + } +} + +code { + padding: 4px; + background-color: $smoke; + font-family: $font-code; + font-size: 90%; +} + +.sans { + font-family: "Open Sans", "Myriad Pro", "Myriad", sans-serif; +} + +.mono, +tt { + font-family: $font-code; +} + + +// Quotes +q { + @extend em; + + &::before { + content: "\201C"; + } + + &::after { + content: "\201D"; + } +} + +%blockquote { + content: "\201C"; + color: $accent; + font-family: $font-header; + font-size: 35px; +} + +blockquote { + padding: 25px; + font-family: $font-header; + text-align: center; + + p { + display: inline-block; + font-style: italic; + } + + &::before { + @extend %blockquote; + } + + &::after { + @extend %blockquote; + content: "\201D"; + } +} + + +// Images +img { + display: inline-block; + max-width: 100%; + vertical-align: middle; +} + + +// Lists +ul, +ol { + margin-bottom: $vertical-rhythm; + + li { + margin-left: 1.25em; + + code { + font-family: $font-code; + } + } +} + +ul li { + list-style-type: disc; +} + + +// Show or hide elements +.show { + transition: opacity 600ms; +} + +.hide { + opacity: 0; +} diff --git a/themes/distorsion/osprey/assets/sass/_colors.scss b/themes/distorsion/osprey/assets/sass/_colors.scss new file mode 100644 index 0000000..4f47367 --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/_colors.scss @@ -0,0 +1,7 @@ +// https://coolors.co/1e1e1e-4e6b6c-f7f7f7-ffffff-da784d + +$black: #212121; +$storm: #4E6B6C; +$smoke: #F7F7F7; +$accent: #DA784D; +$white: #FFFFFF; diff --git a/themes/distorsion/osprey/assets/sass/_flexboxgrid.scss b/themes/distorsion/osprey/assets/sass/_flexboxgrid.scss new file mode 100644 index 0000000..fd53611 --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/_flexboxgrid.scss @@ -0,0 +1,882 @@ +//column-base selectors +//.col-xs, .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-offset-0, .col-xs-offset-1, .col-xs-offset-2, .col-xs-offset-3, .col-xs-offset-4, .col-xs-offset-5, .col-xs-offset-6, .col-xs-offset-7, .col-xs-offset-8, .col-xs-offset-9, .col-xs-offset-10, .col-xs-offset-11, .col-xs-offset-12 +%column-base { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; +} +.container-fluid { + margin-right: auto; + margin-left: auto; + padding-right: 2rem; + padding-left: 2rem; +} +.container { + margin-right: auto; + margin-left: auto; +} +.row { + box-sizing: border-box; + display: flex; + flex: 0 1 auto; + flex-direction: row; + flex-wrap: wrap; + // margin-right: -0.5rem; + // margin-left: -0.5rem; + &.reverse { + flex-direction: row-reverse; + } +} +.col-xs { + @extend %column-base; + flex-grow: 1; + flex-basis: 0; + max-width: 100%; +} +.col-xs-1 { + @extend %column-base; + flex-basis: 8.33333333%; + max-width: 8.33333333%; +} +.col-xs-2 { + @extend %column-base; + flex-basis: 16.66666667%; + max-width: 16.66666667%; +} +.col-xs-3 { + @extend %column-base; + flex-basis: 25%; + max-width: 25%; +} +.col-xs-4 { + @extend %column-base; + flex-basis: 33.33333333%; + max-width: 33.33333333%; +} +.col-xs-5 { + @extend %column-base; + flex-basis: 41.66666667%; + max-width: 41.66666667%; +} +.col-xs-6 { + @extend %column-base; + flex-basis: 50%; + max-width: 50%; +} +.col-xs-7 { + @extend %column-base; + flex-basis: 58.33333333%; + max-width: 58.33333333%; +} +.col-xs-8 { + @extend %column-base; + flex-basis: 66.66666667%; + max-width: 66.66666667%; +} +.col-xs-9 { + @extend %column-base; + flex-basis: 75%; + max-width: 75%; +} +.col-xs-10 { + @extend %column-base; + flex-basis: 83.33333333%; + max-width: 83.33333333%; +} +.col-xs-11 { + @extend %column-base; + flex-basis: 91.66666667%; + max-width: 91.66666667%; +} +.col-xs-12 { + @extend %column-base; + flex-basis: 100%; + max-width: 100%; +} +.col-xs-offset-0 { + @extend %column-base; + margin-left: 0; +} +.col-xs-offset-1 { + @extend %column-base; + margin-left: 8.33333333%; +} +.col-xs-offset-2 { + @extend %column-base; + margin-left: 16.66666667%; +} +.col-xs-offset-3 { + @extend %column-base; + margin-left: 25%; +} +.col-xs-offset-4 { + @extend %column-base; + margin-left: 33.33333333%; +} +.col-xs-offset-5 { + @extend %column-base; + margin-left: 41.66666667%; +} +.col-xs-offset-6 { + @extend %column-base; + margin-left: 50%; +} +.col-xs-offset-7 { + @extend %column-base; + margin-left: 58.33333333%; +} +.col-xs-offset-8 { + @extend %column-base; + margin-left: 66.66666667%; +} +.col-xs-offset-9 { + @extend %column-base; + margin-left: 75%; +} +.col-xs-offset-10 { + @extend %column-base; + margin-left: 83.33333333%; +} +.col-xs-offset-11 { + @extend %column-base; + margin-left: 91.66666667%; +} +.col-xs-offset-12 { + @extend %column-base; +} +.start-xs { + justify-content: flex-start; + text-align: start; +} +.center-xs { + justify-content: center; + text-align: center; +} +.end-xs { + justify-content: flex-end; + text-align: end; +} +.top-xs { + align-items: flex-start; +} +.middle-xs { + align-items: center; +} +.bottom-xs { + align-items: flex-end; +} +.around-xs { + justify-content: space-around; +} +.between-xs { + justify-content: space-between; +} +.first-xs { + order: -1; +} +.last-xs { + order: 1; +} +@media only screen and(min-width: 48em) { + .container { + width: 49rem; + } + .col-sm { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-grow: 1; + flex-basis: 0; + max-width: 100%; + } + .col-sm-1 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 8.33333333%; + max-width: 10.33333333%; + } + .col-sm-2 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 16.66666667%; + max-width: 16.66666667%; + } + .col-sm-3 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 25%; + max-width: 25%; + } + .col-sm-4 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 33.33333333%; + max-width: 33.33333333%; + } + .col-sm-5 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 41.66666667%; + max-width: 41.66666667%; + } + .col-sm-6 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 50%; + max-width: 50%; + } + .col-sm-7 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 58.33333333%; + max-width: 58.33333333%; + } + .col-sm-8 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 66.66666667%; + max-width: 66.66666667%; + } + .col-sm-9 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 75%; + max-width: 75%; + } + .col-sm-10 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 83.33333333%; + max-width: 83.33333333%; + } + .col-sm-11 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 91.66666667%; + max-width: 91.66666667%; + } + .col-sm-12 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 100%; + max-width: 100%; + } + .col-sm-offset-0 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 0; + } + .col-sm-offset-1 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 8.33333333%; + } + .col-sm-offset-2 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 16.66666667%; + } + .col-sm-offset-3 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 25%; + } + .col-sm-offset-4 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 33.33333333%; + } + .col-sm-offset-5 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 41.66666667%; + } + .col-sm-offset-6 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 50%; + } + .col-sm-offset-7 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 58.33333333%; + } + .col-sm-offset-8 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 66.66666667%; + } + .col-sm-offset-9 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 75%; + } + .col-sm-offset-10 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 83.33333333%; + } + .col-sm-offset-11 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 91.66666667%; + } + .col-sm-offset-12 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + } + .start-sm { + justify-content: flex-start; + text-align: start; + } + .center-sm { + justify-content: center; + text-align: center; + } + .end-sm { + justify-content: flex-end; + text-align: end; + } + .top-sm { + align-items: flex-start; + } + .middle-sm { + align-items: center; + } + .bottom-sm { + align-items: flex-end; + } + .around-sm { + justify-content: space-around; + } + .between-sm { + justify-content: space-between; + } + .first-sm { + order: -1; + } + .last-sm { + order: 1; + } +} +@media only screen and(min-width: 64em) { + .container { + width: 65rem; + } + .col-md { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-grow: 1; + flex-basis: 0; + max-width: 100%; + } + .col-md-1 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 8.33333333%; + max-width: 8.33333333%; + } + .col-md-2 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 16.66666667%; + max-width: 16.66666667%; + } + .col-md-3 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 25%; + max-width: 25%; + } + .col-md-4 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 33.33333333%; + max-width: 33.33333333%; + } + .col-md-5 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 41.66666667%; + max-width: 41.66666667%; + } + .col-md-6 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 50%; + max-width: 50%; + } + .col-md-7 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 58.33333333%; + max-width: 58.33333333%; + } + .col-md-8 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 66.66666667%; + max-width: 66.66666667%; + } + .col-md-9 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 75%; + max-width: 75%; + } + .col-md-10 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 83.33333333%; + max-width: 83.33333333%; + } + .col-md-11 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 91.66666667%; + max-width: 91.66666667%; + } + .col-md-12 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 100%; + max-width: 100%; + } + .col-md-offset-0 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 0; + } + .col-md-offset-1 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 8.33333333%; + } + .col-md-offset-2 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 16.66666667%; + } + .col-md-offset-3 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 25%; + } + .col-md-offset-4 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 33.33333333%; + } + .col-md-offset-5 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 41.66666667%; + } + .col-md-offset-6 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 50%; + } + .col-md-offset-7 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 58.33333333%; + } + .col-md-offset-8 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 66.66666667%; + } + .col-md-offset-9 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 75%; + } + .col-md-offset-10 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 83.33333333%; + } + .col-md-offset-11 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 91.66666667%; + } + .col-md-offset-12 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + } + .start-md { + justify-content: flex-start; + text-align: start; + } + .center-md { + justify-content: center; + text-align: center; + } + .end-md { + justify-content: flex-end; + text-align: end; + } + .top-md { + align-items: flex-start; + } + .middle-md { + align-items: center; + } + .bottom-md { + align-items: flex-end; + } + .around-md { + justify-content: space-around; + } + .between-md { + justify-content: space-between; + } + .first-md { + order: -1; + } + .last-md { + order: 1; + } +} +@media only screen and(min-width: 75em) { + .container { + width: 76rem; + } + .col-lg { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-grow: 1; + flex-basis: 0; + max-width: 100%; + } + .col-lg-1 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 8.33333333%; + max-width: 8.33333333%; + } + .col-lg-2 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 16.66666667%; + max-width: 16.66666667%; + } + .col-lg-3 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 25%; + max-width: 25%; + } + .col-lg-4 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 33.33333333%; + max-width: 33.33333333%; + } + .col-lg-5 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 41.66666667%; + max-width: 41.66666667%; + } + .col-lg-6 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 50%; + max-width: 50%; + } + .col-lg-7 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 58.33333333%; + max-width: 58.33333333%; + } + .col-lg-8 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 66.66666667%; + max-width: 66.66666667%; + } + .col-lg-9 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 75%; + max-width: 75%; + } + .col-lg-10 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 83.33333333%; + max-width: 83.33333333%; + } + .col-lg-11 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 91.66666667%; + max-width: 91.66666667%; + } + .col-lg-12 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + flex-basis: 100%; + max-width: 100%; + } + .col-lg-offset-0 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 0; + } + .col-lg-offset-1 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 8.33333333%; + } + .col-lg-offset-2 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 16.66666667%; + } + .col-lg-offset-3 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 25%; + } + .col-lg-offset-4 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 33.33333333%; + } + .col-lg-offset-5 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 41.66666667%; + } + .col-lg-offset-6 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 50%; + } + .col-lg-offset-7 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 58.33333333%; + } + .col-lg-offset-8 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 66.66666667%; + } + .col-lg-offset-9 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 75%; + } + .col-lg-offset-10 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 83.33333333%; + } + .col-lg-offset-11 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + margin-left: 91.66666667%; + } + .col-lg-offset-12 { + box-sizing: border-box; + flex: 0 0 auto; + padding-right: 0.5rem; + padding-left: 0.5rem; + } + .start-lg { + justify-content: flex-start; + text-align: start; + } + .center-lg { + justify-content: center; + text-align: center; + } + .end-lg { + justify-content: flex-end; + text-align: end; + } + .top-lg { + align-items: flex-start; + } + .middle-lg { + align-items: center; + } + .bottom-lg { + align-items: flex-end; + } + .around-lg { + justify-content: space-around; + } + .between-lg { + justify-content: space-between; + } + .first-lg { + order: -1; + } + .last-lg { + order: 1; + } +} +.col.reverse { + flex-direction: column-reverse; +} diff --git a/themes/distorsion/osprey/assets/sass/_gallery.scss b/themes/distorsion/osprey/assets/sass/_gallery.scss new file mode 100644 index 0000000..29a00a4 --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/_gallery.scss @@ -0,0 +1,70 @@ +.gallery { + .gallery-item { + position: relative; + width: 50%; + padding: 0; + + &::after { + content: ""; + display: block; + padding-bottom: 100%; + } + + &:hover { + .overlay { + visibility: visible; + opacity: 1; + } + } + } + + .overlay { + visibility: hidden; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + transition: .2s ease-out; + opacity: 0; + background-color: $black; + cursor: pointer; + + a { + color: $white; + + &:hover { + color: $accent; + } + } + + h2 { + margin: $vertical-rhythm; + color: $white; + } + } + + .gallery-img-container { + display: flex; + position: absolute; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + } + + img { + padding: $vertical-rhythm * 3; + } + + .gallery-modal-link { + display: flex; + position: absolute; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + } +} diff --git a/themes/distorsion/osprey/assets/sass/_layout.scss b/themes/distorsion/osprey/assets/sass/_layout.scss new file mode 100644 index 0000000..bed033b --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/_layout.scss @@ -0,0 +1,57 @@ +* { + box-sizing: border-box; + margin: 0; + padding: 0; + border: 0; + color: $black; + font: inherit; + vertical-align: baseline; + + &::before, + &::after { + box-sizing: border-box; + } +} + +html { + box-sizing: inherit; + overflow-x: hidden; +} + +body { + @include size(p); + display: flex; + flex-direction: column; + justify-content: space-between; + min-height: 100vh; + color: $black; + font-family: $font-body; + line-height: $base-line-height; +} + +header { + height: 100vh; + background-color: $white; + + div { + z-index: 101; + } + + img { + max-height: $vertical-rhythm * 6; + } + + h1 { + font-family: $font-body; + } +} + +footer { + height: $vertical-rhythm * 6; + background-color: $black; + + div, + a { + color: $white; + } +} diff --git a/themes/distorsion/osprey/assets/sass/_modal.scss b/themes/distorsion/osprey/assets/sass/_modal.scss new file mode 100644 index 0000000..9b70fda --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/_modal.scss @@ -0,0 +1,79 @@ +.modal { + display: flex; + visibility: hidden; + position: fixed; + z-index: -1000; + top: 0; + left: 0; + width: 100%; + height: 100%; + overflow: hidden; + overflow-x: hidden; + transition: opacity .2s ease-out; + // opacity: 0; + background-color: rgba(33, 33, 33, .75); + + &.active { + visibility: visible; + z-index: 1000; + // opacity: 1; + } +} + +.modal-box { + position: relative; + width: 80%; + max-width: 1000px; + max-height: 80vh; + margin: auto; + border-radius: 3px; + background-color: $smoke; + box-shadow: 0 0 50px 0 rgba(33, 33, 33, 1); +} + +.modal-container { + overflow: hidden; + border-bottom-left-radius: inherit; + border-bottom-right-radius: inherit; +} + +.modal-header { + height: 20vh; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} + +.modal-header-img-container { + display: flex; + align-items: center; + justify-content: center; + height: 100%; + padding: 40px; + + img { + max-height: 100%; + } +} + +.modal-content { + max-height: calc(80vh - 20vh); + padding: 30px; + overflow-y: auto; +} + +.close { + position: absolute; + top: -20px; + right: -30px; + color: $smoke; + font-size: 30px; + font-weight: bold; + line-height: .5; + + &:hover, + &:focus { + color: $accent; + text-decoration: none; + cursor: pointer; + } +} diff --git a/themes/distorsion/osprey/assets/sass/_typography.scss b/themes/distorsion/osprey/assets/sass/_typography.scss new file mode 100644 index 0000000..1667d20 --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/_typography.scss @@ -0,0 +1,58 @@ +$font-header: "Bitter", "Roboto Slab", "Cambria", Georgia, serif; +$font-body: "Rubik", "Poppins", "Helvetica", Arial, sans-serif; +$font-code: "Menlo", "Monaco", "Andale Mono", "lucida console", "Courier New", monospace; + +// Modular font scale +// Large: http://www.modularscale.com/?1.25&em&1.333&web&text +// Medium: http://www.modularscale.com/?1.25&em&1.25&web&text +// SMall: http://www.modularscale.com/?1.1&em&1.25&web&text + +$font-scale-large: ( + h1: 2.961rem, + h2: 2.221rem, + h3: 1.666rem, + p: 1.25rem +); + +$font-scale-medium: ( + h1: 2.441rem, + h2: 1.953em, + h3: 1.563rem, + p: 1.25rem, +); + +$font-scale-small: ( + h1: 2.148rem, + h2: 1.719rem, + h3: 1.375rem, + p: 1.1rem +); + +$base-line-height: 1.6; +$base-font-size: 1.25rem; // 20px +$vertical-rhythm: $base-line-height * $base-font-size; // 2.125em or 34px + +$breakpoint-medium: 49.99em; // 768px +$breakpoint-small: 25em; // 400px + +@mixin size($level) { + font-size: map-get($font-scale-large, $level); + @media (max-width: $breakpoint-medium) { + font-size: map-get($font-scale-medium, $level); + } + @media (max-width: $breakpoint-small) { + font-size: map-get($font-scale-small, $level); + } +} + +h1 { + @include size(h1); +} + +h2 { + @include size(h2); +} + +h3 { + @include size(h3); +} diff --git a/themes/distorsion/osprey/assets/sass/main.scss b/themes/distorsion/osprey/assets/sass/main.scss new file mode 100644 index 0000000..209413e --- /dev/null +++ b/themes/distorsion/osprey/assets/sass/main.scss @@ -0,0 +1,273 @@ +@import url("https://fonts.googleapis.com/css?family=Rubik|Bitter"); +@import "flexboxgrid"; +@import "colors"; +@import "typography"; +@import "animation"; +@import "layout"; +@import "base"; +@import "modal"; +@import "about"; +@import "gallery"; + +@media (max-width: 47.99em) { + body .container { + padding: $vertical-rhythm * 4 $vertical-rhythm; + } + + nav { + // Hide menu links between logo and hamburger menu + div:not(:first-child):not(:last-child) { + display: none; + } + + div.nav-toggle a { + display: inline-block; + } + } +} + +@media (max-width: 25em) { + body .container { + padding: $vertical-rhythm * 4 $vertical-rhythm; + } + + nav { + div.logo, + div.nav-toggle { + max-width: 50% !important; + } + } +} + +nav { + position: absolute; + z-index: 100; + bottom: 0; + width: 100%; + height: $vertical-rhythm * 2; + background-color: $white; + box-shadow: 0 2px 2px rgba(0, 0, 0, .4); + text-align: center; + + h3 { + margin: 0; + font-family: $font-body; + font-weight: 600; + letter-spacing: 2px; + text-transform: uppercase; + } + + img { + display: inline-block; + max-width: 10em; + max-height: 2.5em; + vertical-align: middle; + } + + .logo, + .nav-toggle { + visibility: hidden; + } + + .nav-toggle a { + display: none; + } +} + +.nav-fixed { + position: fixed; + top: 0; + bottom: auto; +} + +.nav-full { + position: fixed; + top: 0; + right: -100vw; + bottom: 0; + width: 100vw; + height: 100%; + transform: translate(0, 0); + transition: .25s ease-out; + background-color: $black; + + a { + color: $white; + + &:hover { + color: $accent; + } + } +} + +.nav-full.active { + transform: translate(-100vw, 0); +} + +main { + transition: .25s ease-in; + background-color: $white; + + &.active { + transform: translate(-100vw, 0); + } +} + +.container { + max-width: 43.75rem; // 700px + margin: auto; + padding: $vertical-rhythm * 4 0 $vertical-rhythm * 4; +} + +p { + margin-bottom: $vertical-rhythm; + + code { + font-family: $font-code; + } +} + +h1, +h2, +h3 { + margin-bottom: $vertical-rhythm; + font-family: $font-header; + letter-spacing: 2px; + line-height: 1.45; + + a { + text-decoration: none; + } +} + +.home-logo { + margin-bottom: $vertical-rhythm; +} + +.posts-list { + margin: 0 0 $vertical-rhythm; +} + +.sub-header, +time { + @include size(p); + margin-bottom: $vertical-rhythm; + color: $storm; +} + +.content { + width: 100%; + text-align: left; + + time { + margin-left: 3px; + } + + a { + background-image: linear-gradient($accent, $accent); + background-repeat: repeat-x; + background-position: 0 95%; + background-size: 1px 2px; + text-decoration: none; + text-shadow: .03em 0 $white, -.03em 0 $white, 0 .03em $white, 0 -.03em $white, + .06em 0 $white, -.06em 0 $white, .09em 0 $white, -.09em 0 $white, + .12em 0 $white, -.12em 0 $white, .15em 0 $white, -.15em 0 $white, + .03em .075em $white, -.03em .075em $white, .06em .075em $white, + -.06em .075em $white, .09em .075em $white, -.09em .075em $white, + .12em .075em $white, -.12em .075em $white, .15em .075em $white, + -.15em .075em $white; + + &:hover { + color: $accent; + } + } +} + +.highlight { + margin: 10px 0; +} + +.pagination { + margin: 50px 0 0; + + &:nth-child(2) { + float: right; + } +} + +.full { + top: 0; + bottom: 0; + height: 100vh; +} + +.blog { + display: flex; + min-height: 100vh; + + h2 { + margin-bottom: 0; + } + + h3 { + margin: 0 0 $vertical-rhythm * 2; + font-family: $font-body; + } +} + +.contact { + width: 100%; + padding-bottom: $vertical-rhythm * 2; + background-color: $smoke; + + form { + margin-top: $vertical-rhythm; + } + + .contact-submit { + position: relative; + } + + #form-submit { + display: block; + width: 50%; + margin: 0 auto; + } + + #form-thankyou { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } +} + +input { + width: 100%; + margin: 8px 0; + padding: 10px; + border-width: 1px; + border-style: solid; + border-radius: 3px; + border-color: $smoke; + background-color: $white; + color: $black; + + &[type="submit"] { + transition: .2s ease-out; + background-color: $storm; + color: $white; + + &:hover { + background-color: $accent; + color: $white; + cursor: pointer; + } + } +} + +textarea { + @extend input; + min-height: $vertical-rhythm * 4; + overflow: auto; +} diff --git a/themes/distorsion/osprey/exampleSite/config.toml b/themes/distorsion/osprey/exampleSite/config.toml new file mode 100644 index 0000000..8a0436d --- /dev/null +++ b/themes/distorsion/osprey/exampleSite/config.toml @@ -0,0 +1,66 @@ +title = "Osprey Example Site" +baseURL = "https://tomanistor.com" +tags = ["portfolio", "web design", "blog"] +languageCode = "en-US" +config = "config.toml" +theme = "osprey" +canonifyURLS = true +googleAnalytics = "" +disqusShortname = "tomanistor" +disableKinds = ["taxonomy", "taxonomyTerm"] # This theme does not currently use "tag" and "category" taxonomies + +[Params] + tagline = "Osprey Example Site" + author = "Toma Nistor" + description = "Full-stack web developer and UI/UX enthusiast based in San Diego, CA." + logoBig = "/images/osprey-logo.png" + logoSmall = "/images/osprey-logo.png" + favicon = "favicon.ico" + opengraphImage = "/images/osprey.png" + email = "" + googleTagManger = "" + customCSS = false + + # Social media links in footer + twitter = "TomaNistor" + linkedin = "tomanistor" + github = "tomanistor" + facebook = "" + + # Copyright and theme author credit in footer + copyright = true + credit = false + + # Cache busting of static resources (additional set up required) + cacheBustCSS = false + cacheBustJS = false + + # Code highlighting with highlight.js + highlightJS = true + highlightJSStyle = "" # For custom highlight.js styles, add your /path/to/styles/default.css + highlightJSScript = "" # For custom highlight.js languages config, add your /path/to/highlight.pack.js + + # Choose either Formspree contact form or Basin contact form + ajaxFormspree = false + ajaxFormspreeGold = false + ajaxBasin = "https://usebasin.com/f/0eae7044d4c2" + + # Lazy loading with lazysizes + lazyloading = true + +[[menu.main]] + name = "About" + url = "/#about" + weight = 1 +[[menu.main]] + name = "Work" + url = "/#work" + weight = 2 +[[menu.main]] + name = "Blog" + url = "/#blog" + weight = 3 +[[menu.main]] + name = "Contact" + url = "/#contact" + weight = 4 diff --git a/themes/distorsion/osprey/exampleSite/content/about.md b/themes/distorsion/osprey/exampleSite/content/about.md new file mode 100644 index 0000000..eff55ef --- /dev/null +++ b/themes/distorsion/osprey/exampleSite/content/about.md @@ -0,0 +1,15 @@ ++++ +title = "About" +date = "2017-06-27T17:39:21-07:00" +draft = false ++++ + +## Welcome to the Osprey Theme + +To create an about section, generate an about.md file in your content folder by doing: + +```console +$ hugo new about.md +``` + +Then add your own content to the markdown file. Everything in the file will be generated to show here on the home page. diff --git a/themes/distorsion/osprey/exampleSite/content/blog/creating-a-new-theme.md b/themes/distorsion/osprey/exampleSite/content/blog/creating-a-new-theme.md new file mode 100644 index 0000000..b6bfa69 --- /dev/null +++ b/themes/distorsion/osprey/exampleSite/content/blog/creating-a-new-theme.md @@ -0,0 +1,1147 @@ +--- +author: "Michael Henderson" +date: 2014-09-28 +linktitle: Creating a New Theme +next: /tutorials/github-pages-blog +prev: /tutorials/automated-deployments +title: Creating a New Theme +weight: 10 +--- + + +## Introduction + +This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I'll explain how Hugo uses templates and how you can organize your templates to create a theme. I won't cover using CSS to style your theme. + +We'll start with creating a new site with a very basic template. Then we'll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites. + +In this tutorial, commands that you enter will start with the "$" prompt. The output will follow. Lines that start with "#" are comments that I've added to explain a point. When I show updates to a file, the ":wq" on the last line means to save the file. + +Here's an example: + +``` +## this is a comment +$ echo this is a command +this is a command + +## edit the file +$vi foo.md ++++ +date = "2014-09-28" +title = "creating a new theme" ++++ + +bah and humbug +:wq + +## show it +$ cat foo.md ++++ +date = "2014-09-28" +title = "creating a new theme" ++++ + +bah and humbug +$ +``` + + +## Some Definitions + +There are a few concepts that you need to understand before creating a theme. + +### Skins + +Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors. + +You have two ways to create a skin. The simplest way is to create it in the ```layouts/``` directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the ```layouts/``` directory so it will always find the skin. + +Your second choice is to create it in a sub-directory of the ```themes/``` directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it? + +The difference between creating a skin in ```layouts/``` and creating it in ```themes/``` is very subtle. A skin in ```layouts/``` can’t be customized without updating the templates and static files that it is built from. A skin created in ```themes/```, on the other hand, can be and that makes it easier for other people to use it. + +The rest of this tutorial will call a skin created in the ```themes/``` directory a theme. + +Note that you can use this tutorial to create a skin in the ```layouts/``` directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme. + +### The Home Page + +The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html. + +### Site Configuration File + +When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it. + +Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your ```content/``` directory and template files in your ```themes/``` directory. It will create HTML files in your ```public/``` directory. You can change this by specifying alternate locations in the configuration file. + +### Content + +Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML. + +#### Front Matter + +The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “`+++`”, YAML by “`---`”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON. + +The information in the front matter is passed into the template before the content is rendered into HTML. + +#### Markdown + +Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file. + +### Template Files + +Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it's published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use. + +There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template. + +Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site. + +Please note that you can use the front matter to influence Hugo’s choice of templates. + +#### Single Template + +A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template. + +#### List Template + +A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups. + +The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site. + +#### Partial Template + +A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template. + +## Create a New Site + +Let's use Hugo to create a new web site. I'm a Mac user, so I'll create mine in my home directory, in the Sites folder. If you're using Linux, you might have to create the folder first. + +The "new site" command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file. + +``` +$ hugo new site ~/Sites/zafta +$ cd ~/Sites/zafta +$ ls -l +total 8 +drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 . +drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 .. +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes +-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static +$ +``` + +Take a look in the content/ directory to confirm that it is empty. + +The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That's a topic for a different tutorial, so please ignore them for now. + +### Generate the HTML For the New Site + +Running the `hugo` command with no options will read all the available content and generate the HTML files. It will also copy all static files (that's everything that's not content). Since we have an empty site, it won't do much, but it will do it very quickly. + +``` +$ hugo --verbose +INFO: 2014/09/29 Using config file: config.toml +INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/ +WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html] +WARN: 2014/09/29 Unable to locate layout: [404.html] +0 draft content +0 future content +0 pages created +0 tags created +0 categories created +in 2 ms +$ +``` + +The "`--verbose`" flag gives extra information that will be helpful when we build the template. Every line of the output that starts with "INFO:" or "WARN:" is present because we used that flag. The lines that start with "WARN:" are warning messages. We'll go over them later. + +We can verify that the command worked by looking at the directory again. + +``` +$ ls -l +total 8 +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes +-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts +drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static +$ +``` + +See that new public/ directory? Hugo placed all generated content there. When you're ready to publish your web site, that's the place to start. For now, though, let's just confirm that we have what we'd expect from a site with no content. + +``` +$ ls -l public +total 16 +-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml +-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml +$ +``` + +Hugo created two XML files, which is standard, but there are no HTML files. + + + +### Test the New Site + +Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the "server" command. If it is successful, you will see output similar to the following: + +``` +$ hugo server --verbose +INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml +INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/ +WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html] +WARN: 2014/09/29 Unable to locate layout: [404.html] +0 draft content +0 future content +0 pages created +0 tags created +0 categories created +in 2 ms +Serving pages from /Users/quoha/Sites/zafta/public +Web Server is available at http://localhost:1313 +Press Ctrl+C to stop +``` + +Connect to the listed URL (it's on the line that starts with "Web Server"). If everything is working correctly, you should get a page that shows the following: + +``` +index.xml +sitemap.xml +``` + +That's a listing of your public/ directory. Hugo didn't create a home page because our site has no content. When there's no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser. + +Let’s go back and look at those warnings again. + +``` +WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html] +WARN: 2014/09/29 Unable to locate layout: [404.html] +``` + +That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial. + +Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page. + +I like that the verbose flag causes Hugo to list the files that it's searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we'll cover later that explain the names and paths. For now, just remember that Hugo couldn't find a template for the home page and it told you so. + +At this point, you've got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it. + +## Create a New Theme + +Hugo doesn't ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes. + +We're going to create a new theme called "zafta." Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional. + +All themes have opinions on content and layout. For example, Zafta uses "post" over "blog". Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do. + + +### Create a Skeleton + +Use the hugo "new" command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out. + +``` +$ hugo new theme zafta + +$ ls -l +total 8 +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes +-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts +drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public +drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static +drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes + +$ find themes -type f | xargs ls -l +-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html +-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml +$ +``` + +The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype. + +Please take a minute to fill out the theme.toml and LICENSE.md files. They're optional, but if you're going to be distributing your theme, it tells the world who to praise (or blame). It's also nice to declare the license so that people will know how they can use the theme. + +``` +$ vi themes/zafta/theme.toml +author = "michael d henderson" +description = "a minimal working template" +license = "MIT" +name = "zafta" +source_repo = "" +tags = ["tags", "categories"] +:wq + +## also edit themes/zafta/LICENSE.md and change +## the bit that says "YOUR_NAME_HERE" +``` + +Note that the the skeleton's template files are empty. Don't worry, we'll be changing that shortly. + +``` +$ find themes/zafta -name '*.html' | xargs ls -l +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html +$ +``` + + + +### Update the Configuration File to Use the Theme + +Now that we've got a theme to work with, it's a good idea to add the theme name to the configuration file. This is optional, because you can always add "-t zafta" on all your commands. I like to put it the configuration file because I like shorter command lines. If you don't put it in the configuration file or specify it on the command line, you won't use the template that you're expecting to. + +Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format. + +``` +$ vi config.toml +theme = "zafta" +baseurl = "" +languageCode = "en-us" +title = "zafta - totally refreshing" +MetaDataFormat = "toml" +:wq + +$ +``` + +### Generate the Site + +Now that we have an empty theme, let's generate the site again. + +``` +$ hugo --verbose +INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml +INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/ +INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/ +WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html] +0 draft content +0 future content +0 pages created +0 tags created +0 categories created +in 2 ms +$ +``` + +Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme's directory. + +Let's check the public/ directory to see what Hugo's created. + +``` +$ ls -l public +total 16 +drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css +-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html +-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml +drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js +-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml +$ +``` + +Notice four things: + +1. Hugo created a home page. This is the file public/index.html. +2. Hugo created a css/ directory. +3. Hugo created a js/ directory. +4. Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn't create any pages. That's because it considers a "page" to be a file created directly from a content file. It doesn't count things like the index.html files that it creates automatically. + +#### The Home Page + +Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo's warning message shows that it looks for three different templates: + +``` +WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html] +``` + +If it can't find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed. + +When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page. + +``` +$ find . -name index.html | xargs ls -l +-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html +-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html +$ +``` + +#### The Magic of Static + +Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are. + +Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo's opinion is that you'll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don't like that, you can change the directory names in your theme directory or even delete them completely. Hugo's nice enough to offer its opinion, then behave nicely if you disagree. + +``` +$ find themes/zafta -type d | xargs ls -ld +drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta +drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes +drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts +drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default +drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials +drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static +drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css +drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js +$ +``` + +## The Theme Development Cycle + +When you're working on a theme, you will make changes in the theme's directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy: + +1. Purge the public/ directory. +2. Run the built in web server in watch mode. +3. Open your site in a browser. +4. Update the theme. +5. Glance at your browser window to see changes. +6. Return to step 4. + +I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes. + +Check the main Hugo site for information on using Git with Hugo. + +### Purge the public/ Directory + +When generating the site, Hugo will create new files and update existing ones in the ```public/``` directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it. + +Note: If you're building on an SSD, you should ignore this. Churning on a SSD can be costly. + +### Hugo's Watch Option + +Hugo's "`--watch`" option will monitor the content/ and your theme directories for changes and rebuild the site automatically. + +### Live Reload + +Hugo's built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, "Wow, that's totally amazing." + +### Development Commands + +Use the following commands as the basis for your workflow. + +``` +## purge old files. hugo will recreate the public directory. +## +$ rm -rf public +## +## run hugo in watch mode +## +$ hugo server --watch --verbose +``` + +Here's sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I've said this before, it's amazing. + + +``` +$ rm -rf public +$ hugo server --watch --verbose +INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml +INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/ +INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/ +WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html] +0 draft content +0 future content +0 pages created +0 tags created +0 categories created +in 2 ms +Watching for changes in /Users/quoha/Sites/zafta/content +Serving pages from /Users/quoha/Sites/zafta/public +Web Server is available at http://localhost:1313 +Press Ctrl+C to stop +INFO: 2014/09/29 File System Event: ["/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html": MODIFY|ATTRIB] +Change detected, rebuilding site + +WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html] +0 draft content +0 future content +0 pages created +0 tags created +0 categories created +in 1 ms +``` + +## Update the Home Page Template + +The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme's layout/ directory: + +1. index.html +2. _default/list.html +3. _default/single.html + +We could update one of the default templates, but a good design decision is to update the most specific template available. That's not a hard and fast rule (in fact, we'll break it a few times in this tutorial), but it is a good generalization. + +### Make a Static Home Page + +Right now, that page is empty because we don't have any content and we don't have any logic in the template. Let's change that by adding some text to the template. + +``` +$ vi themes/zafta/layouts/index.html + + +
+hugo says hello!
+ + +:wq + +$ +``` + +Build the web site and then verify the results. + +``` +$ hugo --verbose +INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml +INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/ +INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/ +WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html] +0 draft content +0 future content +0 pages created +0 tags created +0 categories created +in 2 ms + +$ find public -type f -name '*.html' | xargs ls -l +-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html + +$ cat public/index.html + + + +hugo says hello!
+ +``` + +#### Live Reload + +Note: If you're running the server with the `--watch` option, you'll see different content in the file: + +``` +$ cat public/index.html + + + +hugo says hello!
+ + +``` + +When you use `--watch`, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it. + +### Build a "Dynamic" Home Page + +"Dynamic home page?" Hugo's a static web site generator, so this seems an odd thing to say. I mean let's have the home page automatically reflect the content in the site every time Hugo builds it. We'll use iteration in the template to do that. + +#### Create New Posts + +Now that we have the home page generating static content, let's add some content to the site. We'll display these posts as a list on the home page and on their own page, too. + +Hugo has a command to generate a skeleton post, just like it does for sites and themes. + +``` +$ hugo --verbose new post/first.md +INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml +INFO: 2014/09/29 attempting to create post/first.md of post +INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md +ERROR: 2014/09/29 Unable to Castmy first post
+ + + + +$ cat public/post/second/index.html + + + +my second post
+ + + +$ +``` + +Notice that the posts now have content. You can go to localhost:1313/post/first to verify. + +### Linking to Content + +The posts are on the home page. Let's add a link from there to the post. Since this is the home page, we'll update its template. + +``` +$ vi themes/zafta/layouts/index.html + + + + {{ range first 10 .Data.Pages }} +