Skip to content

Commit

Permalink
Start adding a team page & individual people pages [WIP]
Browse files Browse the repository at this point in the history
Relates to issues #70 & 71
  • Loading branch information
robyngit committed Jun 16, 2020
1 parent 48a6257 commit e1cfc09
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ permalinks:
services: "/:filename"
features: "/:filename"
news: "/:section/:filename"
people: "/:section/:title"
people: "/:section/:filename"
webinars: "/webinars/:slug"
params:
description: DataONE's products and services.
Expand Down
12 changes: 11 additions & 1 deletion content/people/index.md → content/people/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
---
headless: true
draft: true
menu:
primary_nav:
name: Our Team
parent: About
pre: users
weight: 1.5
footer:
name: Our Team
parent: About
weight: 1.5
---
{{/* This directory stores information about team peoples, webinar speakers, and any other people that we feature on the website somewhere. */}}
{{/* The headless:true parameter makes this directory a headless bundle, see: https://gohugo.io/content-management/page-bundles/#headless-bundle */}}
16 changes: 15 additions & 1 deletion themes/dataone/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
{{ if not (or (eq $.Params.render_page false) (eq $.Params.render_page "false")) }}

<!-- Decision rules for whether to render the page -->
{{ $renderPage := true }}
<!-- If the page has a render_page parameter set to false, do not render -->
<!-- EG. some feature pages serve as "headless bundles". We use data in -->
<!-- the page for the feature table, but we don't want to make a page for it. -->
{{ if (or (eq $.Params.render_page false) (eq $.Params.render_page "false")) }}
{{ $renderPage = false }}
<!-- For people pages, only make a page for people with a value set in the -->
<!-- d1_team parameter -->
{{ else if and (eq $.Type "people") (eq $.Kind "page") (not (partial "functions/isD1member" $)) }}
{{ $renderPage = false }}
{{ end }}

{{ if $renderPage }}
<body class="page">

<!-- Fade page in once loaded to avoid flash of unstyled content -->
Expand Down
12 changes: 11 additions & 1 deletion themes/dataone/layouts/partials/functions/getPeopleInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,19 @@
{{ $personListString := ""}}

{{ $page := .Page }}
{{ $site := $page.Site }}
<!-- fill in the person variables by ranging through the person resource pages -->
{{ range .People }}
{{ $person := ($page.Site.GetPage "/people").Resources.GetMatch (strings.TrimPrefix "people/" . ) }}

{{ $inputFileName := strings.TrimPrefix "/" . }}
{{ $person := "" }}
{{ $allPeoplePages := where $site.Pages "Type" "people" }}
{{range $allPeoplePages }}
{{ if eq $inputFileName .File.Path }}
{{ $person = . }}
{{ end }}
{{ end }}

{{ if $person }}
{{ $people = $people | append $person.Params }}
{{ $personNames = $personNames | append $person.Params.fullname }}
Expand Down
22 changes: 22 additions & 0 deletions themes/dataone/layouts/partials/functions/isD1member.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Determine whether the $page is a page for a DatONE team member (vs other person data page) -->
<!-- Checks whether the page has a d1_team parameter set -->

<!-- Need to access the Site parameter to get Pages -->
{{ $page := . }}

<!-- The boolean to return -->
{{ $decision := false }}
{{ if $page }}
{{ if and (eq $page.Type "people") (eq $page.Kind "page") }}
{{ $team := $page.Params.d1_team }}
{{ if $team }}
{{ if not ( and (eq $team "") (eq $team " ") ) }}
{{ $decision = true }}
{{ end }}
{{ end }}
{{ end }}
{{ else }}
{{ $decision = "NO PAGE" }}
{{ end }}

{{ return $decision }}
2 changes: 1 addition & 1 deletion themes/dataone/layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<head>

{{ if or (eq $.Params.render_page false) (eq $.Params.render_page "false") }}
{{ if or (eq $.Params.render_page false) (eq $.Params.render_page "false") (and (eq $.Type "people") (eq $.Kind "page") (not (partial "functions/isD1member" $))) }}
<meta name="robots" content="noindex">
<meta http-equiv="refresh" content="0; url=/"/>
{{ else }}
Expand Down
30 changes: 30 additions & 0 deletions themes/dataone/layouts/people/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- define "main" -}}
{{ $page := $ }}
{{ $site := $page.Site }}

{{ $headline := .Params.headline | default "Meet our team" }}
{{ partial "blocks/header/header" (dict "Block" (dict "title" $headline "type" "text only" "background_color" "default") "Page" $)}}

{{- range .Params.page_sections -}}
{{ $template := .template | default "section" }}
{{ partial (printf "blocks/%s/%s.html" $template $template) (dict "Block" . "Page" $page $) }}
{{- end -}}

{{ $subblocks := slice }}
{{ $latestNewsBlock := dict }}
{{ $otherNewsBlocks := slice }}

<section class="section" style="height:2000px; min-height:2000px; padding-left:200px;">

{{- range $index, $personPage := .Pages -}}
{{ if partial "functions/isD1member" $personPage }}
<h5>
{{ $personPage.RelPermalink }}
<a href="{{ $personPage.RelPermalink }}">{{ $personPage.Params.fullname }}</a>
</h5>

{{ end }}
{{- end -}}
</section>

{{- end -}}
13 changes: 13 additions & 0 deletions themes/dataone/layouts/people/single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- define "main" -}}
{{ $page := $ }}
{{ $person := .Params }}

<!-- Breadcrumb nav -->
{{ $breadcrumbsBlock := dict "back_text" "See entire team" "back_link" $page.Parent.RelPermalink }}
{{ partial "blocks/breadcrumbs/breadcrumbs" (dict "Block" $breadcrumbsBlock "Page" $page ) }}

<!-- Header -->
{{ $headerBlock := dict "type" "text only" "modifiers" (slice "has-breadcrumb") "background_color" "default" "title" $person.full_name "intro" $person.short_bio }}
{{ partial "blocks/header/header" (dict "Block" $headerBlock "Page" $page) }}

{{- end -}}

0 comments on commit e1cfc09

Please sign in to comment.