Skip to content

Commit

Permalink
[global] add social badges to shortcodes (#14902)
Browse files Browse the repository at this point in the history
  • Loading branch information
themightymuppet authored Feb 22, 2025
1 parent 3413510 commit 6e8a990
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 32 deletions.
36 changes: 16 additions & 20 deletions themes/devopsdays-theme/layouts/partials/events/cta.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

<div class = "row">

<!-- propose button -->
{{- if $e.startdate -}}
{{- if $e.cfp_date_start -}}
{{- if and (ge now (time $e.cfp_date_start)) (le now (time $e.cfp_date_end)) -}}
<div class = "col-auto offset-1 offset-md-0 welcome-page-cta">
<a href='{{ (partial "functions/get-cfp-url" $e) }}' class="btn jssocials-share-link event-cta-button" role="button" aria-pressed="true">Propose</a>
</div>
{{- end -}}
{{- end -}}
{{- end -}}

<!-- register button -->
{{- if $e.registration_open -}}
{{- if eq $e.registration_open "true" -}}
Expand Down Expand Up @@ -46,26 +57,11 @@
{{- end -}}
{{- end -}}



<!-- propose button -->
{{- if $e.startdate -}}
{{- if $e.cfp_date_start -}}
{{- if and (ge now (time $e.cfp_date_start)) (le now (time $e.cfp_date_end)) -}}
<div class = "col-auto offset-1 offset-md-0 welcome-page-cta">
<a href='{{ (partial "functions/get-cfp-url" $e) }}' class="btn jssocials-share-link event-cta-button" role="button" aria-pressed="true">Propose</a>
</div>
{{- end -}}
{{- end -}}
{{- end -}}



<!-- follow on twitter button -->
{{- if $e.event_twitter -}}
{{- if ne $e.event.twitter "" -}}
<!-- contact via email button -->
{{- if $e.organizer_email -}}
{{- if ne $e.organizer_email "" -}}
<div class = "col-auto offset-1 offset-md-0 welcome-page-cta">
<a href="https://twitter.com/{{$e.event_twitter}}" class="btn jssocials-share-link event-cta-button" role="button" aria-pressed="true">Follow</a>
<a href="mailto:{{ $e.organizer_email }}?subject=DevOpsDays {{ $e.city }} {{ $e.year }}" class="btn jssocials-share-link event-cta-button" role="button" aria-pressed="true">Contact</a>
</div>
{{- end -}}
{{- end -}}
Expand Down Expand Up @@ -120,4 +116,4 @@
<div id="share"></div>
</div>

</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- $e := partial "functions/get-event-data" . -}}

{{- if $e.event_social_bsky -}}
<a href="{{ $e.event_social_bsky }}" class="fa-brands social-bsky fa-bluesky" target="_blank" title="Join us on Bluesky"></a>
{{- else -}}
<a href="{{ index .Params 0 }}" class="fa-brands social-bsky fa-bluesky" target="_blank" title="Join us on BlueSky"></a>
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- $e := partial "functions/get-event-data" . -}}

{{- if $e.event_social_linkedin -}}
<a href="{{ $e.event_social_linkedin }}" class="fa-brands social-li fa-linkedin" target="_blank" title="Follow on Linkedin"></a>
{{- else -}}
<a href="{{ index .Params 0 }}" class="fa-brands fa-linkedin" target="_blank" title="Follow on Linkedin"></a>
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- $e := partial "functions/get-event-data" . -}}

{{- if $e.event_social_listserv -}}
<a href="{{ $e.event_social_listserv }}" class="fa fa-envelope social-envelope" target="_blank" title="Subscribe to our Mailing List"></a>
{{- else -}}
<a href="{{ index .Params 0 }}" class="fa fa-envelope social-envelope" target="_blank" title="Subscribe to our Mailing List"></a>
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- $e := partial "functions/get-event-data" . -}}

{{- if $e.event_social_mastodon -}}
<a href="{{ $e.event_social_mastodon }}" class="fa-brands social-mstd fa-mastodon" target="_blank" title="Join us on Mastodon"></a>
{{- else -}}
<a href="{{ index .Params 0 }}" class="fa-brands social-mstd fa-mastodon" target="_blank" title="Join us on Mastodon"></a>
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- $e := partial "functions/get-event-data" . -}}

{{- if $e.event_social_slack -}}
<a href="{{ $e.event_social_slack }}" class="fa-brands fa-slack social-slack" target="_blank" title="Join us on Slack"></a>
{{- else -}}
<a href="{{ index .Params 0 }}" class="fa-brands fa-slack social-slack" target="_blank" title="Join us on Slack"></a>
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- $e := partial "functions/get-event-data" . -}}

{{- if $e.event_social_twitter -}}
<a href="https://twitter.com/{{ $e.event_social_twitter }}" class="fa-brands fa-twitter social-x" target="_blank" title="Follow on Twitter"></a>
{{- else -}}
<a href="https://twitter.com/{{ index .Params 0 }}" class="fa-brands fa-twitter social-x" target="_blank" title="Follow on Twitter"></a>
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- $e := partial "functions/get-event-data" . -}}

{{- if $e.event_social_youtube -}}
<a href="https://www.youtube.com/@{{ $e.event_social_youtube }}" class="fa-brands social-yt fa-youtube" target="_blank" title="Subscribe to our channel"></a>
{{- else -}}
<a href="https://www.youtube.com/@{{ index .Params 0 }}" class="fa-brands fa-youtube" target="_blank" title="subscribe to our channel"></a>
{{- end -}}
35 changes: 23 additions & 12 deletions themes/devopsdays-theme/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,17 @@ The `/data/events/YYYY/CITY.main.yml` file is the main configuration file for yo

### General Fields

| Field Name | Type | Required | Description | Example |
|------------------|--------|----------|-------------------------------------------------------------------------------------------------------|-----------------------------------------------|
| `name` | String | Yes | The name of the event. Four digit year with the city name in lower-case, with no spaces. | "2017-chicago" |
| `year` | String | Yes | The year of the event. Make sure it is in quotes. | "2017" |
| `city` | String | Yes | The displayed city name of the event. Capitalize it. | "Salt Lake City" |
| `event_twitter` | String | Yes | The twitter handle for your event such as "devopsdayschi" or "devopsdaysmsp". Exclude the "@" symbol. | "devopsdayschi" |
| `description` | String | No | Overall description of your event. Quotation marks need to be escaped. | "It's time for more DevOpsDays at Ponyville!" |
| `ga_tracking_id` | String | No | If you have your own Google Analytics tracking ID, enter it here. | "UA-74738648-1" |
| `gtm_tracking_id` | String | No | If you have your own Google Analytics v4 tracking ID, enter it here. | "G-NCBC4PBEMK" |
| `event_group` | String | No | If you'd like to group different events together (ie, "australia"), set them to the same "event_group" | "ponyville" |
| `speakers_verbose` | String | No | Set this to "true" if you want verbose speaker attributes (URLs visible). | "true" |
| `cancel` | String | No | If your event must be cancelled, add this field with the value of "true" (case-sensitive). This will keep it from being listed in the "upcoming events" views. | "true" | |
| Field Name | Type | Required | Description | Example |
|--------------------|--------|----------|-------------------------------------------------------------------------------------------------------|-----------------------------------------------|
| `name` | String | Yes | The name of the event. Four digit year with the city name in lower-case, with no spaces. | "2017-chicago" |
| `year` | String | Yes | The year of the event. Make sure it is in quotes. | "2017" |
| `city` | String | Yes | The displayed city name of the event. Capitalize it. | "Salt Lake City" |
| `description` | String | No | Overall description of your event. Quotation marks need to be escaped. | "It's time for more DevOpsDays at Ponyville!" |
| `ga_tracking_id` | String | No | If you have your own Google Analytics tracking ID, enter it here. | "UA-74738648-1" |
| `gtm_tracking_id` | String | No | If you have your own Google Analytics v4 tracking ID, enter it here. | "G-NCBC4PBEMK" |
| `event_group` | String | No | If you'd like to group different events together (ie, "australia"), set them to the same "event_group"| "ponyville" |
| `speakers_verbose` | String | No | Set this to "true" if you want verbose speaker attributes (URLs visible). | "true" |
| `cancel` | String | No | If your event must be cancelled, add this field with the value of "true" (case-sensitive). This will keep it from being listed in the "upcoming events" views. | "true" |

### Date-related Fields
All dates are in unquoted YYYY-MM-DD, like this: `variable: 2016-01-05`, or like `variable: 2016-01-05T23:59:00-06:00`
Expand All @@ -80,6 +79,18 @@ All dates are in unquoted YYYY-MM-DD, like this: `variable: 2016-01-05`, or like
| `registration_link` | String | No | If you have a custom registration link, enter it here. This will control the Registration menu item as well as the "Register" button. | "https://myurlhere" reference it like {{< event_link url-key="registration_link" text="Register to attend the conference!" >}} | |
| `sponsor_link` | String | No | If you have a custom sponsorship link, enter it here. This will control the "Become an X Sponsor!" links. It does NOT change the "Sponsor" button. | "https://myurlhere" | |

### Social Fields
| Field Name | Type | Required | Description | Example |
|-------------------------|--------|----------|-------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| `event_social_twitter` | String | No | The twitter handle for your event such as "devopsdayschi" or "devopsdaysmsp". Exclude the "@" symbol. | "devopsdaysrox" |
| `event_social_linkedin` | String | No | The direct URL to your linkedin event or group/company page. | "https://www.linkedin.com/company/devopsdaysrox" |
| `event_social_youtube` | String | No | The Youtube handle for your event such as "devopsdaysrox" or "devopsdayschi". Exclude the "@" symbol. | "devopsdaysrox" |
| `event_social_bsky` | String | No | The BlueSky direct URL for your event/group profile. Can link to a custom server. | "https://bsky.app/profile/dodrox.bsky.social" |
| `event_social_mastodon` | String | No | The Mastodon direct URL for your event/group profile. Can link to a custom server. | "https://mastodon.social/@dodrox" |
| `event_social_slack` | String | No | The invite URL to your slack workspace. | "https://join.slack.com/t/dodrox/shared_invite/xyz" |
| `event_social_listserv` | String | No | The URL to subscribe to your group mailing list. | "https://lists.devopsdays.org/subscription?f=xyz". |
| `event_twitter` | String | No | Legacy field for the twitter handle. Exclude the "@" symbol. Kept for backward support. | "devopsdayschi" |

### Branding Fields

| Field Name | Type | Required | Description | Example |
Expand Down
86 changes: 86 additions & 0 deletions themes/devopsdays-theme/static/css/site.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions utilities/examples/data/events/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ location: "yourlocation" # Defaults to city, but you can make it the venue name.
#
location_address: "" #Optional - use the street address of your venue. This will show up on the welcome page if set. Also used by the event_map shortcode!

# Optional - Social badges
# These can be used in the body of any page via matching shortcodes. See sample: https://devopsdays.org/events/2025-denver/welcome/
event_social_linkedin: "https://linkedin.com/company/devopsdayscityabbr" # Change this to the url to your Linkedin group, company, or page.
event_social_slack: "https://join.slack.com/t/devopsdayscityabbr/custom_shared_invite_url" # Change this to your slack invite link.
event_social_listserv: "https://lists.devopsdays.org/subscription?custom_listserv_invite_url" # Change this to your mailing list subscription form url.
event_social_twitter: "devopsdayscityabbr" # Change this to the twitter handle for your event such as devopsdayschi or devopsdaysmsp
event_social_mastadon: "https://mastodon.social/@devopsdayscityabbr" # Change this to url to your mastadon page
event_social_bsky: "https://bsky.app/profile/devopsdayscityabbr.bsky.social" # Change this to url to your bluesky page
event_social_youtube: "devopsdayscityabbr" # Change this to the youtube channel handle for your event such as devopsdaysrox
# legacy
event_twitter: "devopsdayscityabbr" # This will create a traditional "Follow" twitter button. Change this to the twitter handle for your event such as devopsdayschi or devopsdaysmsp.

nav_elements: # List of pages you want to show up in the navigation of your page.
# - name: propose
# - name: location
Expand Down

0 comments on commit 6e8a990

Please sign in to comment.