Skip to content

Instantly share code, notes, and snippets.

View damien1's full-sized avatar

Damien Saunders damien1

View GitHub Profile
@damien1
damien1 / ga-tag.html
Last active July 14, 2020 21:34
Google Analytics Event Tracking Shortcode for Hugo go to https://damien.co https://bit.ly/2CaakSY for details example to use {{< ga-tag href="https://damien.co/blog" ga1=Outbound ga2=Gist ga3=demo text="click me" >}}
<!-- for details on usage vist my site https://bit.ly/2CaakSY -->
{{ $url := .Get "href" }}
{{ $ga1 := .Get "ga1" }}
{{ $ga2 := .Get "ga2" }}
{{ $ga3 := .Get "ga3" }}
{{ $text := .Get "text" }}
<!-- use this for analytics.js -->
<!-- <a onclick="ga('send', 'event', '{{ $ga1 }}', '{{ $ga2 }}', '{{ $ga3 }}');" href="{{ $url }}" target="_blank">{{ $text }}</a> -->
<!-- use this with gtag newer tracking code -->
<a onclick="gtag('event', '{{ $ga1 }}', {'event_category': '{{ $ga2 }}', 'event_label': '{{ $ga3 }}'});" href="{{ $url }}" target="_blank">{{ $text }}</a>
@damien1
damien1 / cld-response.html
Last active August 10, 2021 17:30
Hugo shortcode responsive image using Cloudinary - how to use see https://bit.ly/2YYrjRd
<!-- for how to use visit https://bit.ly/2YYrjRd -->
{{ $image := .Get 0 }}
{{ $alt := .Get 1 }}
{{ $width := .Get 2 | default "w_auto" }}
{{ $style := .Get 3 | default "width:90%" }}
<img alt="{{ $alt }}" title="{{ $alt }}" data-src="{{ $.Site.Params.cloudinary_base_url }}/{{ $width }},c_scale,f_auto,q_auto,dpr_auto{{ $image}}" class="cld-responsive border" style="{{ $style }}">
@damien1
damien1 / typography.html
Last active January 24, 2024 22:01
Hugo Shortcode add Google Fonts and style to selected text. Visit my site for details https://bit.ly/31PSv6d example: {{< typography font="monoton" size="100px" style="italic" >}}You are awesome. You're even better! {{< /typography >}}
<!-- for usage details visit https://bit.ly/31PSv6d -->
{{ $font := .Get "font" }}
{{ $size := .Get "size" }}
{{ $style := .Get "style" | default "normal" }}
{{ $weight := .Get "weight" | default "normal" }}
<link href="https://fonts.googleapis.com/css?family={{ $font }}" rel="stylesheet" type="text/css">
<div style="font-family:'{{ $font }}'; font-size:{{ $size }}; font-style:{{ $style}}; font-weight:{{ $weight }}">
{{- .Inner -}}
</div>
@damien1
damien1 / related-tag.html
Last active June 14, 2020 16:49
Hugo shortcode related posts - just need to specify the tag and how many posts. example {{< related count=3 tag=hugo >}}
@damien1
damien1 / featured-param.html
Last active June 14, 2020 12:30
Hugo Featured Content - using front matter param. example {{< featured-param count=2 >}}
@damien1
damien1 / featured.html
Last active June 14, 2020 12:31
Hugo Featured Posts Shortcode example {{< featured count=6 >}}
@damien1
damien1 / .gitignore
Last active July 22, 2020 07:17
Basic Hugo .gitignore template
# Basic gitignore template for Hugo SSG - which has some stuff for WordPress migration
#
# This is a template .gitignore file for git-managed Hugo projects.
#
# Fact: you don't want Hugo core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Ignore everything in the root except the "content" directory and "static"
/*
!.gitignore
@damien1
damien1 / group_permissions_chmod
Last active August 29, 2015 13:57
Mac / *Nix -- Apache fix file and directory permissions - group read/write
sudo find . -type d -exec chmod 775 {} \;
sudo find . -type f -exec chmod 664 {} \;
@damien1
damien1 / new_gist_file.txt
Created March 19, 2014 16:16
Mac / *Nix -- Apache fix file and directory permissions - single user
sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;
@damien1
damien1 / .gitignore
Created May 19, 2013 21:53 — forked from redoPop/.gitignore
WordPress Gitignore file
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your