Skip to content

Commit

Permalink
Merge pull request #78 from devopsdays/mattstratton/refactor-event-slug
Browse files Browse the repository at this point in the history
Refactor for event path
  • Loading branch information
mattstratton committed Mar 7, 2016
2 parents f0547af + fd07807 commit c751d51
Show file tree
Hide file tree
Showing 40 changed files with 65 additions and 30 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
+++
City = "WashingtonDC"
City = "Washington D.C."
Year ="2016"
date = "2016-03-06T21:15:25-06:00"
title = "welcome"
type = "event"
aliases = ["/events/2016-detroit"]
aliases = ["/events/2016-washington-dc"]


+++
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cfp_date_end: 2016-06-01
cfp_date_announce: 2016-07-01
coordinates: "41.882219, -87.640530"
location: "Summit West"
navigationelements: ["welcome", "contact", "location", "program", "propose", "proposals", "registration", "conduct", "sponsor"]
navigationelements: ["welcome", "contact", "location", "program", "propose", "proposals", "conduct", "sponsor"]
team: ["Jerry Cattell", "Brian Devlin", "Michael Lanyon", "Aaron Lindstrom", "Chris Read", "Kevin Reedy", "Sasha Rosenbaum", "Matt Stratton"]
organizer_email: "[email protected]"
proposal_email: "[email protected]"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 2016washingtondc # The name of the event. Four digit year with the city name in lower-case, with no spaces.
year: "2016" # The year of the event. Make sure it is in quotes.
city: "Washington, D.C. " # The city name of the event. Capitalize it.
friendly: "2016-washingtondc" # Four digit year and the city name in lower-case. Don't forget the dash!
friendly: "2016-washington-dc" # Four digit year and the city name in lower-case. Don't forget the dash!
status: "current" # Options are "past" or "current".
startdate: 2016-06-08 # The start date of your event, in YYYY-MM-DD format. Leave blank if you don't have a date yet.
enddate: 2016-06-09 # The end date of your event, in YYYY-MM-DD format. Leave blank if you don't have a date yet.
Expand Down
7 changes: 5 additions & 2 deletions layouts/shortcodes/cfp_dates.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{{ $event := (print .Page.Params.year (lower .Page.Params.city)) }}
{{ $e := (index $.Page.Site.Data.events $event) }}
{{ $path := split .Page.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}

{{ if isset $e "cfp_date_start" }}

{{ $cfp_date_start := $e.cfp_date_start }}
{{ $cfp_date_end := $e.cfp_date_end }}
{{ $cfp_date_announce := $e.cfp_date_announce }}



<center>
<b>Call for proposals opens {{ dateFormat "Monday, Jan 2, 2006" $cfp_date_start }}.</b><br>
<b>Call for proposals closes {{ dateFormat "Monday, Jan 2, 2006" $cfp_date_end }}.</b><br>
Expand Down
8 changes: 3 additions & 5 deletions layouts/shortcodes/email_organizers.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{{ $event := (print .Page.Params.year (lower .Page.Params.city)) }}
{{ $e := (index $.Page.Site.Data.events $event) }}

{{ $cfp_date_start := $e.organizer_email }}

{{ $path := split .Page.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}
<a href='mailto:{{ $e.organizer_email }}'>{{ $e.organizer_email }}</a>
7 changes: 3 additions & 4 deletions layouts/shortcodes/email_proposals.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{ $event := (print .Page.Params.year (lower .Page.Params.city)) }}
{{ $e := (index $.Page.Site.Data.events $event) }}

{{ $cfp_date_start := $e.proposal_email }}
{{ $path := split .Page.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}

<a href='mailto:{{ $e.proposal_email }}'>{{ $e.proposal_email }}</a>
12 changes: 9 additions & 3 deletions layouts/shortcodes/event_end.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{{ $event := (print .Page.Params.year (lower .Page.Params.city)) }}
{{ $e := (index $.Page.Site.Data.events $event) }}
{{ $path := split .Page.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}
{{ $enddate := $e.enddate}}
{{ dateFormat "Monday, Jan 2, 2006" $enddate }}

{{ if isset $e "enddate" }}
{{ dateFormat "Monday, Jan 2, 2006" $enddate }}
{{ else }}
TBD
{{ end }}
5 changes: 4 additions & 1 deletion layouts/shortcodes/event_link.html
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<a href = "/events/{{ .Page.Params.year }}-{{ lower .Page.Params.city }}/{{ .Get "page" }}">{{ .Get "text" }}</a>
{{ $path := split .Page.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}

<a href = "/events/{{ $event_slug }}/{{ .Get "page" }}">{{ .Get "text" }}</a>
7 changes: 4 additions & 3 deletions layouts/shortcodes/event_location.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ $event := (print .Page.Params.year (lower .Page.Params.city)) }}
{{ $e := (index $.Page.Site.Data.events $event) }}
<a href = "/events/{{ .Page.Params.year }}-{{ lower .Page.Params.city }}/location">{{ $e.location }}</a>
{{ $path := split .Page.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}
<a href = "/events/{{ $event_slug }}/location">{{ $e.location }}</a>
6 changes: 5 additions & 1 deletion layouts/shortcodes/event_logo.html
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<img alt="DevOpsDays {{ .Page.Params.city }} {{ .Page.Params.year }}" src="/img/events/{{ .Page.Params.year }}-{{lower .Page.Params.city }}/logo.png"/>
{{ $path := split .Page.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}

<img alt="DevOpsDays {{ $e.city }} {{ $e.year }}" src="/img/events/{{ $event_slug }}/logo.png"/>
13 changes: 10 additions & 3 deletions layouts/shortcodes/event_start.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{{ $event := (print .Page.Params.year (lower .Page.Params.city)) }}
{{ $e := (index $.Page.Site.Data.events $event) }}
{{ $path := split .Page.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}

{{ $startdate := $e.startdate}}
{{ dateFormat "Monday, Jan 2, 2006" $startdate }}

{{ if isset $e "startdate" }}
{{ dateFormat "Monday, Jan 2, 2006" $startdate }}
{{ else }}
TBD
{{ end }}
5 changes: 3 additions & 2 deletions layouts/shortcodes/list_organizers.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ $event := (print .Page.Params.year (lower .Page.Params.city)) }}
{{ $e := (index $.Page.Site.Data.events $event) }}
{{ $path := split .Page.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}
<ul>
{{ range $event_organizers := $e.team }}
<li>{{ $event_organizers }}</li>
Expand Down
14 changes: 12 additions & 2 deletions themes/devopsdays-legacy/layouts/event/single.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{{ partial "header.html" . }}

{{/*
This section is what creates the query to get at all the site data. If you need this somewhere, you can just copy
it and paste it. Need to figure out if a partial would expose the variables/elements/array created herein. It could be done in a partial (need to include the trailing .) but I don't think it would work in shortcodes, which is where we need it the most - mattstratton
*/}}

{{ $path := split $.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $event := (print .Params.year (lower .Params.city)) }}
{{ $e := (index $.Site.Data.events $event) }}
{{ $e := (index $.Site.Data.events $event_slug) }}

{{/* end site data query */}}

<div class = "container-fluid">
<div class="row">
<div class="col-md-8">
Expand All @@ -10,7 +20,7 @@ <h1> {{ $e.city }} - {{ title .Title }} </h1>
<div class="submenu">
<h3>
{{ range $navigation := $e.navigationelements}}
<a href="/events/{{ $e.friendly }}/{{ $navigation}}">{{ $navigation }}</a>&nbsp;
<a href="/events/{{ $event_slug }}/{{ $navigation}}">{{ $navigation }}</a>&nbsp;
{{ end }}
</h3>
</div>
Expand Down
3 changes: 3 additions & 0 deletions themes/devopsdays-legacy/layouts/partials/get-slug.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ $path := split $.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $event_slug }}

0 comments on commit c751d51

Please sign in to comment.