Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
seanpotts committed Jul 19, 2024
0 parents commit a6e8805
Show file tree
Hide file tree
Showing 97 changed files with 10,994 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/hugo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# https://gohugo.io/hosting-and-deployment/hosting-on-github/
# ----------------------------------------------------------------

# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.118.2
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./public

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Thumbs.db
.DS_Store
.hugo_build.lock

node_modules/
public/
resources/
Empty file added .hugo_build.lock
Empty file.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Hugo templates

A small repository of hugo templates, including layouts and shortcodes.

## Installation

* `git clone https://github.com/seanpotts/hugo-templates.git`
* `npm install`
* `hugo server --disableFastRender --logLevel info`

## Notes

### Prevent Hugo from rendering shortcodes

Shortcodes in examples are wrapped with `{{</* shortcode */>}}` instead of `{{< shortcode >}}`.

More information: https://liatas.com/posts/escaping-hugo-shortcodes/
Binary file added assets/images/favicons/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/favicons/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/favicons/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/favicons/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/favicons/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions assets/images/favicons/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
Binary file added assets/images/hugo_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions assets/scripts/accordion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Accordion toggle
// ----------------------------------------------------------------
const accordionTrigger = document.getElementsByClassName('js-accordionTrigger');
if (accordionTrigger.length) {
for (i = 0; i < accordionTrigger.length; i++) {
accordionTrigger[i].onclick = function () {
if (this.parentNode.hasAttribute('data-accordion-state')) {
this.parentNode.removeAttribute('data-accordion-state');
this.setAttribute('aria-expanded', false);
hashUnset();

} else {
this.parentNode.setAttribute('data-accordion-state', 'active');
this.setAttribute('aria-expanded', true);

var hash = '';
if (this.hasAttribute('data-id')) {
hash = decodeURI(this.getAttribute('data-id'));
} else {
hash = decodeURI(this.getAttribute('id'));
}
hashSet(hash);
}
};
}
}

// Scrolls user to proper area when link with associated hash
// is clicked. If it goes to an accordion then accordion
// becomes activated after scrolling.
// ----------------------------------------------------------------
var sidebarAccordionTrigger = document.querySelectorAll('.js-hashSet');
if (sidebarAccordionTrigger.length) {
for (i = 0; i < sidebarAccordionTrigger.length; i++) {
sidebarAccordionTrigger[i].onclick = function(e) {
e.preventDefault();

var hash = decodeURI(this.getAttribute('href').substr(1));
hashSet(hash);
document.getElementById(hash).scrollIntoView(true);
document.getElementById(hash).focus();
};
}
}
11 changes: 11 additions & 0 deletions assets/scripts/app-load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Onload checks if there is a hash in the link, and if there
// is tries to match it with an accordion to activate it.
// ----------------------------------------------------------------
if (window.location.hash) {
const hash = decodeURI(window.location.hash.substr(1));
const findHashLocation = document.querySelector('.js-accordionTrigger[data-id="' + hash + '"]');
if (findHashLocation) {
document.querySelectorAll('[data-id="' + hash + '"]')[0].setAttribute('aria-expanded', true);
document.querySelectorAll('[data-id="' + hash + '"]')[0].parentNode.setAttribute('data-accordion-state', 'active');
}
}
44 changes: 44 additions & 0 deletions assets/scripts/app-navigation-mobile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Mobile navigation
// ----------------------------------------------------------------
const navigationMobileTrigger = document.getElementsByClassName('js-navigationMobileTrigger');

if (navigationMobileTrigger.length) {
navigationMobileTrigger[0].onclick = function () {
if (this.hasAttribute('data-navigation-state')) {
this.setAttribute('aria-expanded', false);
this.removeAttribute('data-navigation-state');
document.body.removeAttribute('data-navigation-state');

} else {
this.setAttribute('aria-expanded', true);
this.setAttribute('data-navigation-state', 'active');
document.body.setAttribute('data-navigation-state', 'active');

}
};
}


// Handle resize events to reset navigation state if user goes above
// MD breakpoint (when navigation shifts).
// https://www.geeksforgeeks.org/how-to-wait-resize-end-event-and-then-perform-an-action-using-javascript/
// ----------------------------------------------------------------
var timeOutFunctionId;
var windowWidth = document.documentElement.clientWidth;

function resetNavigation() {
if (document.body.hasAttribute('data-navigation-state')) {
document.body.removeAttribute('data-navigation-state');
navigationMobileTrigger[0].removeAttribute('data-navigation-state');
document.activeElement.blur();
}
}

window.addEventListener('resize', function() {
var windowWidthResized = document.documentElement.clientWidth;
if (windowWidthResized >= 768) {
windowWidth = windowWidthResized;
clearTimeout(timeOutFunctionId);
timeOutFunctionId = setTimeout(resetNavigation, 200);
}
});
8 changes: 8 additions & 0 deletions assets/scripts/clipboard-js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let clipboard = new ClipboardJS('.js-copyButton', {
target: function(trigger) {
if (trigger.previousSibling.classList.contains('highlight')) {
// trigger.innerText = "Copied to clipboard!";
return trigger.previousSibling;
}
}
});
34 changes: 34 additions & 0 deletions assets/scripts/hash-set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Hash matching
function hashSet(hash) {
if (hash) {
// Only hashes if useful to hash. Otherwise resets page hashing.
if (hash !== 'start-of-page' && hash !== 'start-of-content' && hash !== 'table-of-contents') {
window.history.replaceState('', '', window.location.pathname + '#' + hash);
} else {
window.history.replaceState('', '', window.location.pathname);
}


// If element clicked is a button then focus it, otherwise focus the above element,
// which should always be an anchor.

// Typical buttons
if (document.getElementById('id-' + hash)) {
document.getElementById('id-' + hash).parentNode.setAttribute('data-accordion-state', 'active');

// Make better sometime. Vocabulary and verbs pages have hidden buttons at :md so
// can't focus them. Fix below will check for md:hidden class and focus button or
// link based on that.
if (document.getElementById('id-' + hash).classList.contains('md:hidden')) {
document.getElementById(hash).parentNode.focus();
} else {
document.getElementById('id-' + hash).focus();
}

// Link
} else {
document.getElementById(hash).parentNode.focus();
}
}
}
hashSet();
5 changes: 5 additions & 0 deletions assets/scripts/hash-unset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Remove URL ID hash if accordion button is closed
function hashUnset() {
url = window.location.href.split('#')[0];
window.history.replaceState('', '', url);
}
Loading

0 comments on commit a6e8805

Please sign in to comment.