diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c2ce27..7b43ca2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ variables: pages: script: - - cd exampleSite + - cd blog - hugo --themesDir=../.. -d ../public artifacts: paths: diff --git a/Sites/blog/themes/hugo-swift-theme b/Sites/blog/themes/hugo-swift-theme deleted file mode 160000 index f990880..0000000 --- a/Sites/blog/themes/hugo-swift-theme +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f990880aee6e807b308094138c8686c8051af871 diff --git a/Sites/blog/archetypes/default.md b/blog/archetypes/default.md similarity index 100% rename from Sites/blog/archetypes/default.md rename to blog/archetypes/default.md diff --git a/Sites/blog/config.toml b/blog/config.toml similarity index 100% rename from Sites/blog/config.toml rename to blog/config.toml diff --git a/Sites/blog/content/posts/my-first-post.md b/blog/content/posts/my-first-post.md similarity index 100% rename from Sites/blog/content/posts/my-first-post.md rename to blog/content/posts/my-first-post.md diff --git a/Sites/blog/data/authors.yml b/blog/data/authors.yml similarity index 100% rename from Sites/blog/data/authors.yml rename to blog/data/authors.yml diff --git a/Sites/blog/data/designer.yml b/blog/data/designer.yml similarity index 100% rename from Sites/blog/data/designer.yml rename to blog/data/designer.yml diff --git a/Sites/blog/data/menu.yml b/blog/data/menu.yml similarity index 100% rename from Sites/blog/data/menu.yml rename to blog/data/menu.yml diff --git a/Sites/blog/resources/_gen/assets/js/js/index.js_a64a8f41489dfe65eddbff8447bd69ed.content b/blog/resources/_gen/assets/js/js/index.js_a64a8f41489dfe65eddbff8447bd69ed.content similarity index 100% rename from Sites/blog/resources/_gen/assets/js/js/index.js_a64a8f41489dfe65eddbff8447bd69ed.content rename to blog/resources/_gen/assets/js/js/index.js_a64a8f41489dfe65eddbff8447bd69ed.content diff --git a/Sites/blog/resources/_gen/assets/js/js/index.js_a64a8f41489dfe65eddbff8447bd69ed.json b/blog/resources/_gen/assets/js/js/index.js_a64a8f41489dfe65eddbff8447bd69ed.json similarity index 100% rename from Sites/blog/resources/_gen/assets/js/js/index.js_a64a8f41489dfe65eddbff8447bd69ed.json rename to blog/resources/_gen/assets/js/js/index.js_a64a8f41489dfe65eddbff8447bd69ed.json diff --git a/Sites/blog/resources/_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.content b/blog/resources/_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.content similarity index 100% rename from Sites/blog/resources/_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.content rename to blog/resources/_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.content diff --git a/Sites/blog/resources/_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.json b/blog/resources/_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.json similarity index 100% rename from Sites/blog/resources/_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.json rename to blog/resources/_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.json diff --git a/blog/themes/hugo-swift-theme/.gitignore b/blog/themes/hugo-swift-theme/.gitignore new file mode 100644 index 0000000..4a382f5 --- /dev/null +++ b/blog/themes/hugo-swift-theme/.gitignore @@ -0,0 +1,3 @@ +public +docs +.DS_Store diff --git a/blog/themes/hugo-swift-theme/LICENSE b/blog/themes/hugo-swift-theme/LICENSE new file mode 100644 index 0000000..6333e52 --- /dev/null +++ b/blog/themes/hugo-swift-theme/LICENSE @@ -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 diff --git a/blog/themes/hugo-swift-theme/README.md b/blog/themes/hugo-swift-theme/README.md new file mode 100644 index 0000000..3ac6c2a --- /dev/null +++ b/blog/themes/hugo-swift-theme/README.md @@ -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). diff --git a/blog/themes/hugo-swift-theme/assets/js/index.js b/blog/themes/hugo-swift-theme/assets/js/index.js new file mode 100644 index 0000000..61d1363 --- /dev/null +++ b/blog/themes/hugo-swift-theme/assets/js/index.js @@ -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 + + {{- if $vs.reCaptcha -}} +
+ + + + + {{- end -}} +
+ +
+ diff --git a/blog/themes/hugo-swift-theme/layouts/partials/comments.html b/blog/themes/hugo-swift-theme/layouts/partials/comments.html new file mode 100644 index 0000000..136d87b --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/comments.html @@ -0,0 +1,31 @@ +

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 }} +
+ user icon +
+
+
{{ .name }}
+
+

{{ .comment | markdownify }}

+
+ {{ end }} + {{ end }} + + {{ if eq ($.Scratch.Get "hasComments") 0 }} +

Nothing yet.

+ {{ end }} + + {{ partial "comments-form.html" . }} + +
diff --git a/blog/themes/hugo-swift-theme/layouts/partials/excerpt.html b/blog/themes/hugo-swift-theme/layouts/partials/excerpt.html new file mode 100644 index 0000000..89382a1 --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/excerpt.html @@ -0,0 +1,22 @@ +
  • + + + +
    +
    + {{ with .Params.tags -}} + {{ range first 1 . }} + {{ $tag := . | urlize }} + + {{ end }} + {{- end }} +
    +
    +

    + {{ .Title }} +

    +

    {{ .Summary | truncate 90 }}

    +
    +
  • diff --git a/blog/themes/hugo-swift-theme/layouts/partials/favicon.html b/blog/themes/hugo-swift-theme/layouts/partials/favicon.html new file mode 100644 index 0000000..73c11ab --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/favicon.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/blog/themes/hugo-swift-theme/layouts/partials/footer.html b/blog/themes/hugo-swift-theme/layouts/partials/footer.html new file mode 100644 index 0000000..efae685 --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/footer.html @@ -0,0 +1,8 @@ + +{{ $scripts := resources.Get "js/index.js" | resources.ExecuteAsTemplate "js/index.js" . }} + diff --git a/blog/themes/hugo-swift-theme/layouts/partials/head.html b/blog/themes/hugo-swift-theme/layouts/partials/head.html new file mode 100644 index 0000000..b388fb8 --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/head.html @@ -0,0 +1,17 @@ + + {{ with .Title }}{{ humanize . }} | {{ end }}{{ .Site.Title }} + + {{- with .Site.Params.ga_verify }} + + {{- end }} + + + + {{- partial "analytics.html" . }} + {{- partial "opengraph.html" . }} + {{- partial "favicon.html" . }} + + {{- $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" }} + + diff --git a/blog/themes/hugo-swift-theme/layouts/partials/header.html b/blog/themes/hugo-swift-theme/layouts/partials/header.html new file mode 100644 index 0000000..1cb7380 --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/header.html @@ -0,0 +1,8 @@ + diff --git a/blog/themes/hugo-swift-theme/layouts/partials/intro.html b/blog/themes/hugo-swift-theme/layouts/partials/intro.html new file mode 100644 index 0000000..76bb6ed --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/intro.html @@ -0,0 +1,8 @@ + +
    +
    +
    {{ partial "audio.html" . }}
    +

    {{ .Title }}

    +

    {{ .Description }}

    +
    +
    \ No newline at end of file diff --git a/blog/themes/hugo-swift-theme/layouts/partials/nav.html b/blog/themes/hugo-swift-theme/layouts/partials/nav.html new file mode 100644 index 0000000..e79131b --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/nav.html @@ -0,0 +1,9 @@ + +{{ partial "header.html" . }} diff --git a/blog/themes/hugo-swift-theme/layouts/partials/opengraph.html b/blog/themes/hugo-swift-theme/layouts/partials/opengraph.html new file mode 100644 index 0000000..6aad7cf --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/opengraph.html @@ -0,0 +1,49 @@ + + + + + + +{{- with .Params.image }} + +{{- else }} + +{{- end }} +{{- if eq .Section "blog" -}} + {{- $date := ( .Date.Format "2006-02-01") -}} + + + + + + + +{{- end }} diff --git a/blog/themes/hugo-swift-theme/layouts/partials/pager.html b/blog/themes/hugo-swift-theme/layouts/partials/pager.html new file mode 100644 index 0000000..7ba2b92 --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/partials/pager.html @@ -0,0 +1,20 @@ +{{- $paginator := .Paginator }} +{{- if gt $paginator.TotalPages 1 }} +
    + + + {{ range $paginator.Pagers -}} + {{ .PageNumber }} + {{ end }} + + +
    +{{- end }} diff --git a/blog/themes/hugo-swift-theme/layouts/shortcodes/video.html b/blog/themes/hugo-swift-theme/layouts/shortcodes/video.html new file mode 100644 index 0000000..7a43326 --- /dev/null +++ b/blog/themes/hugo-swift-theme/layouts/shortcodes/video.html @@ -0,0 +1,4 @@ +{{ $url := .Get 0 }} +
    + +
    \ No newline at end of file diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Light.woff b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Light.woff new file mode 100644 index 0000000..7bdd5d9 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Light.woff differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Light.woff2 b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Light.woff2 new file mode 100644 index 0000000..3b20f07 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Light.woff2 differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-LightItalic.woff b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-LightItalic.woff new file mode 100644 index 0000000..9dbe570 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-LightItalic.woff differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-LightItalic.woff2 b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-LightItalic.woff2 new file mode 100644 index 0000000..f3c0e40 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-LightItalic.woff2 differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Medium.woff b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Medium.woff new file mode 100644 index 0000000..90cb752 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Medium.woff differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Medium.woff2 b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Medium.woff2 new file mode 100644 index 0000000..d5aabb6 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Medium.woff2 differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-MediumItalic.woff b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-MediumItalic.woff new file mode 100644 index 0000000..34335d6 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-MediumItalic.woff differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-MediumItalic.woff2 b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-MediumItalic.woff2 new file mode 100644 index 0000000..506fb07 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-MediumItalic.woff2 differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Regular.woff b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Regular.woff new file mode 100644 index 0000000..312202c Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Regular.woff differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Regular.woff2 b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Regular.woff2 new file mode 100644 index 0000000..40417bf Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Regular.woff2 differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-RegularItalic.woff b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-RegularItalic.woff new file mode 100644 index 0000000..63846f9 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-RegularItalic.woff differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-RegularItalic.woff2 b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-RegularItalic.woff2 new file mode 100644 index 0000000..956e0ad Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-RegularItalic.woff2 differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Thin.woff b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Thin.woff new file mode 100644 index 0000000..54987c4 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Thin.woff differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Thin.woff2 b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Thin.woff2 new file mode 100644 index 0000000..0c37070 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-Thin.woff2 differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-ThinItalic.woff b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-ThinItalic.woff new file mode 100644 index 0000000..411634e Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-ThinItalic.woff differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/Metropolis-ThinItalic.woff2 b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-ThinItalic.woff2 new file mode 100644 index 0000000..85491c2 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/Metropolis-ThinItalic.woff2 differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/cookie-v10-latin-regular.woff b/blog/themes/hugo-swift-theme/static/fonts/cookie-v10-latin-regular.woff new file mode 100644 index 0000000..878a183 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/cookie-v10-latin-regular.woff differ diff --git a/blog/themes/hugo-swift-theme/static/fonts/cookie-v10-latin-regular.woff2 b/blog/themes/hugo-swift-theme/static/fonts/cookie-v10-latin-regular.woff2 new file mode 100644 index 0000000..cc4872b Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/fonts/cookie-v10-latin-regular.woff2 differ diff --git a/blog/themes/hugo-swift-theme/static/images/artist.jpg b/blog/themes/hugo-swift-theme/static/images/artist.jpg new file mode 100644 index 0000000..60bdb68 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/artist.jpg differ diff --git a/blog/themes/hugo-swift-theme/static/images/fast-lane.jpg b/blog/themes/hugo-swift-theme/static/images/fast-lane.jpg new file mode 100644 index 0000000..dd80201 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/fast-lane.jpg differ diff --git a/blog/themes/hugo-swift-theme/static/images/frustrated.jpg b/blog/themes/hugo-swift-theme/static/images/frustrated.jpg new file mode 100644 index 0000000..98fe3bb Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/frustrated.jpg differ diff --git a/blog/themes/hugo-swift-theme/static/images/icons/android-chrome-192x192.png b/blog/themes/hugo-swift-theme/static/images/icons/android-chrome-192x192.png new file mode 100644 index 0000000..6bca6f7 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/icons/android-chrome-192x192.png differ diff --git a/blog/themes/hugo-swift-theme/static/images/icons/android-chrome-256x256.png b/blog/themes/hugo-swift-theme/static/images/icons/android-chrome-256x256.png new file mode 100644 index 0000000..88e5dd3 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/icons/android-chrome-256x256.png differ diff --git a/blog/themes/hugo-swift-theme/static/images/icons/android-chrome-512x512.png b/blog/themes/hugo-swift-theme/static/images/icons/android-chrome-512x512.png new file mode 100644 index 0000000..aedcab7 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/icons/android-chrome-512x512.png differ diff --git a/blog/themes/hugo-swift-theme/static/images/icons/apple-touch-icon.png b/blog/themes/hugo-swift-theme/static/images/icons/apple-touch-icon.png new file mode 100644 index 0000000..7de2451 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/icons/apple-touch-icon.png differ diff --git a/blog/themes/hugo-swift-theme/static/images/icons/browserconfig.xml b/blog/themes/hugo-swift-theme/static/images/icons/browserconfig.xml new file mode 100644 index 0000000..6d146a8 --- /dev/null +++ b/blog/themes/hugo-swift-theme/static/images/icons/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #ffc40d + + + diff --git a/blog/themes/hugo-swift-theme/static/images/icons/copy.svg b/blog/themes/hugo-swift-theme/static/images/icons/copy.svg new file mode 100644 index 0000000..1376346 --- /dev/null +++ b/blog/themes/hugo-swift-theme/static/images/icons/copy.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/blog/themes/hugo-swift-theme/static/images/icons/favicon-16x16.png b/blog/themes/hugo-swift-theme/static/images/icons/favicon-16x16.png new file mode 100644 index 0000000..50bb648 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/icons/favicon-16x16.png differ diff --git a/blog/themes/hugo-swift-theme/static/images/icons/favicon-32x32.png b/blog/themes/hugo-swift-theme/static/images/icons/favicon-32x32.png new file mode 100644 index 0000000..898e91d Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/icons/favicon-32x32.png differ diff --git a/blog/themes/hugo-swift-theme/static/images/icons/favicon.ico b/blog/themes/hugo-swift-theme/static/images/icons/favicon.ico new file mode 100644 index 0000000..1033657 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/icons/favicon.ico differ diff --git a/blog/themes/hugo-swift-theme/static/images/icons/link.svg b/blog/themes/hugo-swift-theme/static/images/icons/link.svg new file mode 100644 index 0000000..485fbdb --- /dev/null +++ b/blog/themes/hugo-swift-theme/static/images/icons/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/blog/themes/hugo-swift-theme/static/images/icons/mstile-150x150.png b/blog/themes/hugo-swift-theme/static/images/icons/mstile-150x150.png new file mode 100644 index 0000000..7d7909d Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/icons/mstile-150x150.png differ diff --git a/blog/themes/hugo-swift-theme/static/images/icons/safari-pinned-tab.svg b/blog/themes/hugo-swift-theme/static/images/icons/safari-pinned-tab.svg new file mode 100644 index 0000000..00ef8d7 --- /dev/null +++ b/blog/themes/hugo-swift-theme/static/images/icons/safari-pinned-tab.svg @@ -0,0 +1,27 @@ + + + + +Created by potrace 1.11, written by Peter Selinger 2001-2013 + + + + + + + + diff --git a/blog/themes/hugo-swift-theme/static/images/icons/site.webmanifest b/blog/themes/hugo-swift-theme/static/images/icons/site.webmanifest new file mode 100644 index 0000000..a2bfb44 --- /dev/null +++ b/blog/themes/hugo-swift-theme/static/images/icons/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/assets/favicons/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/assets/favicons/android-chrome-256x256.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/blog/themes/hugo-swift-theme/static/images/read.jpg b/blog/themes/hugo-swift-theme/static/images/read.jpg new file mode 100644 index 0000000..ca6d37a Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/read.jpg differ diff --git a/blog/themes/hugo-swift-theme/static/images/speakers.jpg b/blog/themes/hugo-swift-theme/static/images/speakers.jpg new file mode 100644 index 0000000..2e74fe3 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/speakers.jpg differ diff --git a/blog/themes/hugo-swift-theme/static/images/stuck.jpg b/blog/themes/hugo-swift-theme/static/images/stuck.jpg new file mode 100644 index 0000000..77bcafc Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/stuck.jpg differ diff --git a/blog/themes/hugo-swift-theme/static/images/weru.jpg b/blog/themes/hugo-swift-theme/static/images/weru.jpg new file mode 100644 index 0000000..bda86c0 Binary files /dev/null and b/blog/themes/hugo-swift-theme/static/images/weru.jpg differ diff --git a/blog/themes/hugo-swift-theme/static/js/audio.js b/blog/themes/hugo-swift-theme/static/js/audio.js new file mode 100644 index 0000000..cb88770 --- /dev/null +++ b/blog/themes/hugo-swift-theme/static/js/audio.js @@ -0,0 +1,59 @@ +(function(){ + var waves = new SineWaves({ + el: document.getElementById('waves'), + speed: 5, + rotate: 0, + ease: 'SineInOut', + wavesWidth: '75%', + waves: [ + { + timeModifier: 4, + lineWidth: 1, + amplitude: -20, + wavelength: 20 + }, + { + timeModifier: 2, + lineWidth: 1, + amplitude: -10, + wavelength: 27, + }, + { + timeModifier: 1, + lineWidth: 1, + amplitude: -27, + wavelength: 27, + }, + { + timeModifier: 3, + lineWidth: 1, + amplitude: 36, + wavelength: 36 + }, + { + timeModifier: 0.5, + lineWidth: 1, + amplitude: -50, + wavelength: 50 + }, + { + timeModifier: 1.3, + lineWidth: 1, + amplitude: -36, + wavelength: 36 + } + ], + initialize: function (){}, + resizeEvent: function() { + var gradient = this.ctx.createLinearGradient(0, 0, this.width, 0); + gradient.addColorStop(0,"rgba(0, 0, 255, 0)"); + gradient.addColorStop(0.5,"rgba(255, 0, 0, 0.75)"); + gradient.addColorStop(1,"rgba(0, 255, 0, 0"); + var index = -1; + var length = this.waves.length; + while(++index < length){ + this.waves[index].strokeStyle = gradient; + } + } + }); +})(); diff --git a/blog/themes/hugo-swift-theme/static/js/autosize.min.js b/blog/themes/hugo-swift-theme/static/js/autosize.min.js new file mode 100644 index 0000000..7353c45 --- /dev/null +++ b/blog/themes/hugo-swift-theme/static/js/autosize.min.js @@ -0,0 +1,140 @@ +! function(e, t) { + if ("function" == typeof define && define.amd) define(["exports", "module"], t); + else if ("undefined" != typeof exports && "undefined" != typeof module) t(exports, module); + else { + var n = { + exports: {} + }; + t(n.exports, n), e.autosize = n.exports + } +}(this, function(e, t) { + "use strict"; + + function n(e) { + function t() { + var t = window.getComputedStyle(e, null); + "vertical" === t.resize ? e.style.resize = "none" : "both" === t.resize && (e.style.resize = "horizontal"), s = "content-box" === t.boxSizing ? -(parseFloat(t.paddingTop) + parseFloat(t.paddingBottom)) : parseFloat(t.borderTopWidth) + parseFloat(t.borderBottomWidth), isNaN(s) && (s = 0), l() + } + + function n(t) { + var n = e.style.width; + e.style.width = "0px", e.offsetWidth, e.style.width = n, e.style.overflowY = t + } + + function o(e) { + for (var t = []; e && e.parentNode && e.parentNode instanceof Element;) e.parentNode.scrollTop && t.push({ + node: e.parentNode, + scrollTop: e.parentNode.scrollTop + }), e = e.parentNode; + return t + } + + function r() { + var t = e.style.height, + n = o(e), + r = document.documentElement && document.documentElement.scrollTop; + e.style.height = ""; + var i = e.scrollHeight + s; + return 0 === e.scrollHeight ? void(e.style.height = t) : (e.style.height = i + "px", u = e.clientWidth, n.forEach(function(e) { + e.node.scrollTop = e.scrollTop + }), void(r && (document.documentElement.scrollTop = r))) + } + + function l() { + r(); + var t = Math.round(parseFloat(e.style.height)), + o = window.getComputedStyle(e, null), + i = "content-box" === o.boxSizing ? Math.round(parseFloat(o.height)) : e.offsetHeight; + if (i !== t ? "hidden" === o.overflowY && (n("scroll"), r(), i = "content-box" === o.boxSizing ? Math.round(parseFloat(window.getComputedStyle(e, null).height)) : e.offsetHeight) : "hidden" !== o.overflowY && (n("hidden"), r(), i = "content-box" === o.boxSizing ? Math.round(parseFloat(window.getComputedStyle(e, null).height)) : e.offsetHeight), a !== i) { + a = i; + var l = d("autosize:resized"); + try { + e.dispatchEvent(l) + } catch (e) {} + } + } + if (e && e.nodeName && "TEXTAREA" === e.nodeName && !i.has(e)) { + var s = null, + u = e.clientWidth, + a = null, + c = function() { + e.clientWidth !== u && l() + }, + p = function(t) { + window.removeEventListener("resize", c, !1), e.removeEventListener("input", l, !1), e.removeEventListener("keyup", l, !1), e.removeEventListener("autosize:destroy", p, !1), e.removeEventListener("autosize:update", l, !1), Object.keys(t).forEach(function(n) { + e.style[n] = t[n] + }), i.delete(e) + }.bind(e, { + height: e.style.height, + resize: e.style.resize, + overflowY: e.style.overflowY, + overflowX: e.style.overflowX, + wordWrap: e.style.wordWrap + }); + e.addEventListener("autosize:destroy", p, !1), "onpropertychange" in e && "oninput" in e && e.addEventListener("keyup", l, !1), window.addEventListener("resize", c, !1), e.addEventListener("input", l, !1), e.addEventListener("autosize:update", l, !1), e.style.overflowX = "hidden", e.style.wordWrap = "break-word", i.set(e, { + destroy: p, + update: l + }), t() + } + } + + function o(e) { + var t = i.get(e); + t && t.destroy() + } + + function r(e) { + var t = i.get(e); + t && t.update() + } + var i = "function" == typeof Map ? new Map : function() { + var e = [], + t = []; + return { + has: function(t) { + return e.indexOf(t) > -1 + }, + get: function(n) { + return t[e.indexOf(n)] + }, + set: function(n, o) { + e.indexOf(n) === -1 && (e.push(n), t.push(o)) + }, + delete: function(n) { + var o = e.indexOf(n); + o > -1 && (e.splice(o, 1), t.splice(o, 1)) + } + } + }(), + d = function(e) { + return new Event(e, { + bubbles: !0 + }) + }; + try { + new Event("test") + } catch (e) { + d = function(e) { + var t = document.createEvent("Event"); + return t.initEvent(e, !0, !1), t + } + } + var l = null; + "undefined" == typeof window || "function" != typeof window.getComputedStyle ? (l = function(e) { + return e + }, l.destroy = function(e) { + return e + }, l.update = function(e) { + return e + }) : (l = function(e, t) { + return e && Array.prototype.forEach.call(e.length ? e : [e], function(e) { + return n(e, t) + }), e + }, l.destroy = function(e) { + return e && Array.prototype.forEach.call(e.length ? e : [e], o), e + }, l.update = function(e) { + return e && Array.prototype.forEach.call(e.length ? e : [e], r), e + }), t.exports = l +}); + +autosize(document.querySelector('textarea')); \ No newline at end of file diff --git a/blog/themes/hugo-swift-theme/static/js/sine-waves.min.js b/blog/themes/hugo-swift-theme/static/js/sine-waves.min.js new file mode 100644 index 0000000..385ba35 --- /dev/null +++ b/blog/themes/hugo-swift-theme/static/js/sine-waves.min.js @@ -0,0 +1,10 @@ +/*! + _______ _____ __ _ _______ _ _ _ _______ _ _ _______ _______ + |______ | | \ | |______ | | | |_____| \ / |______ |______ + ______| __|__ | \_| |______ |__|__| | | \/ |______ ______| + + sine-waves v0.3.0 + Contributor(s): Isaac Suttell + Last Build: 2014-12-03 +*/ +!function(a,b){"use strict";"function"==typeof define&&"object"==typeof define.amd?define([],function(){return b(a)}):a.SineWaves=b(a)}(this,function(){"use strict";function a(a){if(this.options=i.defaults(this.options,a),this.el=this.options.el,delete this.options.el,!this.el)throw"No Canvas Selected";if(this.ctx=this.el.getContext("2d"),this.waves=this.options.waves,delete this.options.waves,!this.waves||!this.waves.length)throw"No waves specified";this.dpr=window.devicePixelRatio||1,this.updateDimensions(),window.addEventListener("resize",this.updateDimensions.bind(this)),this.setupUserFunctions(),this.easeFn=i.getFn(n,this.options.ease,"linear"),this.rotation=i.degreesToRadians(this.options.rotate),i.isType(this.options.running,"boolean")&&(this.running=this.options.running),this.setupWaveFns(),this.loop()}function b(a,b){return i.isType(a,"number")?a:(a=a.toString(),a.indexOf("%")>-1?(a=parseFloat(a),a>1&&(a/=100),b*a):a.indexOf("px")>-1?parseInt(a,10):void 0)}Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e});for(var c=["ms","moz","webkit","o"],d=0;d0?1:-1},o.square=function(a){return o.sign(Math.sin(a*g))},o.sawtooth=function(a){return 2*(a-Math.floor(a+.5))},o.triangle=function(a){return Math.abs(o.sawtooth(a))},a.prototype.options={speed:10,rotate:0,ease:"Linear",wavesWidth:"95%"},a.prototype.setupWaveFns=function(){for(var a=-1,b=this.waves.length;++a0&&(this.ctx.translate(this.width/2,this.height/2),this.ctx.rotate(this.rotation),this.ctx.translate(-this.width/2,-this.height/2));++b minute && timeSince < hour ) { + timeAgo = Math.ceil(timeSince / minute); + timeTag = ' MIN'; + } else if (timeSince > hour && timeSince < day ) { + timeAgo = Math.floor(timeSince / hour); + timeTag = ' HR'; + } else if (timeSince > day && timeSince < week) { + timeAgo = Math.floor(timeSince / day); + timeTag = ' DAY'; + } else if (timeSince > week && timeSince < month) { + timeAgo = Math.floor(timeSince / week); + timeTag = ' WK'; + } else if (timeSince > month && timeSince < year) { + timeAgo = Math.floor(timeSince / month); + timeTag = ' MONTH'; + } else if (timeSince > year) { + timeAgo = Math.floor(timeSince / year); + timeTag = ' YR'; + } + + let decorator = timeAgo < 2 ? ' AGO' : 'S AGO'; + return `${timeAgo} ${timeTag}${decorator}`; +} + +function populateCommentsTime(nodes) { + if (nodes) { + nodes.forEach(function(node) { + let durationTime = node.dataset.time; + let durationSeconds = Math.ceil(Date.parse(durationTime) / 1000) ; + let durationSince = calculateTimeSince(durationSeconds); + node.innerHTML = `${durationSince}`; + }); + } +} + +const durations = document.querySelectorAll('.comment_heading'); + +populateCommentsTime(durations); \ No newline at end of file diff --git a/blog/themes/hugo-swift-theme/theme.toml b/blog/themes/hugo-swift-theme/theme.toml new file mode 100644 index 0000000..f8afa29 --- /dev/null +++ b/blog/themes/hugo-swift-theme/theme.toml @@ -0,0 +1,12 @@ +name = "Swift" +license = "MIT" +licenselink = "https://github.com/onweru/hugo-swift-theme/blob/master/LICENSE.md" +description = "A simple open source theme for publishing with hugo" +homepage = "https://github.com/onweru/hugo-swift-theme" +tags = ["blog", "staticman", "simple", "dark", "minimalist", "fast", "light"] +features = ["blog", "staticman", "simple", "dark", "minimalist", "fast", "light"] +min_version = 0.42 + +[author] + name ="weru" + homepage = "https://github.com/onweru/hugo-swift-theme"