From 8bb048830aaa80aafea898d40d6cb81a6be3122e Mon Sep 17 00:00:00 2001 From: Matt Stratton Date: Thu, 14 Apr 2016 10:34:31 -0500 Subject: [PATCH] Create partials for event pages. Fixes #135 --- .../layouts/event/single.html | 56 +------------------ .../layouts/partials/event_footer.html | 30 ++++++++++ .../layouts/partials/event_header.html | 27 +++++++++ .../layouts/talk/single.html | 53 ++---------------- 4 files changed, 63 insertions(+), 103 deletions(-) create mode 100644 themes/devopsdays-legacy/layouts/partials/event_footer.html create mode 100644 themes/devopsdays-legacy/layouts/partials/event_header.html diff --git a/themes/devopsdays-legacy/layouts/event/single.html b/themes/devopsdays-legacy/layouts/event/single.html index 79d3dbc0831..e0ce3cb2917 100644 --- a/themes/devopsdays-legacy/layouts/event/single.html +++ b/themes/devopsdays-legacy/layouts/event/single.html @@ -1,61 +1,9 @@ -{{ 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 -*/}} +{{ partial "event_header.html" . }} {{ $path := split $.Source.File.Path "/" }} {{ $event_slug := index $path 1 }} {{ $e := (index $.Site.Data.events $event_slug) }} -{{/* end site data query */}} - -
-
-
-

{{ $e.city }} {{ $e.year }} - {{ title .Title }}

- - - - {{ .Content }} -
-
- - {{ $sponsors := $e.sponsors }} - {{ range $e.sponsor_levels }} -

{{ .label }} Sponsors

- {{ range where $sponsors "level" .id }} - {{ $s := (index $.Site.Data.sponsors .id) }} - {{ if isset $.Site.Data.sponsors .id }} - - {{ end }} - {{ end }} - - {{ end }} - - -
-
-
-{{ partial "footer.html" . }} +{{ partial "event_footer.html" . }} diff --git a/themes/devopsdays-legacy/layouts/partials/event_footer.html b/themes/devopsdays-legacy/layouts/partials/event_footer.html new file mode 100644 index 00000000000..38edf9f3b2d --- /dev/null +++ b/themes/devopsdays-legacy/layouts/partials/event_footer.html @@ -0,0 +1,30 @@ +{{ $path := split $.Source.File.Path "/" }} +{{ $event_slug := index $path 1 }} +{{ $e := (index $.Site.Data.events $event_slug) }} + + + + + +
+ +{{ $sponsors := $e.sponsors }} +{{ range $e.sponsor_levels }} +

{{ .label }} Sponsors

+ {{ range where $sponsors "level" .id }} + {{ $s := (index $.Site.Data.sponsors .id) }} + {{ if isset $.Site.Data.sponsors .id }} + + {{ end }} + {{ end }} + +{{ end }} + + +
+ + + +{{ partial "footer.html" . }} diff --git a/themes/devopsdays-legacy/layouts/partials/event_header.html b/themes/devopsdays-legacy/layouts/partials/event_header.html new file mode 100644 index 00000000000..48873bc5d15 --- /dev/null +++ b/themes/devopsdays-legacy/layouts/partials/event_header.html @@ -0,0 +1,27 @@ +{{ 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 }} +{{ $e := (index $.Site.Data.events $event_slug) }} + +{{/* end site data query */}} + +
+
+
+

{{ $e.city }} {{ $e.year }} - {{ title .Title }}

+ + diff --git a/themes/devopsdays-legacy/layouts/talk/single.html b/themes/devopsdays-legacy/layouts/talk/single.html index 5a7b4c5ca4d..670a07e911c 100644 --- a/themes/devopsdays-legacy/layouts/talk/single.html +++ b/themes/devopsdays-legacy/layouts/talk/single.html @@ -1,29 +1,9 @@ -{{ 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 -*/}} +{{ partial "event_header.html" . }} {{ $path := split $.Source.File.Path "/" }} {{ $event_slug := index $path 1 }} -{{ $event := (print .Params.year (lower .Params.city)) }} {{ $e := (index $.Site.Data.events $event_slug) }} - -{{/* end site data query */}} - -
-
-
-

{{ $e.city }} {{ $e.year }} - {{ title .Title }}

- - + {{ .Content }} @@ -52,30 +32,5 @@

{{ $s.name }}

- -
- - - -
- - {{ $sponsors := $e.sponsors }} - {{ range $e.sponsor_levels }} -

{{ .label }} Sponsors

- {{ range where $sponsors "level" .id }} - {{ $s := (index $.Site.Data.sponsors .id) }} - {{ if isset $.Site.Data.sponsors .id }} - - {{ end }} - {{ end }} - - {{ end }} - - -
-
- -
-{{ partial "footer.html" . }} + +{{ partial "event_footer.html" . }}