{{/*
schema.html
This is the Schema partial for data.scilifelab.se
It generates relevant schema (WebSite, Collection, or Dataset) and keywords
depending on whether the page is highlights/services/resources (single or listing).
*/}}
{{/* Default values */}}
{{ $type := "WebPage" }}
{{ $name := .Site.Title }}
{{ $description := (or .Params.description .Params.summary .Site.Params.description) }}
{{ $image := index .Site.Params.Images 0 | absURL }}
{{ $currentPage := path.Split (path.Clean .RelPermalink) }}
{{/* Determine page type */}}
{{ $isHomePage := .IsHome }}
{{ $isSingleHighlightPage := and (eq $currentPage.Dir "/highlights/") ($currentPage.File) }}
{{ $isHighlightsPage := and (strings.HasPrefix .RelPermalink "/highlights") (not $isSingleHighlightPage) }}
{{ $isResourcesPage := strings.HasSuffix .RelPermalink "/resources/" }}
{{ $isServicesPage := strings.HasSuffix .RelPermalink "/services/" }}
{{/* Overwrite $type based on page */}}
{{ if $isHomePage }}
{{ $type = "WebSite" }}
{{ else if $isSingleHighlightPage }}
{{ $type = "Dataset" }}
{{ else if $isHighlightsPage }}
{{ $type = "DataCatalog" }}
{{ else if or $isResourcesPage $isServicesPage }}
{{ $type = "Collection" }}
{{ end }}