hugo

Docker - Traefik - HugoBlog

Intro as i’m playing with traefik & docker, why not duplicate this blog in container ? for fun and profit ? let’s give at try … pre-condition you have traefik running and a wildcard certificate for a domain. see the previous posts … docker compose cat << 'EOF' > docker-compose.yml version: '3' services: hugo: image: jakejarvis/hugo-extended:latest ports: - 1313:1313 volumes: - ./src:/src command: server --buildDrafts --buildFuture --bind 0.0.0.0 restart: always networks: - traefik labels: - "traefik.

Hugo - Start

GoHugo from Scratch https://gohugo.io/ Take a fresh VM with OpenBSD ;) otherwise, you have to adapt appropriate … install pkg Login as User which is part of the “wheel group”. Doas should allow all Users of the Wheel Group to get root. doas pkg_add hugo-- nginx-- adduser webmaster create a user “webmaster” and prepare virtual directories doas adduser webmaster doas mkdir /var/www/virtual doas chown webmaster /var/www/virtual/ Update Nginx we need to modify nginx, prepare a site folder and a basic config for the webserver.

Hugo Copy Button

I like Websites with the Copy Button for certain Snippets. Why not integrate into the own Blog ? Folder, Copy JS Stuff Change to Hugo Root Folder mkdir -p static/js/ cat << 'EOF' > static/js/copy-code.js (function() { 'use strict'; if(!document.queryCommandSupported('copy')) { return; } function flashCopyMessage(el, msg) { el.textContent = msg; setTimeout(function() { el.textContent = "Copy"; }, 1000); } function selectText(node) { var selection = window.getSelection(); var range = document.createRange(); range.selectNodeContents(node); selection.

Comments

just trying a new feature for leaving comments … it’s selfhosted, done with isso and quite painfull to install :( some people may like to provide feedback, ask questions, … sha256: fed502f0a96744470fa42b910138efed8d462ce13a2f5329c61ad23fc133281e

Hugo Forms PHP

Wanna add some simple forms and process the Content with PHP ? Add RawHTML Template if not yet done mkdir layouts/shortcodes/ cat << 'EOF' > layouts/shortcodes/rawhtml.html <!-- raw html --> {{.Inner}} EOF Create Script cat << 'EOF' > static/welcome.php <html> <body> Welcome <?php echo $_POST["name"]; ?><br> Your email address is: <?php echo $_POST["email"]; ?> </body> </html> EOF Create new Post and add rawhtml without " " between { and {

HugoIO Templates

Custom Template Stuff mkdir -p layouts/shortcodes cat << 'EOF' > layouts/shortcodes/date.html {{ now.Format "2006-01-02 03:04:05" }} EOF Insert Code in Template current date ? { {< date >} } Result ? current date ?? 2022-12-02 11:27:48 Add RawHTML Create Template cat << 'EOF' > layouts/shortcodes/rawhtml.html <!-- raw html --> {{.Inner}} EOF Add Code { {< rawhtml >} } <p class="speshal-fancy-custom"> This is <strong>raw HTML</strong>, inside Markdown. </p> { {< /rawhtml >} } Result ?

Update_hugo

how to update hugo you can use ports (pkg_add hugo) and get the lastest stable hugo package based on OpenBSD release cycles (2 x year), or grab the latest binary from github and put it on your machine. Releases: https://github.com/gohugoio/hugo/releases cd /tmp ftp https://github.com/gohugoio/hugo/releases/download/v0.62.0/hugo_0.62.0_OpenBSD-64bit.tar.gz tar xfz hugo_0.62.0_OpenBSD-64bit.tar.gz doas mv hugo /usr/local/bin/ or find latest automatically doas su - cd /tmp/ u=$(lynx -dump -listonly https://github.com/gohugoio/hugo/releases/latest |grep "OpenBSD-64bit" |sed 's/.*https/https/') f=$(echo $u |sed 's/.