Files
HugoBlox-kit/wowchemy/layouts/partials/functions/has_attachments.html
T
George Cushen db4dcf6541 feat: support view for course archive & custom section archives
The fullback list view for archive pages did not previously support the `view` option, instead presenting lists in one specific format.

If a user creates a custom section name (e.g. `content/prj/`) that doesn't correspond with a built-in page type, they now have the option not to use the default list view by defining `view` in the associated `_index.md` file.

See https://github.com/wowchemy/wowchemy-hugo-modules/discussions/2323
2021-06-06 14:07:13 +01:00

24 lines
1.1 KiB
HTML

{{/* Return true if the page has attachments or link buttons to display. */}}
{{ $page := . }}
{{ $pdf_link := false }}
{{/* Prevent Hugo warning ".File.ContentBaseName on zero object." for content not backed by a Markdown file, */}}
{{/* such as auto-generated taxonomy pages, and sections without an explicit index file. */}}
{{/* The file check is required when called from `_default/list.html`, the fallback list view for the above cases. */}}
{{ with $page.File }}
{{ $slug := $page.File.ContentBaseName }}
{{ $resource := $page.Resources.GetMatch (printf "%s.pdf" $slug) }}
{{ with $resource }}
{{ $pdf_link = true }}
{{ end }}
{{ end }}
{{ $cite_link := false }}
{{ $resource := $page.Resources.GetMatch "cite.bib" }}
{{ with $resource }}
{{ $cite_link = true }}
{{ end }}
{{ return ($cite_link | or $pdf_link | or .Params.url_preprint | or .Params.url_pdf | or .Params.url_slides | or .Params.url_video | or .Params.url_source | or .Params.url_code | or .Params.url_dataset | or .Params.url_poster | or .Params.url_project | or .Params.doi | or .Params.links | or .Params.projects | or .Params.slides) }}