This repository has been archived by the owner on Jul 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from devopsdays/event-page
Event page
- Loading branch information
Showing
5 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{ define "main" }} | ||
|
||
{{/* site data query copypasta */}} | ||
{{ $path := split $.Source.File.Path .Site.Params.pathseperator }} | ||
{{ $event_slug := index $path 1 }} | ||
{{ $e := (index $.Site.Data.events $event_slug) }} | ||
{{/* end site data query */}} | ||
|
||
<div> | ||
{{ .Content }} | ||
</div> | ||
|
||
{{ partial "future.html" . }} | ||
{{ partial "past.html" . }} | ||
|
||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!-- The following blocks of comments explains how this list is generated with Hugo. | ||
If you read this post generation, it will make no sense. see pre generated sources --> | ||
|
||
<!-- Scan through a range of years and look in data/events for events during these years. | ||
If found, store year in "active_years" scratch in order to get back to that year later. | ||
Also save the event name under scratch with the ID of the scratch equal to the year number. | ||
Chomping .year has the nice effect of turning an int into string. --> | ||
{{ range seq 2009 2020 }} | ||
{{ $r_year := . }} | ||
{{ range $.Site.Data.events }} | ||
{{ if .startdate }} | ||
{{ $my_year := string ((dateFormat "2006" .startdate ))}} | ||
{{ if and (eq $my_year (string $r_year)) ( lt (dateFormat "2006-01-02" .startdate) (dateFormat "2006-01-02" ($.Now.Format "2006-01-02"))) }} | ||
{{ $.Scratch.SetInMap "active_years" (print (chomp $my_year)) (print (chomp $my_year)) }} | ||
{{ $.Scratch.SetInMap (print (chomp $my_year)) .startdate (.name) }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
|
||
<div class = "row"> | ||
<div class = "col-md-12"> | ||
<h2>Past</h2> | ||
</div> | ||
</div> | ||
<div class = "row"> | ||
<!-- Now scan through all the years that were marked as active in order to print the headline --> | ||
{{ range ($.Scratch.GetSortedMapValues "active_years") }} | ||
<div class = "col-md-4"> | ||
<strong>{{ . }}</strong> | ||
<br/> | ||
<!-- Finally, scan throug the scratch with the ID of that year and print all the events sorted by startdate | ||
Chomping here in order to convert int to string --> | ||
{{ range ($.Scratch.GetSortedMapValues (print (chomp .))) }} | ||
{{ $.Scratch.Set "citydisplay" (index $.Site.Data.events . "city") }} | ||
{{ $friendly := (index $.Site.Data.events . "name") }} | ||
<a href="/events/{{ $friendly }}/">{{ $.Scratch.Get "citydisplay" }}</a> | ||
<br/> | ||
{{ end }} | ||
</div> | ||
{{ end }} | ||
</div> |