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

Commit f747c88

Browse files
committed
Add opt-in toggle for icon display on program page
Requires the page frontmatter parameter “icons” to be set to “true” on the `program.md` file for an event for video and/or slide links to show in the progam page Signed-off-by: Matt Stratton <matt.stratton@gmail.com>
1 parent de7d2ed commit f747c88

4 files changed

Lines changed: 23 additions & 5 deletions

File tree

REFERENCE.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
[Pages and Frontmatter](#pages-and-frontmatter)
2222
&emsp;[General Page Fields](#general-page-fields)
2323
&emsp;[Talk Page Fields](#talk-page-fields)
24-
&emsp;[Speaker Page Fields](#speaker-page-fields)
24+
&emsp;[Speaker Page Fields](#speaker-page-fields)
25+
&emsp;[Program Page Fields](#program-page-fields)
2526
&emsp;[Blog Post Fields](#blog-post-fields)
2627
[Shortcodes](#shortcodes)
2728
&emsp;[google_form](#google_form)
@@ -275,6 +276,14 @@ Pages of the type `speaker` have a few additional frontmatter elements available
275276
| `gitlab` | No | Speakers' GitLab username. | "mattstratton" |
276277
| `image` | No | The image for the speaker. This image is relative to the `static/events/YYYY-CITY/speakers` directory. It can be either .png or .jpg. It must be square, and 300px square, 600px square, or 900px square. | "matt-stratton.jpg" |
277278

279+
### Program Page Fields
280+
281+
The page of type `program` has one additional frontmatter element.
282+
283+
| Field Name | Required | Description | Example |
284+
|------------|----------|----------------------------------------------------------|---------|
285+
| `icons` | No | Toggles display of slide/video icons on the program page | "true" |
286+
278287
### Blog Post Fields
279288

280289
| Field Name | Required | Description | Example |

archetypes/program.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ City = ""
33
Year = ""
44
Title = ""
55
Type = "program"
6+
Icons = "false"
67
+++

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Year = "2017"
44
date = "2016-07-15T22:06:24-06:00"
55
title = "Ponyville 2017 Program"
66
type = "program"
7+
Icons = "TRUE"
78
+++
89

910
Our program is amazing!

layouts/program/single.html

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ <h2>Program</h2>
44
{{ .Content }}
55

66
{{- $.Scratch.Set "first" "true" -}}
7+
{{- with .Params.icons -}}
8+
{{- $.Scratch.Set "icons" (. | upper ) -}}
9+
{{- end -}}
710

811
{{- $e := (index $.Site.Data.events (index (split (.Permalink | relURL) "/") 2)) -}}
912

@@ -113,8 +116,10 @@ <h5 class="mb-0">
113116
{{ $.Scratch.Get .title }}
114117

115118
</a>
116-
{{- with ($.Scratch.Get (printf "%s-video_link" .title)) -}}<a href="{{ . }}"><i class="fa fa-video-camera" aria-hidden="true"></i></a>&nbsp;{{- end -}}
117-
{{- with ($.Scratch.Get (printf "%s-slides_link" .title)) -}}<a href="{{ . }}"><i class="fa fa-file-text-o" aria-hidden="true"></i></a>&nbsp;{{- end -}}
119+
{{- if eq ($.Scratch.Get "icons") "TRUE" -}}
120+
{{- with ($.Scratch.Get (printf "%s-video_link" .title)) -}}<a href="{{ . }}"><i class="fa fa-video-camera" aria-hidden="true"></i></a>&nbsp;{{- end -}}
121+
{{- with ($.Scratch.Get (printf "%s-slides_link" .title)) -}}<a href="{{ . }}"><i class="fa fa-file-text-o" aria-hidden="true"></i></a>&nbsp;{{- end -}}
122+
{{- end -}}
118123
<br/>
119124
<br/>
120125
{{- if .comments -}}
@@ -136,8 +141,10 @@ <h5 class="mb-0">
136141
<a href="/events/{{ $e.name}}/program/{{ .title }}">{{ $.Scratch.Get (printf "%s-speaker" .title) }}
137142
-
138143
{{ $.Scratch.Get .title }}</a>&nbsp;
139-
{{- with ($.Scratch.Get (printf "%s-video_link" .title)) -}}<a href="{{ . }}"><i class="fa fa-video-camera" aria-hidden="true"></i></a>&nbsp;{{- end -}}
140-
{{- with ($.Scratch.Get (printf "%s-slides_link" .title)) -}}<a href="{{ . }}"><i class="fa fa-file-text-o" aria-hidden="true"></i></a>&nbsp;{{- end -}}
144+
{{- if eq ($.Scratch.Get "icons") "TRUE" -}}
145+
{{- with ($.Scratch.Get (printf "%s-video_link" .title)) -}}<a href="{{ . }}"><i class="fa fa-video-camera" aria-hidden="true"></i></a>&nbsp;{{- end -}}
146+
{{- with ($.Scratch.Get (printf "%s-slides_link" .title)) -}}<a href="{{ . }}"><i class="fa fa-file-text-o" aria-hidden="true"></i></a>&nbsp;{{- end -}}
147+
{{- end -}}
141148
</li>
142149
{{- else -}}
143150
<li>

0 commit comments

Comments
 (0)