1
0
mirror of https://gitlab.com/MisterBiggs/blog.git synced 2025-06-15 22:56:50 +00:00

fixed directory stucture

This commit is contained in:
Anson 2019-08-08 22:44:23 -07:00
parent a50b0214bb
commit c924838038
118 changed files with 6968 additions and 2 deletions

View File

@ -6,7 +6,7 @@ variables:
pages:
script:
- cd exampleSite
- cd blog
- hugo --themesDir=../.. -d ../public
artifacts:
paths:

@ -1 +0,0 @@
Subproject commit f990880aee6e807b308094138c8686c8051af871

View File

@ -0,0 +1,3 @@
public
docs
.DS_Store

View File

@ -0,0 +1,28 @@
The MIT License (MIT)
Copyright (c) 2014 Steve Francia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Staticman's reCAPTCHA support
=================================================================================
The MIT License (MIT)
Original work Copyright (c) 2019 Praveen Lobo and Munif Tanjim

View File

@ -0,0 +1,102 @@
## Swift Theme
This theme is designed for blogging purposes. Feel free to extend it for other use cases though.
At its core, it's minimalistic; it doesn't rely on monolithic libraries such e.g jquery, bootstrap. Instead, it uses *grid css*, *flexbox* & *vanilla js* to facilitate the `features` outlined below:
![Hugo Swift Theme](https://github.com/onweru/hugo-swift-theme/blob/master/images/screenshot.png)
## Features
* Blog
* Pagination
* Responsive
* Deeplinks
* Dark Mode
* Syntax Highlighting
* [Staticman](https://staticman.net)
* [reCAPTCHA](https://developers.google.com/recaptcha/docs/display)
## Installation
Add this theme as a Git submodule inside your Hugo site folder:
```bash
$ git submodule add https://github.com/onweru/hugo-swift-theme.git themes/hugo-swift-theme
```
> Theme hugo sass and hugo-extended version.
## Configuration
You can configure the site using as follows:
1. **General Information** and **Staticman config**
Use the file `config.toml`.
2. **menu**, **footer**
See the **data** files inside the `data/` directory.
> Follow the `exampleSite/`.
## Staticman Comments
By default, [Staticman](https://staticman.net) comments are disabled. If you would like to enable them,
1. Invite Staticman to your repo to collaborate.
- GitHub: View the issue [eduardoboucas/staticman#243](https://github.com/eduardoboucas/staticman/issues/243) for procedures to set up Staticman v3.
- GitLab: Add the GitLab user associated with your Staticman API endpoint (e.g. **[@staticmanlab](https://gitlab.com/staticmanlab)**) as a "**developer**" for your project by going to **Settings → Members → Invite member**.
- Framagit: Since Framagit is a fork of GitLab, the overall setup is similar to that on GitLab. (Note that the Framagit bot is named as **[@staticmanlab1](https://framagit.org/staticmanlab1)**.)
2. Uncomment the `[Params.staticman]` section and input the parameters inside `config.toml` like so
```toml
[Params.staticman]
endpoint = "https://api.staticman.net"
gitProvider = "github"
username = "your-username"
repository = "hugo-swift-theme"
branch = "master"
```
In case of empty `endpoint`, it will fallback to the official production instance.
| instance | `endpoint` |
| --- | --- |
| official production | `https://api.staticman.net` |
| GitLab | `https://staticman3.herokuapp.com` |
| Framagit | `https://staticman-frama.herokuapp.com` |
Remark: You may adjust the `endpoint` to the one that your Staticman bot/GitHub App is associated with.
For `gitProvider`, you can choose either `github` or `gitlab`. If you're using Framagit, choose `gitlab`.
3. Proceed to setup `staticman.yml`. Note that this YML file has to be **at the root of your Git repository**. See the `exampleSite/` and the [Staticman docs](https://staticman.net/docs/) for detailed information of each parameter used in this YML file.
The parameter `moderation` is for comment moderation, and it defaults to `false`. If it is switched to `true`, then Staticman will create a pull/merge request instead of directly committing against the `branch`.
If you are working on GitLab and you have set `moderation: false`, depending on your `branch`, you might need the following steps.
- protected branch (e.g. `master`):
Go to **Settings → Repository → Protected Branches** and permit the GitLab bot to push against that branch.
- unprotected branch (GitHub's default): no measures needed
Optional: It is suggested to enable [reCAPTCHA](https://developers.google.com/recaptcha/docs/display) to avoid massive spam comments. You may refer to `_config.yml` for detailed instructions.
Optional: You may want to configure a webhook to prevent old inactive branches (representing approved comments) from stacking up. You can refer to [Staticman's documentation](https://staticman.net/docs/webhooks) for details. Make sure to input the **Payload URL** according to your chosen `endpoint`. For example, the default `endpoint` is `https://staticman3.herokuapp.com`, so the corresponding **Payload URL** should be `https://staticman3.herokuapp.com/v1/webhook`.
:information_source: This [Binary Mist article](https://binarymist.io/blog/2018/02/24/hugo-with-staticman-commenting-and-subscriptions/) could also be quite helpful :)
:information_source: By default, this theme uses the official production instance at v3 instead of v2 due to a requests' quota issue reported in issue [eduardoboucas/staticman#222](https://github.com/eduardoboucas/staticman/issues/222).
:warning: Since Staticman is an evolving project, things might work differently than they do at the moment of this writing.
### Deeplinks
For all content published using markdown, deeplinks will be added to the pages so that you can share with precision :smiley: Just hover on a heading and the link button will pop. Click it to copy.
### Dark Mode
Today most operating systems & browsers support dark mode. Like twitter, which automatically turns into dark mode when the user chooses darkmode, this theme does the same thing.
![Dark Mode](https://github.com/onweru/hugo-swift-theme/blob/master/images/darkmode.jpg)
## License
The code is available under the [MIT license](https://github.com/onweru/hugo-swift-theme/blob/master/LICENSE.md).

View File

@ -0,0 +1,339 @@
function createEl(element) {
return document.createElement(element);
}
function elem(selector, parent = document){
let elem = document.querySelector(selector);
return elem != false ? elem : false;
}
function elems(selector) {
let elems = document.querySelectorAll(selector);
return elems.length ? elems : false;
}
function pushClass(el, targetClass) {
// equivalent to addClass
if (el && typeof el == 'object' && targetClass) {
elClass = el.classList;
elClass.contains(targetClass) ? false : elClass.add(targetClass);
}
}
function deleteClass(el, targetClass) {
// equivalent to removeClass
if (el && typeof el == 'object' && targetClass) {
elClass = el.classList;
elClass.contains(targetClass) ? elClass.remove(targetClass) : false;
}
}
function modifyClass(el, targetClass) {
if (el && typeof el == 'object' && targetClass) {
elClass = el.classList;
elClass.contains(targetClass) ? elClass.remove(targetClass) : elClass.add(targetClass);
}
}
function containsClass(el, targetClass) {
if (el && typeof el == 'object' && targetClass) {
return el.classList.contains(targetClass) ? true : false;
}
}
function isChild(node, parentClass) {
let objectsAreValid = node && typeof node == 'object' && parentClass && typeof parentClass == 'string';
return (objectsAreValid && node.closest(parentClass)) ? true : false;
}
(function updateDate() {
var date = new Date();
var year = date.getFullYear();
elem('.year').innerHTML = year;
})();
(function() {
let bar = 'nav_bar-wrap';
let navBar = elem(`.${bar}`);
let nav = elem('.nav-body');
let open = 'nav-open';
let exit = 'nav-exit';
let drop = 'nav-drop';
let pop = 'nav-pop';
let navDrop = elem(`.${drop}`);
let hidden = 'hidden';
function toggleMenu(){
modifyClass(navDrop, pop);
modifyClass(navBar, hidden);
let menuOpen = containsClass(nav, open);
let menuPulled = containsClass(nav, exit);
let status = menuOpen || menuPulled ? true : false;
status ? modifyClass(nav, exit) : modifyClass(nav, open);
status ? modifyClass(nav, open) : modifyClass(nav, exit);
}
// $('.nav-bar, .nav-close').on('click', () => toggleMenu());
navBar.addEventListener('click', function() {
toggleMenu();
});
elem('.nav-close').addEventListener('click', function() {
toggleMenu();
});
elem('.nav-drop').addEventListener('click', function(e) {
e.target === this ? toggleMenu() : false;
});
})();
(function share(){
let share = elem('.share');
let open = 'share-open';
let close = 'share-close';
let button = elem('.share-trigger');
function showShare() {
pushClass(share, open);
deleteClass(share, close);
}
function hideShare() {
pushClass(share, open);
deleteClass(share, close);
}
if (button) {
button.addEventListener('click', function() {
showShare();
setTimeout(hideShare, 5000);
});
}
})();
(function comments(){
let comments = elem('.js-comments');
let form = elem('.form');
let body = elem('body');
let button = elem('.form_toggle');
let loading = 'form-loading';
let open = 'form-open';
let show = 'modal_show'
let toggled = 'toggled';
let successOutput = [
'Review submitted',
'Thanks for your review! It will show on the site once it has been approved.'
];
let errorOutput = [
'Error',
'Sorry, there was an error with the submission!'
];
function handleForm(form) {
form.addEventListener('submit', function (event) {
pushClass(form, loading);
function resetForm() {
deleteClass(form, loading);
// $("form").trigger("reset");
}
function formActions(message) {
showModal(...message) // array destructuring
resetForm();
}
event.preventDefault();
function formToJSON(obj) {
let rawData = Array.from(obj.elements);
let data = {};
rawData.forEach(function(element){
data[element.name] = element.value;
});
return JSON.stringify(data);
}
let data = formToJSON(form);
let url = form.getAttribute('action').trim();
fetch(url, {
method: "POST",
body: data,
headers: {
"Content-Type": "application/json"
}
}).then(function(res) {
if(res.ok) {
formActions(successOutput);
} else {
formActions(errorOutput);
}
}).catch(function(error) {
formActions(errorOutput);
console.error('Error:', error);
});
});
}
form ? handleForm(form) : false;
function closeModal() {
elem('.modal_close').addEventListener('click', function () {
deleteClass(body, show);
deleteClass(form, loading);
deleteClass(form, open);
deleteClass(button, toggled);
});
}
containsClass(body, show) ? closeModal() : false;
function showModal(title, message) {
elem('.modal_title').textContent = title;
elem('.modal_text').innerHTML = message;
pushClass(body, show);
}
(function toggleForm() {
if(button) {
button.addEventListener('click', function() {
modifyClass(form, open);
modifyClass(this, toggled);
this.textContent = containsClass(this, toggled) ? 'cancel' : 'comment';
});
}
})();
})();
function elemAttribute(elem, attr, value = null) {
if (value) {
elem.setAttribute(attr, value);
} else {
value = elem.getAttribute(attr);
return value ? value : false;
}
}
(function(){
let links = document.querySelectorAll('a');
if(links) {
Array.from(links).forEach(function(link){
let target, rel, blank, noopener, attr1, attr2, url, isExternal;
url = elemAttribute(link, 'href');
isExternal = (url && typeof url == 'string' && url.startsWith('http')) && !containsClass(link, 'nav_item') && !isChild(link, '.post_item') && !isChild(link, '.pager') ? true : false;
if(isExternal) {
target = 'target';
rel = 'rel';
blank = '_blank';
noopener = 'noopener';
attr1 = elemAttribute(link, target);
attr2 = elemAttribute(link, noopener);
attr1 ? false : elemAttribute(link, target, blank);
attr2 ? false : elemAttribute(link, noopener, noopener);
}
});
}
})();
let headingNodes = [], results, link, icon, current, id,
tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
current = document.URL;
tags.forEach(function(tag){
results = document.getElementsByTagName(tag);
Array.prototype.push.apply(headingNodes, results);
});
headingNodes.forEach(function(node){
link = createEl('a');
icon = createEl('img');
icon.src = '{{ "images/icons/link.svg" | absURL }}';
link.className = 'link';
link.appendChild(icon);
id = node.getAttribute('id');
if(id) {
link.href = `${current}#${id}`;
node.appendChild(link);
pushClass(node, 'link_owner');
}
});
const copyToClipboard = str => {
// Create a <textarea> element
const el = createEl('textarea');
// Set its value to the string that you want copied
el.value = str;
// Make it readonly to be tamper-proof
el.setAttribute('readonly', '');
// Move outside the screen to make it invisible
el.style.position = 'absolute';
el.style.left = '-9999px';
// Append the <textarea> element to the HTML document
document.body.appendChild(el);
// Check if there is any content selected previously
const selected =
document.getSelection().rangeCount > 0
? document.getSelection().getRangeAt(0) // Store selection if found
: false; // Mark as false to know no selection existed before
el.select(); // Select the <textarea> content
document.execCommand('copy'); // Copy - only works as a result of a user action (e.g. click events)
document.body.removeChild(el); // Remove the <textarea> element
if (selected) { // If a selection existed before copying
document.getSelection().removeAllRanges(); // Unselect everything on the HTML document
document.getSelection().addRange(selected); // Restore the original selection
}
}
(function copyHeadingLink() {
let deeplinks = document.querySelectorAll;
let deeplink = 'link';
if(deeplinks) {
document.body.addEventListener('click', function(event)
{
let target = event.target;
if (target.classList.contains(deeplink) || target.parentNode.classList.contains(deeplink)) {
event.preventDefault();
let newLink = target.href != undefined ? target.href : target.parentNode.href;
copyToClipboard(newLink);
}
});
}
})();
(function copyLinkToShare() {
let copy, copied, excerpt, isCopyIcon, isInExcerpt, link, page, postCopy, postLink, target;
copy = 'copy';
copied = 'copy_done';
excerpt = 'excerpt';
postCopy = 'post_copy';
postLink = 'post_card';
page = document.documentElement;
page.addEventListener('click', function(event) {
target = event.target;
isCopyIcon = containsClass(target, copy);
isInExcerpt = containsClass(target, postCopy);
if (isCopyIcon) {
if (isInExcerpt) {
link = target.closest(`.${excerpt}`).previousElementSibling;
link = containsClass(link, postLink)? elemAttribute(link, 'href') : false;
} else {
link = window.location.href;
}
if(link) {
copyToClipboard(link);
pushClass(target, copied);
}
}
});
})();

View File

@ -0,0 +1,41 @@
@keyframes showMenu{
0% {
top: 100%;
opacity: 0;
}
100% {
top:0;
opacity: 1;
}
}
@keyframes hideMenu {
0% {
top: 0;
opacity: 1;
}
100% {
top: 100%;
opacity: 0;
}
}
@keyframes showShare{
0% {
height: 0;
opacity: 0;
}
100% {
height:initial;
opacity: 1;
}
}
@keyframes hideShare{
0% {
height: initial;
opacity: 1;
}
100% {
height: 0;
opacity: 0;
}
}

View File

@ -0,0 +1,9 @@
.waves {
max-width: 320px;
height: 5px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 30px auto;
}

View File

@ -0,0 +1,116 @@
*{
box-sizing: border-box;
-webkit-appearance: none;
margin: 0;
padding: 0;
}
body, html {
scroll-behavior: smooth;
}
body{
font-family: var(--font);
background-color: var(--bg);
color: var(--text);
font-size: 16px;
line-height: 1.5;
max-width:1440px;
margin:0 auto;
position:relative;
font-kerning: normal;
display: flex;
flex-direction: column;
justify-content: space-between;
min-height: 100vh;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a{
text-decoration: none;
color:inherit;
}
blockquote {
opacity: 0.8;
padding: 1rem;
position: relative;
quotes:'\201C''\201D''\2018''\2019';
margin: 0.75rem 0;
display: flex;
flex-flow: row wrap;
background-repeat: no-repeat;
background-size: 5rem;
background-position: 50% 50%;
position: relative;
&::before {
content: "";
padding: 1px;
position: absolute;
top: 0;
bottom: 0;
left: 0;
background: $theme;
}
p{
padding-left: 0.5rem 0 !important;
font-size: 1.1rem !important;
width: 100%;
font-weight: 300;
font-style: italic;
}
}
code {
white-space: pre-wrap;
word-wrap: break-word;
word-break: break-all;
}
h1,h2,h3,h4,h5{
font-family: inherit;
text-transform: capitalize;
text-align: center;
font-weight: 500;
padding:5px 0;
margin:15px 0;
color: inherit;
}
h1{
font-size:200%;
font-weight: 400;
}
h2{
font-size:175%;
}
h3{
font-size:150%;
}
h4{
font-size:125%;
}
h5{
font-size:120%;
}
img {
max-width: 100%;
vertical-align: middle;
height:auto;
margin:15px auto;
padding:0;
}
main{
padding-bottom: 45px;
flex: 1;
}
ul{
list-style: none;
-webkit-padding-start:0;
-moz-padding-start:0;
}
b, strong, em {
font-weight: 500;
}
hr {
border: none;
padding: 0.5px;
background: var(--text);
opacity: 0.5;
margin: 1rem 0;
}

View File

@ -0,0 +1,163 @@
.form{
display: flex;
flex-direction: column;
width: 100%;
background: transparent;
&-comments{
height:0;
opacity: 0;
margin: 0 0 1rem;
transform: translateY(250px);
transition: opacity 0.3s ease-in , transform 0.3s ease-in;
border-radius: 0.67rem;
}
&-open{
height: initial;
transform: translateY(0);
opacity: 1;
}
&_input{
margin:$padding 0;
font-size: 1rem !important;
padding: $padding $padding*1.5 !important;
-webkit-appearance: none;
border-radius:25px;
outline: none;
transition: all 0.3s ease-out;
width: 100%;
max-width: 480px;
box-shadow: 0 5px 15px 0 rgba(158, 174, 221, 0.2);
border: 1px solid #eee;
&:focus,
&:hover{
border:1px solid $theme;
}
&-message{
resize: none;
border-radius: 15px;
min-height: 2.5rem !important;
}
&-submit{
background-color: $theme;
color:$light;
font-size:1.25rem;
cursor: pointer;
&,
&:hover{
border:none;
}
&:hover{
background-color: lighten($theme, 5%);
}
}
}
&_label{
display:none;
}
&_toggle{
@include shadow(.02);
background-color: $theme;
margin: 1rem 0;
color:$light;
display: inline-block;
width: 8rem;
padding:0.33rem 1.5rem;
text-align: center;
cursor: pointer;
text-transform: capitalize;
}
}
.comment{
&s {
position: relative;
}
}
.modal {
display: none;
position: fixed;
bottom: 0;
top: 0;
left: 0;
right: 0;
z-index: 9999;
&_close{
margin: 25px 0;
background-color: $theme;
color:$light;
border: 0;
outline: 0;
box-shadow:0 5px 15px -2px rgba(158,174,221,0.2);
cursor: pointer;
padding:$padding/2 $padding*1.5;
}
&_inner{
width:100%;
background-color: $dark;
max-width:540px;
padding: $padding * 2.5;
box-shadow: 0 25px 40px -10px rgba(158,174,221,0.2);
color: darken($light, 10%);
}
&_show {
overflow: hidden;
position: relative;
&:before {
position: absolute;
content: '';
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
background-color: rgba($light, 0.85);
}
}
&_show &{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
&_title{
color: $light;
}
}
.form-loading:before {
content: '';
}
.form-loading .form_spinner {
display: block;
}
.form:before {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.7);
z-index: 10;
}
.g-recaptcha {
display: grid;
width: 100%;
background: transparent;
border: none;
border-radius: 0.25rem;
margin: 1.25rem 0 1.5rem;
// box-shadow: 0 1rem 4rem rgba($dark, 0.12);
> div,
iframe {
display: grid;
width: 100% !important;
height: 74px !important;
}
iframe {
transform: scale(1.03);
padding: 0 0.75rem;
}
}

View File

@ -0,0 +1,186 @@
.intro{
margin: 4rem 0 1rem;
background: $dark;
padding: 2rem 1.5rem;
color: $light;
&_inner{
@include viewport(59rem);
margin: 0 auto;
text-align: center;
padding: 25px;
position: relative;
background-color: var(--bubble);
border-radius: 1rem;
}
&_headline{
margin: 0 auto;
font-weight: 300;
}
&_desc {
opacity: 0.8;
text-align: center;
}
}
.btn{
min-width: 150px;
font-size: 1rem;
margin: 1rem 0 1.5rem;
display: inline-block;
padding: 7.5px 12.5px;
background-color: $theme;
box-shadow: 0 1rem 4rem rgba($dark,0.5);
color: $light;
text-align: center;
cursor: pointer;
border-radius: 0.25rem;
}
.gravatar{
background: $light;
width:90px;
border-radius:50%;
display:inline-block;
position: absolute;
bottom:-30px;
margin:0 10px 0 0;
@include shadow;
z-index: 2;
}
aside h3{
position:relative;
margin:0 !important;
}
.nav-secondary,
.user-menu{
display: none !important;
}
span.right {
color: $theme;
}
section p{
text-align:left;
padding:10px 0;
}
.transparent{
padding:25px;
}
.point{
margin-right:15px;
color:$theme;
}
.wrap{
padding:30px 40px 50px 40px;
}
.hold{
position:relative;
overflow:visible;
}
.site{
&__icon{
width:40px;
margin: 0 10px 0 0;
}
}
@media screen and (min-width: 769px){
.nav-menu a{
display:inline-block;
height:initial;
text-align:left;
}
.mobile{
display:none;
}
}
.video{
overflow:hidden;
padding-bottom:56.25%;
position:relative;
height:0;
margin: 1.5rem 0;
border-radius: 1rem;
background-color: var(--bg);
box-shadow: 0 1rem 4rem rgba($dark,0.17);
iframe{
left:0;
top:0;
height:100%;
width:100%;
position:absolute;
transform: scale(1.03);
}
}
.copy {
position: relative;
width: 1.5rem;
height: 1.5rem;
background-image: url(#{$copy-icon-path});
background-size: 100%;
cursor: pointer;
&::before, &::after {
content: "";
position: absolute;
background: $theme;
color: $light;
opacity: 0;
transition: opacity 0.25s ease-in;
}
&::before {
content: "Share Story";
font-size: 0.8rem;
width: 5.4rem;
padding: 0.25rem;
border-radius: 0.25rem;
text-align: center;
top: -2rem;
right: 0;
}
&_done::before {
content: "Link Copied";
}
&:hover::before,
&:hover::after {
opacity: 1;
}
}
.author,
.comment {
display: grid;
grid-template-columns: 4rem 1fr;
grid-gap: 0 1rem ;
padding: 1rem;
margin: 1.5rem 0;
background-color: var(--accent);
border-radius: 0.5rem;
box-shadow: 0 0.5rem 2rem rgba($dark, 0.12);
&_name {
color: var(--text) !important;
font-size: 1.25rem;
text-transform: capitalize;
}
&_pic {
border-radius: 50%;
padding: 0.25rem;
margin: 0 0 0 -0.25rem;
border-color: $theme transparent;
border-style: solid;
border-width: 1px;
}
&_bio {
padding-bottom: 0 !important;
line-height: 1.33;
}
&_heading {
font-size: 0.7rem;
}
&_meta {
display: flex;
flex-flow: column;
justify-content: center;
}
}

View File

@ -0,0 +1,53 @@
@font-face {
font-family: 'Metropolis';
font-style: normal;
font-weight: 400;
src: local('Metropolis Regular'), local('Metropolis-Regular'),
url('#{$font-path}/Metropolis-Regular.woff2') format('woff2'), // Super Modern Browsers
url('#{$font-path}/Metropolis-Regular.woff') format('woff'), // Modern Browsers
}
@font-face {
font-family: 'Metropolis';
font-style: normal;
font-weight: 300;
src: local('Metropolis Light'), local('Metropolis-Light'),
url('#{$font-path}/Metropolis-Light.woff2') format('woff2'), // Super Modern Browsers
url('#{$font-path}/Metropolis-Light.woff') format('woff'), // Modern Browsers
}
@font-face {
font-family: 'Metropolis';
font-style: italic;
font-weight: 300;
src: local('Metropolis Light Italic'), local('Metropolis-LightItalic'),
url('#{$font-path}/Metropolis-LightItalic.woff2') format('woff2'), // Super Modern Browsers
url('#{$font-path}/Metropolis-LightItalic.woff') format('woff'), // Modern Browsers
}
@font-face {
font-family: 'Metropolis';
font-style: normal;
font-weight: 500;
src: local('Metropolis Medium'), local('Metropolis-Medium'),
url('#{$font-path}/Metropolis-Medium.woff2') format('woff2'), // Super Modern Browsers
url('#{$font-path}/Metropolis-Medium.woff') format('woff'), // Modern Browsers
}
@font-face {
font-family: 'Metropolis';
font-style: italic;
font-weight: 500;
src: local('Metropolis Medium Italic'), local('Metropolis-MediumItalic'),
url('#{$font-path}/Metropolis-MediumItalic.woff2') format('woff2'), // Super Modern Browsers
url('#{$font-path}/Metropolis-MediumItalic.woff') format('woff'), // Modern Browsers
}
@font-face {
font-family: 'Cookie';
font-style: normal;
font-weight: 400;
src: local('Cookie-Regular'),
url('#{$font-path}/cookie-v10-latin-regular.woff2') format('woff2'), // Super Modern Browsers
url('#{$font-path}/cookie-v10-latin-regular.woff') format('woff'), // Modern Browsers
}

View File

@ -0,0 +1,26 @@
.footer{
padding:0;
color:$light;
margin:0;
background: $dark;
width:100%;
font-size: 1.05rem;
min-height:75px;
a {
color: $theme;
opacity: 0.8;
transition: opacity 0.3s ease-in-out;
&:hover {
text-decoration: underline;
opacity: 1;
}
}
&_inner{
display: flex;
justify-content: space-between;
padding: 1.5rem;
@media screen and (max-width: 567px) {
flex-direction: column;
}
}
}

View File

@ -0,0 +1,11 @@
@mixin viewport($width: 1024px, $margin: 25px) {
max-width: $width;
margin: $margin auto;
@content;
}
@mixin shadow($opacity: 0.17) {
box-shadow: 0 0 3rem rgba(0,0,0,$opacity);
&:hover {
box-shadow: 0 0 5rem rgba(0,0,0, (1.5 * $opacity));
}
}

View File

@ -0,0 +1,139 @@
.nav{
position:absolute;
top:0;
width:100%;
transition:height 0.4s ease-in-out;
z-index:999;
&_bar {
width: 100%;
position: relative;
&-wrap {
width: 1.8rem;
height: 1.8rem;
display: grid;
align-items: center;
cursor: pointer;
z-index: 99;
min-height: 1.5rem;
}
&,
&::after,
&::before {
padding: 1px;
border-radius: 2px;
background-color: var(--text);
}
&::after,
&::before {
content: "";
position: absolute;
width: 1.2rem;
}
&::before {
top: -0.5rem;
}
&::after {
top: 0.5rem;
right: 0;
}
}
&-body{
@include shadow;
position:fixed;
right:10px;
z-index:1;
top:100%;
opacity:0;
overflow:hidden;
transition:top 0.33s linear;
background:transparent;
background-color: var(--accent);
width:33.3%;
width: 16rem;
padding: 100px 0;
min-height: 67vh;
margin-top: 0.5rem;
z-index:1;
border-radius: 0.33rem;
a{
display:block;
padding:12.5px 25px;
margin-bottom:2px;
border-bottom:1px solid rgba($dark, 0.04);
transition:color 0.25s ease-in-out;
&:hover{
color: $theme;
}
}
}
&-brand{
font-family: 'Cookie';
font-size:2em !important;
// max-width:250px;
padding-top:0 !important;
padding-bottom:0 !important;
}
&-close {
display: flex;
justify-content: flex-start;
align-items: center;
position: absolute;
top: 0;
right:0;
width: 100%;
cursor:pointer;
padding:25px;
&:after,
&:before{
content: '';
width: 18px;
border-radius:50%;
padding: 1.5px;
background: var(--text);
opacity: 0.7;
position: relative;
}
&:before {
transform: rotate(20deg) translateX(1.5px);
}
&:after {
transform: rotate(-20deg) translateX(-1.5px);
}
}
&-drop {
background: rgba(0,0,0,0.15);
top:0;
bottom:0;
z-index:1000;
}
&-exit{
animation: hideMenu 0.5s ease-out forwards;
}
&-menu {
position: relative;
padding:10px 25px 10px 0;
height:100%;
max-width: 1024px;
margin:0 auto;
display: flex;
align-items: center;
justify-content: space-between;
a {
color:inherit;
width:100%;
display:block;
padding:10px 25px;
font-size:105%;
}
}
&-pop{
position: fixed;
width:100vw;
}
&-open {
animation: showMenu 0.5s ease-out forwards;
}
&_item {
text-transform: capitalize;
}
}

View File

@ -0,0 +1,288 @@
.post{
margin:0 auto;
padding: 1rem 1.5rem;
width:100%;
max-width:750px;
margin-top: 1.5rem;
h1,h2,h3{
margin:15px auto;
text-align:left;
padding:5px 0 0 0;
}
p{
padding-bottom: 0.5rem;
padding-top: 0.5rem;
font-size: 1.05rem;
}
&s{
display:flex;
justify-content: space-between;
flex-flow:row wrap;
width: 100%;
align-items: stretch;
}
&s:not(.aside) {
padding: 0 30px;
}
&_content{
h4{
margin:5px 0;
text-align:left;
}
p{
line-height:1.65;
&:first-child{
margin-top:0;
padding-top:0;
}
}
a{
color: $theme;
padding-bottom:7.5px;
&:hover {
text-decoration: underline;
}
}
ol, ul {
padding: 0.5rem 0 0.5rem 1.2rem;
}
li {
padding: 0.33rem 0;
}
}
&_header{
background-size:cover;
background-repeat:no-repeat;
background-position: center;
position:relative;
color:#fff;
height:48vh;
min-height: 360px;
background-color:$dark;
margin-top:60px;
padding: 30px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
&::after {
content: "";
position: absolute;
top:0;
left: 0;
right: 0;
bottom:0;
z-index: 1;
background: rgba(10, 15, 30, 0.72)
}
h1 {
color: inherit;
}
h1, p, h4 {
position: relative;
z-index: 2;
}
}
&_copy {
opacity: 0;
transition: opacity 0.3s ease-out;
}
&_item{
@include shadow;
margin: 1.25rem 0;
border-radius: 10px;
overflow: hidden;
width: 100%;
@media screen and (min-width:667px) {
width: 47%;
}
}
&_item:hover &_copy{
opacity: 1;
}
&_link{
padding:2.5px 0;
font-size:1.25em;
margin:2.5px 0;
text-align:left;
}
&_meta {
overflow: hidden;
opacity: 0.8;
font-size: 0.84rem;
font-weight: 500;
display: inline-grid;
grid-template-columns: auto 1fr;
background-color: $light;
padding: 0;
align-items: center;
border-radius: 0.3rem;
color: $dark;
text-transform: capitalize;
a {
&:hover {
color: $theme;
text-decoration: underline;
opacity: 0.9;
}
}
}
&_extra {
display: flex;
justify-content: flex-end;
}
&_tag {
font-size: 0.75rem !important;
font-weight: 500;
background: $theme;
color: $light;
padding: 0.25rem 0.67rem !important;
text-transform: uppercase;
display: inline-flex;
border-radius: 5px;
}
&_title{
margin:5px 0;;
}
&_author {
padding: 0.2rem 0.75rem;
a {
color: $theme;
text-decoration: underline;
}
}
&_time {
background: $theme;
display: inline-grid;
padding: 0.2rem 0.75rem;
color: $light;
}
&_card {
display: block;
position:relative;
background-color:$dark;
border-radius: 0.5rem 0.5rem 0 0;
background-size:cover;
background-position:center;
overflow: hidden;
height:10rem;
&::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
z-index: 1;
}
&:hover::after {
background-color:rgba($dark,0.3);
}
}
&_thumbnail {
width: 100%;
margin: 0;
}
}
.pager {
display: flex;
justify-content: center;
align-content: center;
margin: 30px auto 0 auto;
&, &_item {
justify-content: center;
align-items: center;
}
&_item {
height: 36px;
width: 36px;
display: inline-flex;
margin-left: 5px;
margin-right: 5px;
background: $theme;
color: $light;
border-radius: 50%;
margin-bottom: 30px;
&:hover {
opacity: 0.5;
}
}
&_prev, &_next {
background: transparent;
background-size: 100%;
background-position: center;
}
&_prev {
background-image: url(#{$prev-icon-path});
}
&_next {
background-image: url(#{$next-icon-path});
}
&_active{
opacity: 0.5;
}
}
.excerpt{
padding: 0 10px 1.5rem 10px;
position: relative;
z-index: 1;
&_meta {
display: flex;
justify-content: space-between;
align-items: center;
transform: translateY(-2.5rem);
position: relative;
z-index: 5;
}
}
.share{
@include shadow;
background: $light;
border-radius: 5px;
align-items:center;
justify-content:right;
position: fixed;
top: 64px;
height: 0;
opacity: 0;
overflow: hidden;
a{
margin:12.5px 0;
opacity:1;
transition:opacity 0.3s ease-in-out;
&:hover{
opacity:0.84;
}
}
img{
width:1.25rem;
margin-right: 5px;
}
&,&_card{
display: flex;
flex-flow: column;
}
&_card{
width:100%;
padding:25px;
}
&-close{
animation: hideShare 0.3s ease-out;
}
&-open{
animation: showShare 0.3s ease-out;
width: 210px;
padding: 25px 15px;
height: auto;
opacity: 1;
text-align: left;
}
&-trigger{
width: 24px;
cursor: pointer;
}
}

View File

@ -0,0 +1,17 @@
.highlight {
margin: 1.25rem 0;
& & {
margin: 0;
}
pre{
padding: 1rem;
margin: 1.5rem 0;
background: var(--bubble) !important;
box-shadow: 0 0 2.5rem rgba(0,0,0,0.12);
// word-break: break-all;
// word-wrap: break-word;
border-radius: 4px;
overflow-x: auto;
}
}

View File

@ -0,0 +1,35 @@
.pale {
opacity: 0.7;
}
.hidden{
display: none;
}
.center{
text-align:center;
margin:5px auto;
}
.left{
text-align:left;
}
.wrap{
padding:10px 0;
max-width: 1024px;
margin: 0 auto;
}
.mt {
margin-top: 7rem;
}
.link {
display: inline-block;
width: 2.5rem;
margin: 0 0.25rem;
padding: 0 0.25rem;
opacity: 0;
transition: opacity 0.3s cubic-bezier(0.39, 0.575, 0.565, 1);
&_owner:hover & {
opacity: 0.9;
}
}
.solo {
grid-column: 1/-1;
}

View File

@ -0,0 +1,24 @@
$padding: 10px;
$margin: 25px;
$theme: #04a763;
$light: #fff;
$dark: #131313;
$text: #343434;
$linear: linear-gradient(to right bottom, darken($theme, 10%), $theme);
:root {
--light: #fff;
--dark: #131313;
--gray: #f5f5f5;
--bubble: #181818;
--accent: var(--gray);
--bg: var(--light);
--text: var(--dark);
--font: 'Metropolis', sans-serif;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: var(--dark);
--text: var(--light);
--accent: var(--bubble);
}
}

View File

@ -0,0 +1,19 @@
$font-path: '{{ "fonts" | absURL }}';
$copy-icon-path: '{{ "images/icons/copy.svg" | absURL }}';
$prev-icon-path: '{{ "images/icons/previous.svg" | absURL }}';
$next-icon-path: '{{ "images/icons/next.svg" | absURL }}';
@import
'fonts',
'variables',
'mixins',
'animate',
'base',
'components',
'utils',
'nav',
'posts',
'audio',
'footer',
'comments',
'syntax';

View File

@ -0,0 +1,14 @@
image: monachus/hugo
variables:
GIT_SUBMODULE_STRATEGY: recursive
pages:
script:
- cd exampleSite
- hugo --themesDir=../.. -d ../public
artifacts:
paths:
- public
only:
- master

View File

@ -0,0 +1,29 @@
baseurl = "https://example.com/" # Include trailing slash
title = "Hugo Themes"
theme = "hugo-swift-theme"
author = "Steve Francia"
copyright = "Copyright © 20082018, Steve Francia and the Hugo Authors; all rights reserved."
canonifyurls = true
paginate = 4
# Enable syntax highlighting
# comment on delete the following lines 11 ~ 13
pygmentsCodefences = true
pygmentsCodefencesGuessSyntax = true
[params]
# ga_analytics = "" # google analytics ID e.g UA-116386578-1
# ga_verify = "" # google verification code e.g 5jb-rxeBfITeJQKOuUss3ud6FPGTxXkCho-ZN5qlrZg
# twitter = "" # twitter handle e.g @weru
# [params.staticman]
# endpoint = "https://api.staticman.net" # URL of your own API deployment (without trailing slash), default: "https://api.staticman.net"
# gitProvider = "github" # Either "github" or "gitlab"
# username = "username" # GitHub/GitLab user name
# repository = "repo" # GitHub/GitLab user name
# branch = "master" # Branch holding the source code for your site, should match the `branch` parameter in `staticman.yml`
#
# # If you use reCAPTCHA v2, you must also set these parameters in staticman.yml
# [Params.staticman.reCaptcha]
# siteKey = "" # Use your own site key, you need to apply for one on Google
# secret = "" # ENCRYPT your password by going to https://<staticman-endpoint>/v3/encrypt/<your-site-secret>

View File

@ -0,0 +1,18 @@
+++
title = "About Hugo"
date = "2014-04-09"
image = 'read.jpg'
+++
Hugo is the **worlds fastest framework for building websites**. It is written in Go.
It makes use of a variety of open source projects including:
* https://github.com/russross/blackfriday
* https://github.com/alecthomas/chroma
* https://github.com/muesli/smartcrop
* https://github.com/spf13/cobra
* https://github.com/spf13/viper
Learn more and contribute on [GitHub](https://github.com/gohugoio).

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,344 @@
+++
title = "(Hu)go Template Primer"
description = ""
tags = [
"go",
"golang",
"templates",
"themes",
"development",
]
date = "2014-04-02"
categories = [
"Development",
"golang",
]
image = "fast-lane.jpg"
+++
Hugo uses the excellent [Go][] [html/template][gohtmltemplate] library for
its template engine. It is an extremely lightweight engine that provides a very
small amount of logic. In our experience that it is just the right amount of
logic to be able to create a good static website. If you have used other
template systems from different languages or frameworks you will find a lot of
similarities in Go templates.
This document is a brief primer on using Go templates. The [Go docs][gohtmltemplate]
provide more details.
## Introduction to Go Templates
Go templates provide an extremely simple template language. It adheres to the
belief that only the most basic of logic belongs in the template or view layer.
One consequence of this simplicity is that Go templates parse very quickly.
A unique characteristic of Go templates is they are content aware. Variables and
content will be sanitized depending on the context of where they are used. More
details can be found in the [Go docs][gohtmltemplate].
## Basic Syntax
Golang templates are HTML files with the addition of variables and
functions.
**Go variables and functions are accessible within {{ }}**
Accessing a predefined variable "foo":
{{ foo }}
**Parameters are separated using spaces**
Calling the add function with input of 1, 2:
{{ add 1 2 }}
**Methods and fields are accessed via dot notation**
Accessing the Page Parameter "bar"
{{ .Params.bar }}
**Parentheses can be used to group items together**
{{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }}
## Variables
Each Go template has a struct (object) made available to it. In hugo each
template is passed either a page or a node struct depending on which type of
page you are rendering. More details are available on the
[variables](/layout/variables) page.
A variable is accessed by referencing the variable name.
<title>{{ .Title }}</title>
Variables can also be defined and referenced.
{{ $address := "123 Main St."}}
{{ $address }}
## Functions
Go template ship with a few functions which provide basic functionality. The Go
template system also provides a mechanism for applications to extend the
available functions with their own. [Hugo template
functions](/layout/functions) provide some additional functionality we believe
are useful for building websites. Functions are called by using their name
followed by the required parameters separated by spaces. Template
functions cannot be added without recompiling hugo.
**Example:**
{{ add 1 2 }}
## Includes
When including another template you will pass to it the data it will be
able to access. To pass along the current context please remember to
include a trailing dot. The templates location will always be starting at
the /layout/ directory within Hugo.
**Example:**
{{ template "chrome/header.html" . }}
## Logic
Go templates provide the most basic iteration and conditional logic.
### Iteration
Just like in Go, the Go templates make heavy use of range to iterate over
a map, array or slice. The following are different examples of how to use
range.
**Example 1: Using Context**
{{ range array }}
{{ . }}
{{ end }}
**Example 2: Declaring value variable name**
{{range $element := array}}
{{ $element }}
{{ end }}
**Example 2: Declaring key and value variable name**
{{range $index, $element := array}}
{{ $index }}
{{ $element }}
{{ end }}
### Conditionals
If, else, with, or, & and provide the framework for handling conditional
logic in Go Templates. Like range, each statement is closed with `end`.
Go Templates treat the following values as false:
* false
* 0
* any array, slice, map, or string of length zero
**Example 1: If**
{{ if isset .Params "title" }}<h4>{{ index .Params "title" }}</h4>{{ end }}
**Example 2: If -> Else**
{{ if isset .Params "alt" }}
{{ index .Params "alt" }}
{{else}}
{{ index .Params "caption" }}
{{ end }}
**Example 3: And & Or**
{{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
**Example 4: With**
An alternative way of writing "if" and then referencing the same value
is to use "with" instead. With rebinds the context `.` within its scope,
and skips the block if the variable is absent.
The first example above could be simplified as:
{{ with .Params.title }}<h4>{{ . }}</h4>{{ end }}
**Example 5: If -> Else If**
{{ if isset .Params "alt" }}
{{ index .Params "alt" }}
{{ else if isset .Params "caption" }}
{{ index .Params "caption" }}
{{ end }}
## Pipes
One of the most powerful components of Go templates is the ability to
stack actions one after another. This is done by using pipes. Borrowed
from unix pipes, the concept is simple, each pipeline's output becomes the
input of the following pipe.
Because of the very simple syntax of Go templates, the pipe is essential
to being able to chain together function calls. One limitation of the
pipes is that they only can work with a single value and that value
becomes the last parameter of the next pipeline.
A few simple examples should help convey how to use the pipe.
**Example 1 :**
{{ if eq 1 1 }} Same {{ end }}
is the same as
{{ eq 1 1 | if }} Same {{ end }}
It does look odd to place the if at the end, but it does provide a good
illustration of how to use the pipes.
**Example 2 :**
{{ index .Params "disqus_url" | html }}
Access the page parameter called "disqus_url" and escape the HTML.
**Example 3 :**
{{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
Stuff Here
{{ end }}
Could be rewritten as
{{ isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" | if }}
Stuff Here
{{ end }}
## Context (aka. the dot)
The most easily overlooked concept to understand about Go templates is that {{ . }}
always refers to the current context. In the top level of your template this
will be the data set made available to it. Inside of a iteration it will have
the value of the current item. When inside of a loop the context has changed. .
will no longer refer to the data available to the entire page. If you need to
access this from within the loop you will likely want to set it to a variable
instead of depending on the context.
**Example:**
{{ $title := .Site.Title }}
{{ range .Params.tags }}
<li> <a href="{{ $baseurl }}/tags/{{ . | urlize }}">{{ . }}</a> - {{ $title }} </li>
{{ end }}
Notice how once we have entered the loop the value of {{ . }} has changed. We
have defined a variable outside of the loop so we have access to it from within
the loop.
# Hugo Parameters
Hugo provides the option of passing values to the template language
through the site configuration (for sitewide values), or through the meta
data of each specific piece of content. You can define any values of any
type (supported by your front matter/config format) and use them however
you want to inside of your templates.
## Using Content (page) Parameters
In each piece of content you can provide variables to be used by the
templates. This happens in the [front matter](/content/front-matter).
An example of this is used in this documentation site. Most of the pages
benefit from having the table of contents provided. Sometimes the TOC just
doesn't make a lot of sense. We've defined a variable in our front matter
of some pages to turn off the TOC from being displayed.
Here is the example front matter:
```
---
title: "Permalinks"
date: "2013-11-18"
aliases:
- "/doc/permalinks/"
groups: ["extras"]
groups_weight: 30
notoc: true
---
```
Here is the corresponding code inside of the template:
{{ if not .Params.notoc }}
<div id="toc" class="well col-md-4 col-sm-6">
{{ .TableOfContents }}
</div>
{{ end }}
## Using Site (config) Parameters
In your top-level configuration file (eg, `config.yaml`) you can define site
parameters, which are values which will be available to you in chrome.
For instance, you might declare:
```yaml
params:
CopyrightHTML: "Copyright &#xA9; 2013 John Doe. All Rights Reserved."
TwitterUser: "spf13"
SidebarRecentLimit: 5
```
Within a footer layout, you might then declare a `<footer>` which is only
provided if the `CopyrightHTML` parameter is provided, and if it is given,
you would declare it to be HTML-safe, so that the HTML entity is not escaped
again. This would let you easily update just your top-level config file each
January 1st, instead of hunting through your templates.
```
{{if .Site.Params.CopyrightHTML}}<footer>
<div class="text-center">{{.Site.Params.CopyrightHTML | safeHtml}}</div>
</footer>{{end}}
```
An alternative way of writing the "if" and then referencing the same value
is to use "with" instead. With rebinds the context `.` within its scope,
and skips the block if the variable is absent:
```
{{with .Site.Params.TwitterUser}}<span class="twitter">
<a href="https://twitter.com/{{.}}" rel="author">
<img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}"
alt="Twitter"></a>
</span>{{end}}
```
Finally, if you want to pull "magic constants" out of your layouts, you can do
so, such as in this example:
```
<nav class="recent">
<h1>Recent Posts</h1>
<ul>{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
<li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
{{end}}</ul>
</nav>
```
[go]: https://golang.org/
[gohtmltemplate]: https://golang.org/pkg/html/template/

View File

@ -0,0 +1,89 @@
+++
title = "Getting Started with Hugo"
description = ""
tags = [
"go",
"golang",
"hugo",
"development",
]
date = "2014-04-02"
categories = [
"Development",
"golang",
]
image = "stuck.jpg"
+++
## Step 1. Install Hugo
Go to [Hugo releases](https://github.com/spf13/hugo/releases) and download the
appropriate version for your OS and architecture.
Save it somewhere specific as we will be using it in the next step.
More complete instructions are available at [Install Hugo](https://gohugo.io/getting-started/installing/)
## Step 2. Build the Docs
Hugo has its own example site which happens to also be the documentation site
you are reading right now.
Follow the following steps:
1. Clone the [Hugo repository](http://github.com/spf13/hugo)
2. Go into the repo
3. Run hugo in server mode and build the docs
4. Open your browser to http://localhost:1313
Corresponding pseudo commands:
git clone https://github.com/spf13/hugo
cd hugo
/path/to/where/you/installed/hugo server --source=./docs
> 29 pages created
> 0 tags index created
> in 27 ms
> Web Server is available at http://localhost:1313
> Press ctrl+c to stop
Once you've gotten here, follow along the rest of this page on your local build.
## Step 3. Change the docs site
Stop the Hugo process by hitting Ctrl+C.
Now we are going to run hugo again, but this time with hugo in watch mode.
/path/to/hugo/from/step/1/hugo server --source=./docs --watch
> 29 pages created
> 0 tags index created
> in 27 ms
> Web Server is available at http://localhost:1313
> Watching for changes in /Users/spf13/Code/hugo/docs/content
> Press ctrl+c to stop
Open your [favorite editor](http://vim.spf13.com) and change one of the source
content pages. How about changing this very file to *fix the typo*. How about changing this very file to *fix the typo*.
Content files are found in `docs/content/`. Unless otherwise specified, files
are located at the same relative location as the url, in our case
`docs/content/overview/quickstart.md`.
Change and save this file.. Notice what happened in your terminal.
> Change detected, rebuilding site
> 29 pages created
> 0 tags index created
> in 26 ms
Refresh the browser and observe that the typo is now fixed.
Notice how quick that was. Try to refresh the site before it's finished building. I double dare you.
Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.
## Step 4. Have fun
The best way to learn something is to play with it.

View File

@ -0,0 +1,151 @@
---
date: 2014-03-10
title: Migrate to Hugo from Jekyll
image: 'speakers.jpg'
---
## Move static content to `static`
Jekyll has a rule that any directory not starting with `_` will be copied as-is to the `_site` output. Hugo keeps all static content under `static`. You should therefore move it all there.
With Jekyll, something that looked like
<root>/
▾ images/
logo.png
should become
<root>/
▾ static/
▾ images/
logo.png
Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`.
## Create your Hugo configuration file
Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the [Hugo configuration documentation](/overview/configuration/) for details.
## Set your configuration publish folder to `_site`
The default is for Jekyll to publish to `_site` and for Hugo to publish to `public`. If, like me, you have [`_site` mapped to a git submodule on the `gh-pages` branch](http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html), you'll want to do one of two alternatives:
1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended).
git submodule deinit _site
git rm _site
git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
2. Or, change the Hugo configuration to use `_site` instead of `public`.
{
..
"publishdir": "_site",
..
}
## Convert Jekyll templates to Hugo templates
That's the bulk of the work right here. The documentation is your friend. You should refer to [Jekyll's template documentation](http://jekyllrb.com/docs/templates/) if you need to refresh your memory on how you built your blog and [Hugo's template](/layout/templates/) to learn Hugo's way.
As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours.
## Convert Jekyll plugins to Hugo shortcodes
Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port.
### Implementation
As an example, I was using a custom [`image_tag`](https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb) plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.
Jekyll's plugin:
module Jekyll
class ImageTag < Liquid::Tag
@url = nil
@caption = nil
@class = nil
@link = nil
// Patterns
IMAGE_URL_WITH_CLASS_AND_CAPTION =
IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i
IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i
IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
def initialize(tag_name, markup, tokens)
super
if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
@class = $1
@url = $3
@caption = $7
@link = $9
elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
@class = $1
@url = $3
@caption = $7
elsif markup =~ IMAGE_URL_WITH_CAPTION
@url = $1
@caption = $5
elsif markup =~ IMAGE_URL_WITH_CLASS
@class = $1
@url = $3
elsif markup =~ IMAGE_URL
@url = $1
end
end
def render(context)
if @class
source = "<figure class='#{@class}'>"
else
source = "<figure>"
end
if @link
source += "<a href=\"#{@link}\">"
end
source += "<img src=\"#{@url}\">"
if @link
source += "</a>"
end
source += "<figcaption>#{@caption}</figcaption>" if @caption
source += "</figure>"
source
end
end
end
Liquid::Template.register_tag('image', Jekyll::ImageTag)
is written as this Hugo shortcode:
<!-- image -->
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} />
{{ if .Get "link"}}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>{{ if isset .Params "title" }}
{{ .Get "title" }}{{ end }}
{{ if or (.Get "caption") (.Get "attr")}}<p>
{{ .Get "caption" }}
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
{{ .Get "attr" }}
{{ if .Get "attrlink"}}</a> {{ end }}
</p> {{ end }}
</figcaption>
{{ end }}
</figure>
<!-- image -->
### Usage
I simply changed:
{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg "One of my favorite touristy-type photos. I secretly waited for the good light while we were "having fun" and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." ->http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`):
{{%/* fig class="full" src="http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg" title="One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." link="http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/" */%}}
As a bonus, the shortcode named parameters are, arguably, more readable.
## Finishing touches
### Fix content
Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that `hugo server --watch` is your friend. Test your changes and fix errors as needed.
### Clean up
You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it.
## A practical example in a diff
[Hey, it's Alex](http://heyitsalex.net/) was migrated in less than a _father-with-kids day_ from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this [diff](https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610).

View File

@ -0,0 +1,4 @@
- name: weru
twitter: onweru
photo: 'weru.jpg'
url: https://www.linkedin.com/in/dan-weru-profile/

View File

@ -0,0 +1,2 @@
name: Weru
url: https://www.linkedin.com/in/dan-weru-profile/

View File

@ -0,0 +1,10 @@
- item: About
url: about/
- item: Blog
url: ""
- item: Category A
url: categories/development/
- item: Category B
url: categories/golang/
- item: Tag B
url: tags/go/

View File

@ -0,0 +1,339 @@
function createEl(element) {
return document.createElement(element);
}
function elem(selector, parent = document){
let elem = document.querySelector(selector);
return elem != false ? elem : false;
}
function elems(selector) {
let elems = document.querySelectorAll(selector);
return elems.length ? elems : false;
}
function pushClass(el, targetClass) {
// equivalent to addClass
if (el && typeof el == 'object' && targetClass) {
elClass = el.classList;
elClass.contains(targetClass) ? false : elClass.add(targetClass);
}
}
function deleteClass(el, targetClass) {
// equivalent to removeClass
if (el && typeof el == 'object' && targetClass) {
elClass = el.classList;
elClass.contains(targetClass) ? elClass.remove(targetClass) : false;
}
}
function modifyClass(el, targetClass) {
if (el && typeof el == 'object' && targetClass) {
elClass = el.classList;
elClass.contains(targetClass) ? elClass.remove(targetClass) : elClass.add(targetClass);
}
}
function containsClass(el, targetClass) {
if (el && typeof el == 'object' && targetClass) {
return el.classList.contains(targetClass) ? true : false;
}
}
function isChild(node, parentClass) {
let objectsAreValid = node && typeof node == 'object' && parentClass && typeof parentClass == 'string';
return (objectsAreValid && node.closest(parentClass)) ? true : false;
}
(function updateDate() {
var date = new Date();
var year = date.getFullYear();
elem('.year').innerHTML = year;
})();
(function() {
let bar = 'nav_bar-wrap';
let navBar = elem(`.${bar}`);
let nav = elem('.nav-body');
let open = 'nav-open';
let exit = 'nav-exit';
let drop = 'nav-drop';
let pop = 'nav-pop';
let navDrop = elem(`.${drop}`);
let hidden = 'hidden';
function toggleMenu(){
modifyClass(navDrop, pop);
modifyClass(navBar, hidden);
let menuOpen = containsClass(nav, open);
let menuPulled = containsClass(nav, exit);
let status = menuOpen || menuPulled ? true : false;
status ? modifyClass(nav, exit) : modifyClass(nav, open);
status ? modifyClass(nav, open) : modifyClass(nav, exit);
}
// $('.nav-bar, .nav-close').on('click', () => toggleMenu());
navBar.addEventListener('click', function() {
toggleMenu();
});
elem('.nav-close').addEventListener('click', function() {
toggleMenu();
});
elem('.nav-drop').addEventListener('click', function(e) {
e.target === this ? toggleMenu() : false;
});
})();
(function share(){
let share = elem('.share');
let open = 'share-open';
let close = 'share-close';
let button = elem('.share-trigger');
function showShare() {
pushClass(share, open);
deleteClass(share, close);
}
function hideShare() {
pushClass(share, open);
deleteClass(share, close);
}
if (button) {
button.addEventListener('click', function() {
showShare();
setTimeout(hideShare, 5000);
});
}
})();
(function comments(){
let comments = elem('.js-comments');
let form = elem('.form');
let body = elem('body');
let button = elem('.form_toggle');
let loading = 'form-loading';
let open = 'form-open';
let show = 'modal_show'
let toggled = 'toggled';
let successOutput = [
'Review submitted',
'Thanks for your review! It will show on the site once it has been approved.'
];
let errorOutput = [
'Error',
'Sorry, there was an error with the submission!'
];
function handleForm(form) {
form.addEventListener('submit', function (event) {
pushClass(form, loading);
function resetForm() {
deleteClass(form, loading);
// $("form").trigger("reset");
}
function formActions(message) {
showModal(...message) // array destructuring
resetForm();
}
event.preventDefault();
function formToJSON(obj) {
let rawData = Array.from(obj.elements);
let data = {};
rawData.forEach(function(element){
data[element.name] = element.value;
});
return JSON.stringify(data);
}
let data = formToJSON(form);
let url = form.getAttribute('action').trim();
fetch(url, {
method: "POST",
body: data,
headers: {
"Content-Type": "application/json"
}
}).then(function(res) {
if(res.ok) {
formActions(successOutput);
} else {
formActions(errorOutput);
}
}).catch(function(error) {
formActions(errorOutput);
console.error('Error:', error);
});
});
}
form ? handleForm(form) : false;
function closeModal() {
elem('.modal_close').addEventListener('click', function () {
deleteClass(body, show);
deleteClass(form, loading);
deleteClass(form, open);
deleteClass(button, toggled);
});
}
containsClass(body, show) ? closeModal() : false;
function showModal(title, message) {
elem('.modal_title').textContent = title;
elem('.modal_text').innerHTML = message;
pushClass(body, show);
}
(function toggleForm() {
if(button) {
button.addEventListener('click', function() {
modifyClass(form, open);
modifyClass(this, toggled);
this.textContent = containsClass(this, toggled) ? 'cancel' : 'comment';
});
}
})();
})();
function elemAttribute(elem, attr, value = null) {
if (value) {
elem.setAttribute(attr, value);
} else {
value = elem.getAttribute(attr);
return value ? value : false;
}
}
(function(){
let links = document.querySelectorAll('a');
if(links) {
Array.from(links).forEach(function(link){
let target, rel, blank, noopener, attr1, attr2, url, isExternal;
url = elemAttribute(link, 'href');
isExternal = (url && typeof url == 'string' && url.startsWith('http')) && !containsClass(link, 'nav_item') && !isChild(link, '.post_item') && !isChild(link, '.pager') ? true : false;
if(isExternal) {
target = 'target';
rel = 'rel';
blank = '_blank';
noopener = 'noopener';
attr1 = elemAttribute(link, target);
attr2 = elemAttribute(link, noopener);
attr1 ? false : elemAttribute(link, target, blank);
attr2 ? false : elemAttribute(link, noopener, noopener);
}
});
}
})();
let headingNodes = [], results, link, icon, current, id,
tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
current = document.URL;
tags.forEach(function(tag){
results = document.getElementsByTagName(tag);
Array.prototype.push.apply(headingNodes, results);
});
headingNodes.forEach(function(node){
link = createEl('a');
icon = createEl('img');
icon.src = 'http://localhost:1313/images/icons/link.svg';
link.className = 'link';
link.appendChild(icon);
id = node.getAttribute('id');
if(id) {
link.href = `${current}#${id}`;
node.appendChild(link);
pushClass(node, 'link_owner');
}
});
const copyToClipboard = str => {
// Create a <textarea> element
const el = createEl('textarea');
// Set its value to the string that you want copied
el.value = str;
// Make it readonly to be tamper-proof
el.setAttribute('readonly', '');
// Move outside the screen to make it invisible
el.style.position = 'absolute';
el.style.left = '-9999px';
// Append the <textarea> element to the HTML document
document.body.appendChild(el);
// Check if there is any content selected previously
const selected =
document.getSelection().rangeCount > 0
? document.getSelection().getRangeAt(0) // Store selection if found
: false; // Mark as false to know no selection existed before
el.select(); // Select the <textarea> content
document.execCommand('copy'); // Copy - only works as a result of a user action (e.g. click events)
document.body.removeChild(el); // Remove the <textarea> element
if (selected) { // If a selection existed before copying
document.getSelection().removeAllRanges(); // Unselect everything on the HTML document
document.getSelection().addRange(selected); // Restore the original selection
}
}
(function copyHeadingLink() {
let deeplinks = document.querySelectorAll;
let deeplink = 'link';
if(deeplinks) {
document.body.addEventListener('click', function(event)
{
let target = event.target;
if (target.classList.contains(deeplink) || target.parentNode.classList.contains(deeplink)) {
event.preventDefault();
let newLink = target.href != undefined ? target.href : target.parentNode.href;
copyToClipboard(newLink);
}
});
}
})();
(function copyLinkToShare() {
let copy, copied, excerpt, isCopyIcon, isInExcerpt, link, page, postCopy, postLink, target;
copy = 'copy';
copied = 'copy_done';
excerpt = 'excerpt';
postCopy = 'post_copy';
postLink = 'post_card';
page = document.documentElement;
page.addEventListener('click', function(event) {
target = event.target;
isCopyIcon = containsClass(target, copy);
isInExcerpt = containsClass(target, postCopy);
if (isCopyIcon) {
if (isInExcerpt) {
link = target.closest(`.${excerpt}`).previousElementSibling;
link = containsClass(link, postLink)? elemAttribute(link, 'href') : false;
} else {
link = window.location.href;
}
if(link) {
copyToClipboard(link);
pushClass(target, copied);
}
}
});
})();

View File

@ -0,0 +1 @@
{"Target":"js/index.js","MediaType":"application/javascript","Data":{}}

View File

@ -0,0 +1 @@
{"Target":"main.d67221038b4e9b75d0e61a1348f203060d2f5f3fc1c89991ee75c321c55bc33512fd1b820a1c4684f0f7437f6b427b2b287be311f536db8916260cefb431e54a.css","MediaType":"text/css","Data":{"Integrity":"sha512-1nIhA4tOm3XQ5hoTSPIDBg0vXz/ByJmR7nXDIcVbwzUS/RuCChxGhPD3Q39rQnsrKHvjEfU224kWJgzvtDHlSg=="}}

View File

@ -0,0 +1 @@
{"Target":"css/main.34c570a3a70342bd493da22fe29cbc6662935af7011e94e7302b7422bf26594908393627b6e3efbf8e5dd9875b52386cc4825640896de1371e07e62f774e7b69.css","MediaType":"text/css","Data":{"Integrity":"sha512-NMVwo6cDQr1JPaIv4py8ZmKTWvcBHpTnMCt0Ir8mWUkIOTYntuPvv45d2YdbUjhsxIJWQIlt4TceB+Yvd057aQ=="}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

View File

@ -0,0 +1,31 @@
# Edit accordingly
comments:
allowedFields: ["name", "email", "comment"]
allowedOrigins: ["localhost", "example.com"]
branch: "master" # should match your config.toml
filename: "comment-{@date:YYYY-MM-DDTHH-mm-ss.SSS}"
format: "yaml"
commitMessage: "New Staticman comment in {options.slug}"
generatedFields:
date:
type: date
options:
format: "iso8601"
moderation: false
name: "Fancy Site Title"
path: "data/comments/{options.slug}"
requiredFields: ["name", "email", "comment"]
transforms:
email: md5
# reCAPTCHA (OPTIONAL)
# Register your domain at https://www.google.com/recaptcha/ and choose reCAPTCHA V2
# Use your OWN siteKey and secret.
reCaptcha:
enabled: false
# siteKey and secret should match your config.toml
#siteKey: "6Lcv8G8UAAAAAEqV1Y-XEPum00C_DxhD6O--qkFo"
# (!) ENCRYPT reCaptcha secret key using Staticman /encrypt endpoint
# i.e. https://{staticman-endpoint}/v3/encrypt/{your-site-secret}
# For more information, https://staticman.net/docs/encryption
#secret: "p5uHlH9hCqpMJaGKXdt5MEWFo7K6fX8hoYUwR3aIafOI6rtItLauaDCkGOucysJtrVZy+sHffioGzMsOU64JFDSyPQgrXujegcOHFRXHhD4fOUuBXSvV+OZ8JhSPTGWaRcQcoiGX4pT5hlebLddOl59b6sn6kU1ODQcEbhP83xVLZlaTWOrNrF5Wvy3TMXpH5gyl1tZEORxADAShMYyUbNR7XZYLEg1DfgIBHfIg3cKwdFt7KVLejFGKIiBYRAZDE2JuHItNmzJ2x9JgSK3E+XnShV5tuWpncnyFonJVHGEky/zRfUVLHobDMcJ/u9nlZqE8u47W+833F1WaIYuwNw=="

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

View File

@ -0,0 +1,6 @@
{{ define "main" }}
<div class = 'center wrap'>
<h1 class = 'mt'>404</h1>
<p class = 'pale'>Uh-Oh, that page doesn't exist</p>
</div>
{{ end }}

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang='{{ .Lang }}'>
{{ partial "head.html" . }}
<body>
{{ partial "nav.html" . }}
<main>
{{ block "main" . }}{{ end }}
</main>
{{ partial "footer.html" . }}
</body>
</html>

View File

@ -0,0 +1,3 @@
{{ define "main" }}
{{ partial "archive.html" . }}
{{ end }}

View File

@ -0,0 +1,23 @@
{{ define "main" }}
{{ $bgImage := ( absURL (printf "images/%s" .Params.image) ) }}
<section class = 'post_header' style = 'background-image:url({{ $bgImage }});'>
<h1 class='post_title' itemprop='name headline'>{{ .Title }}</h1>
</section>
<div class = 'post'>
<article class='post_content'>
{{ .Content }}
<div class = 'post_extra'>
<div class = 'copy'></div>
</div>
{{ partial "author.html" . }}
</article>
{{ if .Site.Params.Staticman }}
{{ partial "comments.html" . }}
{{ end }}
<aside>
{{ partial "aside.html" . }}
</aside>
</div>
<script src = '{{ absURL "js/autosize.min.js" }}'></script>
<script src = '{{ absURL "js/timeago.js" }}'></script>
{{ end }}

View File

@ -0,0 +1,3 @@
{{ define "main" }}
{{ partial "archive.html" . }}
{{ end }}

View File

@ -0,0 +1,9 @@
{{- with .Site.Params.ga_analytics }}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ . }}');
</script>
{{ end -}}

View File

@ -0,0 +1,7 @@
{{ partial "intro.html" . }}
<ul class='posts wrap' id = 'posts'>
{{- range .Paginator.Pages }}
{{ partial "excerpt.html" . }}
{{- end }}
</ul>
{{ partial "pager.html" . }}

View File

@ -0,0 +1,13 @@
<h3>Recent Posts</h3>
<ul class='posts aside'>
<!-- filter array of posts with the first tag of this post (related) -->
<!-- if post doesn't have any tags use RegularPages -->
<!-- filter out the current post -->
<!-- return atmost 2 posts -->
{{ $title := .Params.title }}
{{ range first 2 .Site.RegularPages }}
{{ if not (eq .Title $title) }}
{{ partial "excerpt.html" . }}
{{ end }}
{{ end }}
</ul>

View File

@ -0,0 +1,5 @@
<div class = 'waves'>
<canvas id = 'waves' class = 'waves_inner'></canvas>
</div>
<script src = '{{ absURL "js/sine-waves.min.js" }}'></script>
<script src = '{{ absURL "js/audio.js" }}'></script>

View File

@ -0,0 +1,16 @@
{{ $author := (lower .Params.author) }}
{{ $reading := .ReadingTime }}
{{ range .Site.Data.authors }}
{{ if eq .name $author }}
<div class = 'author'>
<a href = '{{ .url }}' target = "{{ $author }}'s profile">
<img class = 'author_pic' src = '{{ absURL (printf "images/%s.jpg" $author) }}' alt = ''>
</a>
<div class = 'author_meta'>
<div class = 'pale author_heading'>WRITTEN BY</div>
<a class = 'author_name' href = '{{ .url }}' title = "{{ $author }}'s Profile">{{ .name }}</a>
</div>
<p class = 'pale author_bio solo'>{{ .bio }}</p>
</div>
{{ end }}
{{ end }}

View File

@ -0,0 +1,30 @@
{{ $vs := .Site.Params.staticman }}
<span class = 'form_toggle btn'>Comment</span>
<form method = 'POST' action = '{{ $vs.endpoint | default "https://api.staticman.net" }}/v3/entry/{{ $vs.gitProvider }}/{{ $vs.username }}/{{ $vs.repository }}/{{ $vs.branch }}/comments' class = 'form form-comments' id = 'comments-form'>
<input name = 'options[slug]' type = 'hidden' value = '{{ md5 .File.Path }}'>
{{- if $vs.reCaptcha -}}
<input name = 'options[reCaptcha][siteKey]' type = 'hidden' value = '{{ $vs.reCaptcha.siteKey }}'>
<input name = 'options[reCaptcha][secret]' type = 'hidden' value = '{{ $vs.reCaptcha.secret }}'>
{{- end -}}
<label class = 'form_label'>Name</label>
<input name = 'fields[name]' type = 'text' placeholder = 'Name' class = 'form_input' required>
<label class = 'form_label'>E-mail</label>
<input name = 'fields[email]' type = 'email' placeholder = 'Email' class = 'form_input' required>
<label class = 'form_label'>Comment</label>
<textarea name = 'fields[comment]' placeholder = 'Type in a comment ...' class = 'form_input form_input-message' required></textarea>
{{- if $vs.reCaptcha -}}
<div class = 'g-recaptcha' data-sitekey = '{{ $vs.reCaptcha.siteKey }}' data-callback='enableSubmitComment'></div>
<script type="text/javascript">
function enableSubmitComment(){
document.getElementById('submitComment').disabled = false;
}
</script>
<script async src = 'https://www.google.com/recaptcha/api.js'></script>
{{- end -}}
<div>
<input type = 'submit' id = 'submitComment' value = 'Comment' class = 'btn form_input-submit' {{- if $vs.reCaptcha }} disabled {{- end }}>
</div>
</form>

View File

@ -0,0 +1,31 @@
<h3>Comments</h3>
<div class = 'comments'>
{{ $.Scratch.Add "hasComments" 0 }}
{{ $entryId := md5 .File.Path }}
{{ if .Site.Data.comments }}
{{ range $index, $comments := (index $.Site.Data.comments $entryId ) }}
{{ $.Scratch.Add "hasComments" 1 }}
<div class = 'comment'>
<img src = 'https://www.gravatar.com/avatar/{{ .email }}?s=100' alt = 'user icon' class = 'comment_pic'>
<div class = 'comment_meta'>
<div class = 'comment_heading pale' data-time = '{{ .date }}'></div>
<div class = 'comment_author comment_name'>{{ .name }}</div>
</div>
<p class = 'solo comment_bio pale'>{{ .comment | markdownify }}</p>
</div>
{{ end }}
{{ end }}
{{ if eq ($.Scratch.Get "hasComments") 0 }}
<p>Nothing yet.</p>
{{ end }}
{{ partial "comments-form.html" . }}
<article class = 'modal'>
<div class = 'modal_inner'>
<h2 class = 'modal_title'></h2>
<div class = 'modal_text'></div>
<button class = 'modal_close'>Close</button>
</div>
</article>
</div>

View File

@ -0,0 +1,22 @@
<li class = 'post_item'>
<a class = 'post_card' href='{{ .RelPermalink }}' title = '{{ .Title }}'>
<img class = 'post_thumbnail' src='{{ path.Join "images" .Params.image | absLangURL }}'>
</a>
<div class = 'excerpt'>
<div class = 'excerpt_meta'>
{{ with .Params.tags -}}
{{ range first 1 . }}
{{ $tag := . | urlize }}
<a href = '{{ absURL (printf "tags/%s" $tag) }}' class = 'post_tag'>
{{ . }}
</a>
{{ end }}
{{- end }}
<div class = 'post_copy copy'></div>
</div>
<h3 class = 'post_link'>
<a href='{{ .RelPermalink }}'>{{ .Title }}</a>
</h3>
<p class = 'pale'>{{ .Summary | truncate 90 }}</p>
</div>
</li>

View File

@ -0,0 +1,7 @@
<link rel='apple-touch-icon' sizes='180x180' href='{{ absURL "images/icons/apple-touch-icon.png" }}'>
<link rel='icon' type='image/png' sizes='32x32' href='{{ absURL "images/icons/favicon-32x32.png" }}'>
<link rel='icon' type='image/png' sizes='16x16' href='{{ absURL "images/icons/favicon-16x16.png" }}'>
<link rel='manifest' href='{{ absURL "images/icons/site.webmanifest" }}'>
<link rel='mask-icon' href='{{ absURL "images/icons/safari-pinned-tab.svg" }}' color='#5bbad5'>
<meta name='msapplication-TileColor' content='#da532c'>
<meta name='theme-color' content='#ffffff'>

View File

@ -0,0 +1,8 @@
<footer class = 'footer'>
<div class = 'footer_inner wrap pale'>
<p>&copy; <span class = 'year'></span> {{ .Site.Title }}</p>
<p>Designed by <a href = '{{ .Site.Data.designer.url }}' target = '_blank' title = 'Linkedin Profile' rel = 'nonopener'> {{ .Site.Data.designer.name }}</a></p>
</div>
</footer>
{{ $scripts := resources.Get "js/index.js" | resources.ExecuteAsTemplate "js/index.js" . }}
<script src = '{{ $scripts.Permalink }}'></script>

View File

@ -0,0 +1,17 @@
<head>
<title>{{ with .Title }}{{ humanize . }} | {{ end }}{{ .Site.Title }}</title>
<meta charset='utf-8'>
{{- with .Site.Params.ga_verify }}
<meta name="google-site-verification" content="{{ . }}" />
{{- end }}
<meta name = 'viewport' content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'>
<meta http-equiv = 'X-UA-Compatible' content = 'IE=edge'>
<meta name = 'SKYPE_TOOLBAR' content = 'SKYPE_TOOLBAR_PARSER_COMPATIBLE' />
{{- partial "analytics.html" . }}
{{- partial "opengraph.html" . }}
{{- partial "favicon.html" . }}
<link rel='canonical' href='{{ .Permalink }}'>
{{- $options := (dict "targetPath" "css/main.css" "outputStyle" "expanded" "enableSourceMap" "true") -}}
{{- $styles := resources.Get "scss/main.scss" | resources.ExecuteAsTemplate "scss/main.scss" . | resources.ToCSS $options | resources.Fingerprint "sha512" }}
<link rel = 'stylesheet' href = '{{ $styles.Permalink }}' integrity = '{{ $styles.Data.Integrity }}'>
</head>

View File

@ -0,0 +1,8 @@
<header class = 'nav' >
<nav class = 'nav-menu'>
<a href='{{ absURL "" }}' class = 'nav-brand nav_item'>{{ .Site.Title }}</a>
<div class = 'nav_bar-wrap'>
<div class = 'nav_bar'></div>
</div>
</nav>
</header>

View File

@ -0,0 +1,8 @@
<!-- intro banner on list pages -->
<section class = 'intro'>
<div class = 'intro_inner'>
<div>{{ partial "audio.html" . }}</div>
<h1 class = 'intro_headline'>{{ .Title }}</h1>
<p class = 'intro_desc'>{{ .Description }}</p>
</div>
</section>

View File

@ -0,0 +1,9 @@
<div class = 'nav-drop'>
<div class = 'nav-body'>
{{ range .Site.Data.menu }}
<a href = '{{ absURL .url }}' class = 'nav_item'>{{ .item }}</a>
{{ end }}
<div class = 'nav-close'></div>
</div>
</div>
{{ partial "header.html" . }}

View File

@ -0,0 +1,49 @@
<meta name = 'keywords' content = '{{ .Site.Title }}'>
<meta property = 'og:locale' content = 'en_US' />
<meta property = 'og:type' content = 'article' />
<meta property = 'og:title' content = '{{ .Title }}' />
<meta property = 'og:description' content = '{{ with .Summary}}{{ . | truncate 150 }}{{ else }}{{ .Site.Params.description }}{{ end }}'>
<meta property = 'og:url' content = '{{ .Permalink }}' />
{{- with .Params.image }}
<meta property = 'og:image' content = '{{ absURL (printf "images/%s" .) }}'/>
{{- else }}
<meta property = 'og:image' content = '{{ absURL (printf "images/%s" .Site.Params.logo) }}'/>
{{- end }}
{{- if eq .Section "blog" -}}
{{- $date := ( .Date.Format "2006-02-01") -}}
<meta property = 'article:published_time' content = '{{ htmlUnescape $date }}' />
<script type = "application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage":"{{ .Permalink }}",
"name": "{{ .Site.Title }}",
"headline": "{{ .Title }}",
"description": "{{ htmlUnescape (.Summary | truncate 150) }}",
"url": "{{ .Permalink }}",
"datePublished": "{{ $date }}",
"dateModified": "{{ $date }}",
"author": {
"@type": "Person",
"name": "{{ .Params.author }}"
},
"image":{
"@type":"ImageObject",
"url": "{{ absURL (printf "images/%s" .Params.image ) }}"
},
"publisher": {
"@type": "Organization",
"logo": {
"@type":"ImageObject",
"url": "{{ absURL (printf "images/%s" .Site.Params.logo) }}"
},
"name": "{{ .Site.Title }}"
}
}
</script>
<meta name = 'twitter:card' content = 'summary_large_image' />
<meta name = 'twitter:creator' content = '{{ .Site.Params.twitter }}'>
<meta name = 'twitter:title' content = '{{ .Title }}' />
<meta property = 'twitter:description' content = '{{ .Summary | truncate 250 }}'/>
<meta name = 'twitter:image' content = '{{ absURL (printf "images/%s" .Params.image) }}' />
{{- end }}

View File

@ -0,0 +1,20 @@
{{- $paginator := .Paginator }}
{{- if gt $paginator.TotalPages 1 }}
<div class = 'pager'>
<!-- {{ if $paginator.HasPrev }}
<a href = '{{ $paginator.Prev.URL }}' class = ' pager_item pager_prev'></a>
{{ else }}
<span class = ' pager_item pager_active pager_prev'></span>
{{- end }} -->
{{ range $paginator.Pagers -}}
<a href="{{ .URL }}" class = 'pager_item{{ if eq . $paginator }} pager_active{{ end }}'>{{ .PageNumber }}</a>
{{ end }}
<!-- {{- if $paginator.HasNext -}}
<a href = '{{ $paginator.Next.URL }}' class = ' pager_item pager_next'></a>
{{ else -}}
<span class = ' pager_item pager_active pager_next'></span>
{{ end }} -->
</div>
{{- end }}

View File

@ -0,0 +1,4 @@
{{ $url := .Get 0 }}
<div class = 'video'>
<iframe src='https://www.youtube.com/embed/{{ $url }}?controls=1&rel=0'></iframe>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Some files were not shown because too many files have changed in this diff Show More