Skip to content

Commit 418c429

Browse files
authored
Merge branch 'main' into mattstratton/update-hugo-152-2
2 parents 9e533ae + 172a006 commit 418c429

File tree

4 files changed

+72
-11
lines changed

4 files changed

+72
-11
lines changed

data/events/2025/halifax/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ event_twitter: "DevOpsDaysHali" # Change this to the twitter handle for your eve
55
description: "The premier DevOps conference for Atlantic Canada" # Edit this to suit your preferences
66
ga_tracking_id: "" # If you have your own Google Analytics tracking ID, enter it here. Example: "UA-74738648-1"
77

8+
# Social Share Buttons - Only show email and LinkedIn (no Facebook or Twitter)
9+
social_shares: ["email", "linkedin"]
10+
811
masthead_background: "halifax-background.png"
912
sharing_image: "halifax-sharing.png"
1013

themes/devopsdays-theme/layouts/partials/footer_scripts.html

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,85 @@
2121
{{- $sharing_title := (printf "devopsdays %s - %s" $e.city $e.year) -}}
2222
{{- $.Scratch.Set "sharing_title" $sharing_title -}}
2323
{{- end -}}
24+
{{- /* Build social shares array based on event configuration or use defaults */ -}}
25+
{{- $shares := slice -}}
26+
{{- if $e.social_shares -}}
27+
{{- range $e.social_shares -}}
28+
{{- if eq . "twitter" -}}
29+
{{- $shares = $shares | append (dict "share" "twitter" "via" ($.Scratch.Get "twitter_handle")) -}}
30+
{{- else -}}
31+
{{- $shares = $shares | append . -}}
32+
{{- end -}}
33+
{{- end -}}
34+
{{- else -}}
35+
{{- /* Default: all social share buttons */ -}}
36+
{{- $shares = slice "email" (dict "share" "twitter" "via" ($.Scratch.Get "twitter_handle")) "facebook" "linkedin" -}}
37+
{{- end -}}
38+
{{- $.Scratch.Set "social_shares" $shares -}}
2439
{{- else -}}
2540
{{- $.Scratch.Set "twitter_handle" "devopsdays" -}}
2641
{{- if isset .Params "Title" -}}
2742
{{- if ne .Params.Title "" -}}
2843
{{- $.Scratch.Set "sharing_title" .Params.Title -}}
44+
{{- else -}}
45+
{{- $.Scratch.Set "sharing_title" .Title -}}
2946
{{- end -}}
3047
{{- else -}}
3148
{{- if eq .Type "blog" -}}
32-
{{- $.Scratch.Set "sharing_title" .Params.Title -}}
49+
{{- $.Scratch.Set "sharing_title" .Title -}}
3350
{{- else -}}
3451
{{- $.Scratch.Set "sharing_title" "devopsdays" -}}
3552
{{- end -}}
3653
{{- end -}}
54+
{{- /* Set default shares for non-event pages */ -}}
55+
{{- $default_shares := slice "email" (dict "share" "twitter" "via" "devopsdays") "facebook" "linkedin" -}}
56+
{{- $.Scratch.Set "social_shares" $default_shares -}}
3757
{{- end -}}
3858
{{- end -}}
59+
{{- /* Ensure sharing_title is always set */ -}}
60+
{{- if not ($.Scratch.Get "sharing_title") -}}
61+
{{- $.Scratch.Set "sharing_title" "devopsdays" -}}
62+
{{- end -}}
63+
{{- /* Build shares array as JavaScript string before script tag */ -}}
64+
{{- $shares := $.Scratch.Get "social_shares" -}}
65+
{{- if or (not $shares) (eq (len $shares) 0) -}}
66+
{{- /* Default for non-event pages */ -}}
67+
{{- $shares = slice "email" (dict "share" "twitter" "via" ($.Scratch.Get "twitter_handle")) "facebook" "linkedin" -}}
68+
{{- end -}}
69+
{{- $shares_js_parts := slice -}}
70+
{{- range $shares -}}
71+
{{- $share_str := "" -}}
72+
{{- $current_item := . -}}
73+
{{- if eq $current_item "email" -}}
74+
{{- $share_str = "\"email\"" -}}
75+
{{- else if eq $current_item "facebook" -}}
76+
{{- $share_str = "\"facebook\"" -}}
77+
{{- else if eq $current_item "linkedin" -}}
78+
{{- $share_str = "\"linkedin\"" -}}
79+
{{- else -}}
80+
{{- $twitter_share_val := index $current_item "share" -}}
81+
{{- if $twitter_share_val -}}
82+
{{- $share_str = printf "{share: \"%s\", via: '%s'}" $twitter_share_val ($.Scratch.Get "twitter_handle") -}}
83+
{{- end -}}
84+
{{- end -}}
85+
{{- if $share_str -}}
86+
{{- $shares_js_parts = $shares_js_parts | append $share_str -}}
87+
{{- end -}}
88+
{{- end -}}
89+
{{- $shares_js_str := delimit $shares_js_parts ", " -}}
90+
{{- if not $shares_js_str -}}
91+
{{- $shares_js_str = "\"email\", {share: \"twitter\", via: 'devopsdays'}, \"facebook\", \"linkedin\"" -}}
92+
{{- end -}}
93+
{{- $sharing_title_final := $.Scratch.Get "sharing_title" -}}
94+
{{- if not $sharing_title_final -}}
95+
{{- $sharing_title_final = "devopsdays" -}}
96+
{{- end -}}
97+
{{- $full_script := printf "$(document).ready(function () {\n //YOUR JQUERY CODE\n\n $(\"#share\").jsSocials({\n shares: [%s],\n text: '%s',\n showLabel: false,\n showCount: false\n });\n});" $shares_js_str $sharing_title_final -}}
3998

4099
<script>
41100
//shares
42101

43102

44-
$(document).ready(function () {
45-
//YOUR JQUERY CODE
46-
47-
$("#share").jsSocials({
48-
shares: ["email", {share: "twitter", via: '{{ $.Scratch.Get "twitter_handle" }}'}, "facebook", "linkedin"],
49-
text: '{{ ($.Scratch.Get "sharing_title") }}',
50-
showLabel: false,
51-
showCount: false
52-
});
53-
});
103+
{{ $full_script | safeJS }}
54104

55105
</script>

themes/devopsdays-theme/reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ All dates are in unquoted YYYY-MM-DD, like this: `variable: 2016-01-05`, or like
9191
| `event_social_slack` | String | No | The invite URL to your slack workspace. | "https://join.slack.com/t/dodrox/shared_invite/xyz" |
9292
| `event_social_listserv` | String | No | The URL to subscribe to your group mailing list. | "https://lists.devopsdays.org/subscription?f=xyz". |
9393
| `event_twitter` | String | No | Legacy field for the twitter handle. Exclude the "@" symbol. Kept for backward support. | "devopsdayschi" |
94+
| `social_shares` | Array | No | Specify which social share buttons to display on event pages. Valid values: "email", "twitter", "facebook", "linkedin". If not specified, defaults to all four buttons. | ["email", "linkedin"] |
9495

9596
### Branding Fields
9697

utilities/examples/data/events/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ event_social_bsky: "https://bsky.app/profile/devopsdayscityabbr.bsky.social" # C
4545
event_social_youtube: "devopsdayscityabbr" # Change this to the youtube channel handle for your event such as devopsdaysrox
4646

4747

48+
# Social Share Buttons
49+
# Optional: Specify which social share buttons to display on event pages.
50+
# If not specified, defaults to all: ["email", "twitter", "facebook", "linkedin"]
51+
# Valid values: "email", "twitter", "facebook", "linkedin"
52+
# Example: social_shares: ["email", "linkedin"] # Only show email and LinkedIn share buttons
53+
social_shares: # ["email", "twitter", "facebook", "linkedin"]
54+
4855
nav_elements: # List of pages you want to show up in the navigation of your page.
4956
# - name: propose
5057
# - name: location

0 commit comments

Comments
 (0)