diff options
author | Chad Tindel <chad@tindel.net> | 2022-02-22 18:34:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 18:34:20 +0300 |
commit | 570e3a53b1c8d6ebecafa97d70742fd5bb380279 (patch) | |
tree | 79681a018cc54cfe7d030e5b3b108ce949ee072d | |
parent | 608104b2117646a45392ef4f7acc3e73dbfd1f5d (diff) |
Add support for full social URLs and Youtube Subscription Link in Jumbotron (#368)
-rw-r--r-- | REFERENCE.md | 11 | ||||
-rw-r--r-- | exampleSite/config.toml | 10 | ||||
-rw-r--r-- | exampleSite/content/guest/ajohnston2.md | 6 | ||||
-rw-r--r-- | exampleSite/content/host/mstratton.md | 2 | ||||
-rw-r--r-- | layouts/guest/list.html | 28 | ||||
-rw-r--r-- | layouts/guest/single.html | 36 | ||||
-rw-r--r-- | layouts/host/single.html | 36 | ||||
-rw-r--r-- | layouts/partials/footer_scripts.html | 10 | ||||
-rw-r--r-- | layouts/partials/header.html | 26 | ||||
-rw-r--r-- | layouts/partials/hosts.html | 20 | ||||
-rw-r--r-- | layouts/partials/jumbotron.html | 108 | ||||
-rw-r--r-- | layouts/partials/seo.html | 18 | ||||
-rw-r--r-- | layouts/partials/social-link.html | 16 |
13 files changed, 167 insertions, 160 deletions
diff --git a/REFERENCE.md b/REFERENCE.md index 12cd869..721492c 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -60,6 +60,7 @@ These should be set under the `[params]` section: | `soundcloud_subscribe` | No | The URL to your podcast's feed on Soundcloud | "http://feeds.soundcloud.com/users/soundcloud:users:203144248/sounds.rss" | | `pocketcasts_subscribe` | No | The URL to your podcast's feed on Pocketcasts | "http://pcasts.in/feed/feeds.soundcloud.com/users/soundcloud:users:203144248/sounds.rss" | | `spotify_subscribe` | No | The URL to your podcast's page on Spotify | "https://open.spotify.com/show/7hHA2ZlfOmbwv96wEBaMR2?si=UeVjoWIVSqqLluJd4TlEUg" | +| `youtube_subscribe` | No | The URL to subscribe your podcast's channel on Spotify | "https://www.youtube.com/arresteddevops?sub_confirmation=1" | | `mailchimp_subscribe` | No | The URL for your MailChimp signup form. This can be acquired from creating a "Super Slim" Embedded form on MailChimp. Do NOT include the entire form HTML; you just need the path for the `form action`. | "//arresteddevops.us3.list-manage.com/subscribe/post?u=5e4cbcac996bb9df25f970a89&id=154fa76bcc" | | `rss_subscribe` | No | Optional parameter to over-ride the RSS feed URL, in case you use something like Feedburner. You likely do NOT need to set this parameter unless you have a very good reason to do so. | "http://feeds.podtrac.com/VGAulpN7MY1U" | | `description` | Yes | Description of your show. Can use Markdown. | `"The HugoCast is the best podcast you've ever seen. You will learn everything you ever needed to know about [podcasting](https://en.wikipedia.org/wiki/Podcast) from the most inspiring experts to ever show up on the whole internet."` | @@ -99,7 +100,7 @@ Refer to https://realfavicongenerator.net/ for more details. ### Social Parameters -These are the social network parameters for your overall site. They should be set under `[params.social]` +These are the social network parameters for your overall site. They should be set under `[params.social]` and all of them allow either the short form (e.g. just your twitter handle) where the theme will construct the URL or the full URL beginning with https:// | Field Name | Required | Description | Example | |------------------|----------|------------------------------------------------------------------------------------------------------------------|----------------------| @@ -137,7 +138,7 @@ We use the "authors" from the configuration to list hosts in the jumbotron or si TODO: Remove these parameters from exampleSite, but also add one for the the shortname of the host for linking to host page (optional) -You also will set the social parameters (all are optional) under `[params.authors.USERNAME.social]` +You also will set the social parameters (all are optional) under `[params.authors.USERNAME.social]` and all of them allow either the short form (e.g. just your twitter handle) where the theme will construct the URL or the full URL beginning with https:// | Field Name | Required | Description | Example | |-------------|----------|------------------------------------------------------------------------------------------------------------------|--------------------------------| @@ -245,12 +246,12 @@ Example: identifier = "podcasts" url = "books" parent = "resources" - + ``` ### Podlove Subscribe Button -[Podlove Subscribe Button](https://subscribe-button.podlove.org/) is a universal and easy-to-use button, to subscribe to podcasts with player clients or website players. +[Podlove Subscribe Button](https://subscribe-button.podlove.org/) is a universal and easy-to-use button, to subscribe to podcasts with player clients or website players. To customize your button please add the following section to your `config.toml`, which covers all features which are provided by the generator on [subscribe-button.podlove.org](https://subscribe-button.podlove.org/). ``` @@ -375,7 +376,7 @@ Graphical user interface influencer value proposition startup hackathon iPad ana | `tags[]` | No | If you are using taxonomies, this is the array of tags for the epsiode. | ["VR", "Technology"] | ### Upcoming Episodes -If you would like to display upcoming episodes, you need to do a couple things. First, you will need to create a page where the upcoming episodes will be listed. You can check out `exampleSite` for an example, but basically, you want to create `content/upcoming/_index.md`. +If you would like to display upcoming episodes, you need to do a couple things. First, you will need to create a page where the upcoming episodes will be listed. You can check out `exampleSite` for an example, but basically, you want to create `content/upcoming/_index.md`. Any episodes that have `upcoming` in their frontmatter set to `true` will be listed here, but not listed on any other pages (feed, home page, guest pages, etc). Additionally, episodes that are marked as "upcoming" will not display a YouTube video or audio player, even if those parameters are set. diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 57e1962..de92fea 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -84,6 +84,7 @@ enable_jumbo = "true" # truncate = "100" # about_logo = "/img/hugocast.png" copyright_notice = "Copyright 2016 [Matt Stratton](https://www.mattstrattion.io)" +youtube_subscribe = "https://www.youtube.com/arresteddevops?sub_confirmation=1" itunes_subscribe = "https://podcasts.apple.com/us/podcast/arrested-devops/id773888088?ign-mpt=uo%3D4&mt=2" android_subscribe = "http://subscribeonandroid.com/feeds.podtrac.com/VGAulpN7MY1U" spotify_subscribe = "https://open.spotify.com/show/..." @@ -127,18 +128,21 @@ disqusShortname = "" subscribe_feed_type = "audio" # options: audio, video subscribe_feed_format = "mp3" # options: mp3, aac, ogg, opus + # Social links can be given in full URL form or short form + # In the short form the theme will generate a relevant URL [params.social] github = "arresteddevops" gitlab = "mattstratton" facebook = "Arresteddevops" facebook_admin = ["500557137","1234"] # This needs to be one or more page admins to get domain insights - twitter = "arresteddevops" + twitter = "https://twitter.com/arresteddevops" twitter_domain = "arresteddevops.com" # This domain shows in twitter cards as "View on `twitter_domain`" - googleplus = "ArrestedDevOps" pinterest = "nozzleio" instagram = "nozzleio" youtube = "arresteddevops" - linkedin = "mattstratton" + # Short form in linkedin will link to a user's page so use long form for company pages + linkedin = "https://www.linkedin.com/company/linkedin/" + #linkedin = "mattstratton" twitch = "mattstratton" [params.authors] diff --git a/exampleSite/content/guest/ajohnston2.md b/exampleSite/content/guest/ajohnston2.md index 8764f53..d17be8b 100644 --- a/exampleSite/content/guest/ajohnston2.md +++ b/exampleSite/content/guest/ajohnston2.md @@ -1,11 +1,11 @@ +++ Title = "Alan Johnston" date = "2020-02-10T09:12:39-05:00" -Twitter = "@deserunt" +Twitter = "https://twitter.com/deserunt" Website = "http://Agimba.info" Type = "guest" Facebook = "adipisci" -Linkedin = "ut" +Linkedin = "https://www.linkedin.com/in/ut" Pronouns = "" GitHub = "tempora" Thumbnail = "img/guest/ajohnston.jpg" @@ -14,4 +14,4 @@ Instagram = "" YouTube = "" guest_group = "ajohnston" +++ -this is the newer version of Alan
\ No newline at end of file +this is the newer version of Alan diff --git a/exampleSite/content/host/mstratton.md b/exampleSite/content/host/mstratton.md index bf16cf4..23118db 100644 --- a/exampleSite/content/host/mstratton.md +++ b/exampleSite/content/host/mstratton.md @@ -5,7 +5,7 @@ Twitter = "mattstratton" Website = "http://www.google.com/" Type = "host" Facebook = "" -Linkedin = "mattstratton" +Linkedin = "https://www.linkedin.com/in/mattstratton" Pronouns = "He/Him" GitHub = "mattstratton" Thumbnail = "img/host/matt.png" diff --git a/layouts/guest/list.html b/layouts/guest/list.html index 5f752ff..33aa9d1 100644 --- a/layouts/guest/list.html +++ b/layouts/guest/list.html @@ -14,7 +14,7 @@ {{- end -}} <div class = "row"> <div class = "col"> - + {{ $paginator := .Paginate (where .Data.Pages.ByTitle "Type" "guest") }} {{ range $paginator.Pages }} {{- $.Scratch.Set "guest-name" .File.BaseFileName -}} @@ -46,28 +46,28 @@ <a href = "{{ . }}"><i class="fas fa-home fa-2x"></i></a> {{ end }} {{ with .Params.Twitter }} - <a href = "https://twitter.com/{{ . }}"><i class="fab fa-twitter-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-twitter-square fa-2x" "prefix" "https://twitter.com/" "text" "") }} {{ end }} {{ with .Params.GitHub}} - <a href = "https://github.com/{{ . }}"><i class="fab fa-github-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-github-square fa-2x" "prefix" "https://github.com/" "text" "") }} {{ end }} {{ with .Params.LinkedIn }} - <a href = "https://www.linkedin.com/in/{{ . }}/"><i class="fab fa-linkedin fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-linkedin fa-2x" "prefix" "https://www.linkedin.com/in/" "text" "") }} {{ end }} {{ with .Params.Facebook }} - <a href = "https://www.facebook.com/{{ . }}"><i class="fab fa-facebook-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-facebook-square fa-2x" "prefix" "https://www.facebook.com/" "text" "") }} {{ end }} {{ with .Params.Pinterest }} - <a href = "https://www.pinterest.com/{{ . }}"><i class="fab fa-pinterest-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-pinterest-square fa-2x" "prefix" "https://www.pinterest.com/" "text" "") }} {{ end }} {{ with .Params.Instagram }} - <a href = "https://www.instagram.com/{{ . }}"><i class="fab fa-instagram fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-instagram-square fa-2x" "prefix" "https://www.instagram.com/" "text" "") }} {{ end }} {{ with .Params.YouTube }} - <a href = "https://www.youtube.com/{{ . }}"><i class="fab fa-youtube-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-youtube-square fa-2x" "prefix" "https://www.youtube.com/" "text" "") }} {{ end }} {{ with .Params.Twitch }} - <a href = "https://twitch.tv/{{ . }}"><i class="fab fa-twitch fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-twitch fa-2x" "prefix" "https://twitch.tv/" "text" "") }} {{ end }} </div> </div> @@ -114,15 +114,15 @@ {{- end -}} {{ end }} {{ end }} - - + + <!-- prev page button --> {{- with $paginator.HasPrev -}} <li class="page-item"> <a href="{{ $paginator.Prev.URL }}" class="page-link"> « </a> </li> {{ end }} - + <!-- page # buttons --> {{ range $pag.Pagers }} {{ $cur := .PageNumber }} @@ -133,14 +133,14 @@ <li class="disabled page-item"><a name="" class="page-link hidden-md-down">…</a></li> {{ end }} {{ end }} - + <!-- next page button --> {{- with $paginator.HasNext -}} <li class="page-item"> <a href="{{ $paginator.Next.URL }}" class="page-link"> » </a> </li> {{ end }} - + <!-- last page button --> {{ if lt $paginator.PageNumber (sub $paginator.TotalPages 1) }} {{- with $paginator.Last -}} diff --git a/layouts/guest/single.html b/layouts/guest/single.html index e4d851b..755ac17 100644 --- a/layouts/guest/single.html +++ b/layouts/guest/single.html @@ -35,44 +35,28 @@ </a> {{ end }} {{ if .Params.Twitter }} - <a href="https://twitter.com/{{ .Params.Twitter }}"> - <i class="fab fa-twitter-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.Twitter "aclass" "" "iclass" "fab fa-twitter-square fa-2x" "prefix" "https://twitter.com/" "text" "") }} {{ end }} {{ if .Params.GitHub }} - <a href="https://github.com/{{ .Params.GitHub}}"> - <i class="fab fa-github-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.GitHub "aclass" "" "iclass" "fab fa-github-square fa-2x" "prefix" "https://github.com/" "text" "") }} {{ end }} {{ if .Params.LinkedIn }} - <a href="https://www.linkedin.com/in/{{ .Params.LinkedIn}}/"> - <i class="fab fa-linkedin fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.LinkedIn "aclass" "" "iclass" "fab fa-linkedin fa-2x" "prefix" "https://www.linkedin.com/in/" "text" "") }} {{ end }} {{ if .Params.Facebook }} - <a href="https://www.facebook.com/{{ .Params.Facebook}}"> - <i class="fab fa-facebook-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.Facebook "aclass" "" "iclass" "fab fa-facebook-square fa-2x" "prefix" "https://www.facebook.com/" "text" "") }} {{ end }} {{ if .Params.Pinterest }} - <a href="https://www.pinterest.com/{{ .Params.Pinterest}}"> - <i class="fab fa-pinterest-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.Pinterest "aclass" "" "iclass" "fab fa-pinterest-square fa-2x" "prefix" "https://www.pinterest.com/" "text" "") }} {{ end }} {{ if .Params.Instagram }} - <a href="https://www.instagram.com/{{ .Params.Instagram}}"> - <i class="fab fa-instagram fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.Instagram "aclass" "" "iclass" "fab fa-instagram-square fa-2x" "prefix" "https://www.instagram.com/" "text" "") }} {{ end }} {{ if .Params.YouTube }} - <a href="https://www.youtube.com/{{ .Params.YouTube}}"> - <i class="fab fa-youtube-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.YouTube "aclass" "" "iclass" "fab fa-youtube-square fa-2x" "prefix" "https://www.youtube.com/" "text" "") }} {{ end }} {{ if .Params.Twitch }} - <a href="https://www.twitch.tv/{{ .Params.Twitch}}"> - <i class="fab fab fa-twitch fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.Twitch "aclass" "" "iclass" "fab fa-twitch fa-2x" "prefix" "https://twitch.tv/" "text" "") }} {{ end }} </div> </div> @@ -97,7 +81,7 @@ {{- $.Scratch.Add "guest-names" (slice $names) -}} {{- end -}} {{- end -}} - + {{- else -}} {{ $.Scratch.Set "guest-names" (slice .File.BaseFileName) }} {{- end -}} @@ -109,7 +93,7 @@ {{- range $page.Params.guests -}} {{- if eq . ($.Scratch.Get "guest-name") -}} {{ if and (isset $.Site.Params "episode_number_style") ($page.Params.episode)}} - {{ if eq $.Site.Params.episode_number_style "parens" }} + {{ if eq $.Site.Params.episode_number_style "parens" }} <a href="{{ $page.Permalink }}" class= "guest_page_episode_link list-group-item list-group-item-action">{{ $page.Title }} ({{ with $.Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ $page.Params.episode }})</a> {{ else if eq $.Site.Params.episode_number_style "brackets" }} <a href="{{ $page.Permalink }}" class= "guest_page_episode_link list-group-item list-group-item-action">{{ $page.Title }} [{{ with $.Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ $page.Params.episode }}]</a> diff --git a/layouts/host/single.html b/layouts/host/single.html index 0b000c6..ee8992c 100644 --- a/layouts/host/single.html +++ b/layouts/host/single.html @@ -34,45 +34,29 @@ </a> {{ end }} {{ if .Params.Twitter }} - <a href="https://twitter.com/{{ .Params.Twitter }}"> - <i class="fab fa-twitter-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.Twitter "iclass" "fab fa-twitter-square fa-2x" "prefix" "https://twitter.com/" "text" "") }} {{ end }} {{ if .Params.GitHub }} - <a href="https://github.com/{{ .Params.GitHub}}"> - <i class="fab fa-github-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.GitHub "iclass" "fab fa-github-square fa-2x" "prefix" "https://github.com/" "text" "") }} {{ end }} {{ if .Params.LinkedIn }} - <a href="https://www.linkedin.com/in/{{ .Params.LinkedIn}}/"> - <i class="fab fa-linkedin fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.LinkedIn "iclass" "fab fa-linkedin fa-2x" "prefix" "https://www.linkedin.com/in/" "text" "") }} {{ end }} {{ if .Params.Facebook }} - <a href="https://www.facebook.com/{{ .Params.Facebook}}"> - <i class="fab fa-facebook-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.Facebook "iclass" "fab fa-facebook-square fa-2x" "prefix" "https://www.facebook.com/" "text" "") }} {{ end }} {{ if .Params.Pinterest }} - <a href="https://www.pinterest.com/{{ .Params.Pinterest}}"> - <i class="fab fa-pinterest-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.Pinterest "iclass" "fab fa-pinterest-square fa-2x" "prefix" "https://www.pinterest.com/" "text" "") }} {{ end }} {{ if .Params.Instagram }} - <a href="https://www.instagram.com/{{ .Params.Instagram}}"> - <i class="fab fa-instagram fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.Instagram "iclass" "fab fa-instagram-square fa-2x" "prefix" "https://www.instagram.com/" "text" "") }} {{ end }} {{ if .Params.YouTube }} - <a href="https://www.youtube.com/{{ .Params.YouTube}}"> - <i class="fab fa-youtube-square fa-2x"></i> - </a> + {{ partial "social-link.html" (dict "context" .Params.YouTube "iclass" "fab fa-youtube-square fa-2x" "prefix" "https://www.youtube.com/" "text" "") }} {{ end }} {{ if .Params.Twitch }} - <a href="https://twitch.tv/{{ .Params.Twitch}}"> - <i class="fab fa-twitch fa-2x"></i> - </a> - {{ end }} + {{ partial "social-link.html" (dict "context" .Params.Twitch "iclass" "fab fa-twitch fa-2x" "prefix" "https://twitch.tv/" "text" "") }} + {{ end }} </div> </div> </div> @@ -88,7 +72,7 @@ {{ range $page.Params.hosts }} {{ if eq . ($.Scratch.Get "host-name") }} {{ if and (isset $.Site.Params "episode_number_style") ($page.Params.episode)}} - {{ if eq $.Site.Params.episode_number_style "parens" }} + {{ if eq $.Site.Params.episode_number_style "parens" }} <a href="{{ $page.Permalink }}" class= "guest_page_episode_link list-group-item list-group-item-action">{{ $page.Title }} ({{ with $.Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ $page.Params.episode }})</a> {{ else if eq $.Site.Params.episode_number_style "brackets" }} <a href="{{ $page.Permalink }}" class= "guest_page_episode_link list-group-item list-group-item-action">{{ $page.Title }} [{{ with $.Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ $page.Params.episode }}]</a> diff --git a/layouts/partials/footer_scripts.html b/layouts/partials/footer_scripts.html index 9227ccf..bf2c464 100644 --- a/layouts/partials/footer_scripts.html +++ b/layouts/partials/footer_scripts.html @@ -10,8 +10,16 @@ share: "twitter", // name of share label: "Tweet", // share button text (optional) logo: "fab fa-twitter", + // The twitter link can be based in short ("arresteddevops") or + // long form ("https://twitter.com/arresteddevops") + // In long form we need to strip everything but the twitter handle + // for the 'via' parameter {{ if (isset .Site.Params.social "twitter" )}} - via: "{{ .Site.Params.social.twitter }}", // custom twitter sharing param 'via' (optional) + {{ if gt (len (urls.Parse .Site.Params.social.twitter).Scheme) 0 }} + via: "{{ trim ((urls.Parse .Site.Params.social.twitter).Path) "/" }}", // custom twitter sharing param 'via' (optional) + {{ else }} + via: "{{ .Site.Params.social.twitter }}", // custom twitter sharing param 'via' (optional) + {{ end }} {{ end }} url: "{{ .Permalink }}", text: "{{ title .Title }}" diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 5a2f35c..bbbd5b5 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -29,56 +29,50 @@ {{ end }} </ul> - <ul class="navbar-nav ml-auto"> {{ if (isset .Site.Params.social "facebook" ) }} - <li class = "nav-item"> - <a class = "social-links" href="https://facebook.com/{{ .Site.Params.social.facebook }}"><i class="fab fa-facebook-square fa-2x"></i></a> + <li class> + {{ partial "social-link.html" (dict "context" $.Site.Params.social.facebook "aclass" "social-links" "iclass" "fab fa-facebook-square fa-2x" "prefix" "https://www.facebook.com/" "text" "") }} </li> {{ end }} {{ if (isset .Site.Params.social "twitter" ) }} <li> - <a class = "social-links" href="https://twitter.com/{{ .Site.Params.social.twitter }}"><i class="fab fa-twitter-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" $.Site.Params.social.twitter "aclass" "social-links" "iclass" "fab fa-twitter-square fa-2x" "prefix" "https://twitter.com/" "text" "") }} </li> {{ end }} {{ if (isset .Site.Params.social "youtube" ) }} <li> - <a class = "social-links" href="https://youtube.com/{{ .Site.Params.social.youtube }}"><i class="fab fa-youtube-square fa-2x"></i></a> - </li> - {{ end }} - {{ if (isset .Site.Params.social "googleplus" ) }} - <li> - <a class = "social-links" href="https://plus.google.com/+{{ .Site.Params.social.googleplus }}"><i class="fab fa-google-plus-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" $.Site.Params.social.youtube "aclass" "social-links" "iclass" "fab fa-youtube-square fa-2x" "prefix" "https://youtube.com/" "text" "") }} </li> {{ end }} {{ if (isset .Site.Params.social "pinterest" ) }} <li> - <a class = "social-links" href="https://www.pinterest.com/{{ .Site.Params.social.pinterest }}"><i class="fab fa-pinterest-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" $.Site.Params.social.pinterest "aclass" "social-links" "iclass" "fab fa-pinterest-square fa-2x" "prefix" "https://www.pinterest.com/" "text" "") }} </li> {{ end }} {{ if (isset .Site.Params.social "instagram" ) }} <li> - <a class = "social-links" href="https://www.instagram.com/{{ .Site.Params.social.instagram }}"><i class="fab fa-instagram fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" $.Site.Params.social.instagram "aclass" "social-links" "iclass" "fab fa-instagram-square fa-2x" "prefix" "https://www.instagram.com/" "text" "") }} </li> {{ end }} {{ if (isset .Site.Params.social "linkedin" ) }} <li> - <a class = "social-links" href="https://www.linkedin.com/in{{ .Site.Params.social.linkedin }}/"><i class="fab fa-linkedin fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" $.Site.Params.social.linkedin "aclass" "social-links" "iclass" "fab fa-linkedin fa-2x" "prefix" "https://www.linkedin.com/in/" "text" "") }} </li> {{ end }} {{ if (isset .Site.Params.social "github" ) }} <li> - <a class = "social-links" href="https://github.com/{{ .Site.Params.social.github }}"><i class="fab fa-github-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" $.Site.Params.social.github "aclass" "social-links" "iclass" "fab fa-github-square fa-2x" "prefix" "https://github.com/" "text" "") }} </li> {{ end }} {{ if (isset .Site.Params.social "gitlab" ) }} <li> - <a class = "social-links" href="https://gitlab.com/{{ .Site.Params.social.gitlab }}"><i class="fab fa-gitlab fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" $.Site.Params.social.gitlab "aclass" "social-links" "iclass" "fab fa-gitlab fa-2x" "prefix" "https://gitlab.com/" "text" "") }} </li> {{ end }} {{ if (isset .Site.Params.social "twitch" ) }} <li> - <a class = "social-links" href="https://twitch.tv/{{ .Site.Params.social.twitch }}"><i class="fab fa-twitch fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" $.Site.Params.social.twitch "aclass" "social-links" "iclass" "fab fa-twitch fa-2x" "prefix" "https://twitch.tv/" "text" "") }} </li> {{ end }} </ul> diff --git a/layouts/partials/hosts.html b/layouts/partials/hosts.html index 79f1e1a..bd607e3 100644 --- a/layouts/partials/hosts.html +++ b/layouts/partials/hosts.html @@ -27,33 +27,33 @@ <a href = "{{ . }}"><i class="fas fa-home fa-2x"></i></a> {{ end }} {{ with .Params.Twitter }} - <a href = "https://twitter.com/{{ . }}"><i class="fab fa-twitter-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-twitter-square fa-2x" "prefix" "https://twitter.com/") }} {{ end }} {{ with .Params.GitHub}} - <a href = "https://github.com/{{ . }}"><i class="fab fa-github-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-github-square fa-2x" "prefix" "https://github.com/") }} {{ end }} {{ with .Params.LinkedIn }} - <a href = "https://www.linkedin.com/in/{{ . }}/"><i class="fab fa-linkedin fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-linkedin fa-2x" "prefix" "https://www.linkedin.com/in/") }} {{ end }} {{ with .Params.Facebook }} - <a href = "https://www.facebook.com/{{ . }}"><i class="fab fa-facebook-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-facebook-square fa-2x" "prefix" "https://www.facebook.com/") }} {{ end }} {{ with .Params.Pinterest }} - <a href = "https://www.pinterest.com/{{ . }}"><i class="fab fa-pinterest-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-pinterest-square fa-2x" "prefix" "https://www.pinterest.com/") }} {{ end }} {{ with .Params.Instagram }} - <a href = "https://www.instagram.com/{{ . }}"><i class="fab fa-instagram fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-instagram-square fa-2x" "prefix" "https://www.instagram.com/") }} {{ end }} {{ with .Params.YouTube }} - <a href = "https://www.youtube.com/{{ . }}"><i class="fab fa-youtube-square fa-2x"></i></a> + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-youtube-square fa-2x" "prefix" "https://www.youtube.com/") }} {{ end }} {{ with .Params.Twitch }} - <a href = "https://twitch.tv/{{ . }}"><i class="fab fa-twitch fa-2x"></i></a> - {{ end }} + {{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-twitch fa-2x" "prefix" "https://twitch.tv/") }} + {{ end }} </div> </div> {{- end -}} {{- end -}} {{ end }} </div> - </div>
\ No newline at end of file + </div> diff --git a/layouts/partials/jumbotron.html b/layouts/partials/jumbotron.html index fa0188b..1bc3033 100644 --- a/layouts/partials/jumbotron.html +++ b/layouts/partials/jumbotron.html @@ -17,7 +17,6 @@ </div> - <div class = "row"> {{ if (isset .Site.Params "podlove") }} <div class = "d-flex p-2 subscribe_buttons col-md-auto"> @@ -28,58 +27,61 @@ {{ end }} </div> <div class = "row"> - {{ if (isset .Site.Params "spotify_subscribe") }} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default" href="{{ .Site.Params.spotify_subscribe}}"><i class="fab fa-spotify"></i> Spotify</a> - </div> - {{ end }} - {{ if (isset .Site.Params "itunes_subscribe") }} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default" href="{{ .Site.Params.itunes_subscribe}}"><i class="fa fa-podcast"></i> Apple Podcasts</a> - </div> - {{ end }} - {{ if (isset .Site.Params "android_subscribe") }} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default subscribe_buttons" href="{{ .Site.Params.android_subscribe }}"><i class="fab fa-android"></i> Android</a> - </div> - {{ end }} - {{ if (isset .Site.Params "google_play_subscribe") }} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default" href="{{ .Site.Params.google_play_subscribe }}"><i class="fab fa-google-play"></i> Google Podcasts</a> - </div> - {{ end }} - {{ with .Site.Params.stitcher_subscribe }} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default" href="{{ . }}"><i class="fa fa-podcast"></i> Stitcher</a> - </div> - {{ end }} - {{ if (isset .Site.Params "soundcloud_subscribe") }} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default" href="{{ .Site.Params.soundcloud_subscribe }}"><i class="fab fa-soundcloud"></i> Soundcloud</a> - </div> - {{ end }} - {{ if (isset .Site.Params "pocketcasts_subscribe") }} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default" href="{{ .Site.Params.pocketcasts_subscribe }}"><i class="fa fa-podcast"></i> PocketCasts</a> - </div> - {{ end }} - {{ if (isset .Site.Params "rss_subscribe" )}} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default" href="{{ .Site.Params.rss_subscribe }}"><i class="fa fa-rss"></i> Podcast RSS</a> - </div> - {{ else }} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default" href="{{"episode/index.xml" | absURL }}"><i class="fa fa-rss"></i> Podcast RSS</a> - </div> - {{ end }} - {{ $blog := (where .Site.RegularPages "Section" "==" "blog") }} - {{ if ge (len $blog) 1 }} - <div class = "d-flex p-2 subscribe_buttons col-md-auto"> - <a class="btn btn-default" href="{{"blog/index.xml" | absURL }}"><i class="fa fa-rss"></i> Blog RSS</a> + {{ if (isset .Site.Params "youtube_subscribe") }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{ .Site.Params.youtube_subscribe}}"><i class="fab fa-spotify"></i> Youtube</a> + </div> + {{ end }} + {{ if (isset .Site.Params "spotify_subscribe") }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{ .Site.Params.spotify_subscribe}}"><i class="fab fa-spotify"></i> Spotify</a> + </div> + {{ end }} + {{ if (isset .Site.Params "itunes_subscribe") }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{ .Site.Params.itunes_subscribe}}"><i class="fa fa-podcast"></i> Apple Podcasts</a> + </div> + {{ end }} + {{ if (isset .Site.Params "android_subscribe") }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default subscribe_buttons" href="{{ .Site.Params.android_subscribe }}"><i class="fab fa-android"></i> Android</a> + </div> + {{ end }} + {{ if (isset .Site.Params "google_play_subscribe") }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{ .Site.Params.google_play_subscribe }}"><i class="fab fa-google-play"></i> Google Podcasts</a> + </div> + {{ end }} + {{ with .Site.Params.stitcher_subscribe }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{ . }}"><i class="fa fa-podcast"></i> Stitcher</a> + </div> + {{ end }} + {{ if (isset .Site.Params "soundcloud_subscribe") }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{ .Site.Params.soundcloud_subscribe }}"><i class="fab fa-soundcloud"></i> Soundcloud</a> + </div> + {{ end }} + {{ if (isset .Site.Params "pocketcasts_subscribe") }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{ .Site.Params.pocketcasts_subscribe }}"><i class="fa fa-podcast"></i> PocketCasts</a> + </div> + {{ end }} + {{ if (isset .Site.Params "rss_subscribe" )}} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{ .Site.Params.rss_subscribe }}"><i class="fa fa-rss"></i> Podcast RSS</a> + </div> + {{ else }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{"episode/index.xml" | absURL }}"><i class="fa fa-rss"></i> Podcast RSS</a> + </div> + {{ end }} + {{ $blog := (where .Site.RegularPages "Section" "==" "blog") }} + {{ if ge (len $blog) 1 }} + <div class = "d-flex p-2 subscribe_buttons col-md-auto"> + <a class="btn btn-default" href="{{"blog/index.xml" | absURL }}"><i class="fa fa-rss"></i> Blog RSS</a> + </div> + {{ end }} </div> - {{ end }} - - -</div> </div> </div> diff --git a/layouts/partials/seo.html b/layouts/partials/seo.html index c2bc187..814278e 100644 --- a/layouts/partials/seo.html +++ b/layouts/partials/seo.html @@ -21,8 +21,22 @@ <meta name="twitter:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}" /> <meta itemprop="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}"> {{- end -}} -{{ with .Site.Params.social.twitter }}<meta name="twitter:site" content="@{{ . }}"/>{{ end }} -{{ with .Site.Params.social.twitter }}<meta name="twitter:creator" content="@{{ . }}"/>{{ end }} +<!-- +The twitter link can be based in short ("arresteddevops") or +long form ("https://twitter.com/arresteddevops") + +In long form we need to strip everything but the twitter handle +for the SEO tags +--> +{{ if (isset .Site.Params.social "twitter" )}} + {{ if gt (len (urls.Parse .Site.Params.social.twitter).Scheme) 0 }} + <meta name="twitter:site" content="@{{ trim ((urls.Parse .Site.Params.social.twitter).Path) "/" }}"/> + <meta name="twitter:creator" content="@{{ trim ((urls.Parse .Site.Params.social.twitter).Path) "/" }}"/> + {{ else }} + <meta name="twitter:site" content="@{{ .Site.Params.social.twitter }}"/> + <meta name="twitter:creator" content="@{{ .Site.Params.social.twitter }}"/> + {{ end }} +{{ end }} {{ with .Site.Params.social.twitter_domain }}<meta name="twitter:domain" content="{{ . }}"/>{{ end }} {{ if eq .Type "episode" }} <meta property="og:type" content="article" /> diff --git a/layouts/partials/social-link.html b/layouts/partials/social-link.html new file mode 100644 index 0000000..f969774 --- /dev/null +++ b/layouts/partials/social-link.html @@ -0,0 +1,16 @@ +<!-- +Original config had people giving short forms like "mattstratton" which were converted +to full URLs like https://www.linkedin.com/in/mattstratton but later support was +added to allow the user to pass in full URLs to support other use cases like +linking to a company page e.g. https://www.linkedin.com/company/linkedin/ + +This utility partial will parse the url to look for a schme like http or https. +If a scheme exists then we will just include the full URL as it is, otherwise +we will take the prefix passed in and concatenate them together for backwards +compatability +--> +{{ if gt (len (urls.Parse .context).Scheme) 0 }} + <a class="{{ .aclass }}" href = "{{ .context }}"><i class="{{ .iclass }}"></i>{{ .text }}</a> +{{ else }} + <a class="{{ .aclass }}" href = "{{ .prefix }}{{ .context }}"><i class="{{ .iclass }}"></i>{{ .text }}</a> +{{ end }} |