Skip to content
This repository was archived by the owner on Jul 21, 2019. It is now read-only.

Commit c8d1514

Browse files
authored
Merge pull request #617 from tylermauthe/event-link-data-source
Allow event_link to also pull event data
2 parents 28ef6db + 984b180 commit c8d1514

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

exampleSite/content/events/2017-ponyville/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@ Pivot paradigm sticky note agile grok unicorn waterfall is so 2000 and late resp
88

99
# This is our thing!
1010

11+
Tickets
12+
: {{< event_link url-key="registration_link" text="Register here!" >}}
13+
14+
Location
15+
: {{< event_link text-key="location_address" page="location" >}}
16+
1117
<img src ="/events/2017-ponyville/want.gif">

exampleSite/data/events/2017-ponyville.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ registration_date_start: 2017-05-15
1313
registration_date_end: 2017-05-30
1414
registration_open: ""
1515
registration_closed: ""
16-
registration_link: ""
16+
registration_link: "https://www.example.com"
1717
coordinates: "41.882219, -87.640530"
1818
location: "Applejack House"
1919
location_address: "350 West Mart Center Drive, Chicago, IL 60654"

layouts/shortcodes/event_link.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
{{- $e := (index $.Site.Data.events (index (split ($.Page.Permalink | relURL) "/") 2)) -}}
2-
<a href = "{{ (printf "events/%s/%s" $e.name (.Get "page")) | absURL }}">{{ .Get "text" }}</a>
2+
{{- $url := index $e (.Get "url-key") | default (printf "events/%s/%s" $e.name (.Get "page")) | absURL -}}
3+
{{- $txt := index $e (.Get "text-key") | default (.Get "text") -}}
4+
5+
<a href = "{{ $url }}">{{ $txt }}</a>

0 commit comments

Comments
 (0)