You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.2 KiB

4 years ago
  1. {{/*
  2. Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
  3. This file is part of After Dark.
  4. After Dark is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU Affero General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. After Dark is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */ -}}
  15. {{ $page_schema := .Params.schema }}
  16. {{ $section_schema := (.Site.GetPage "section" .Page.Type).Params.schema }}
  17. {{ $schema_type := (default $section_schema.type $page_schema.type) | default "Thing" }}
  18. {{ $article_types := .Site.Data.schema.article_types }}
  19. {{ $is_typeof_article := in $article_types $schema_type }}
  20. <article itemprop="citation{{ if eq $schema_type "BlogPosting" }} blogPost{{ end }}" itemscope itemtype="https://schema.org/{{ $schema_type }}" id="{{ .Title | anchorize }}">
  21. <header>
  22. <h1 itemprop="{{ if $is_typeof_article }}headline{{ else }}name{{ end }}">
  23. <a href="{{ .RelPermalink }}">{{ .Title }}</a>
  24. </h1>
  25. {{ if eq .Type "post" }}
  26. <p class="muted">{{ partial "post/meta.html" . }}</p>
  27. {{ end }}
  28. {{ if .Description }}
  29. <blockquote itemprop="headline">{{ .Description }}</blockquote>
  30. {{ end }}
  31. </header>
  32. <div itemprop="{{ if $is_typeof_article }}articleBody mainEntityOfPage{{ end }}">
  33. {{- .Summary -}}
  34. </div>
  35. <meta itemprop="inLanguage" content="{{ .Site.LanguageCode }}">
  36. <meta itemprop="datePublished" content="{{ dateFormat "2006-01-02T15:04:05-07:00" (default .Date (.PublishDate)) }}">
  37. <meta itemprop="dateModified" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}">
  38. {{ with .Params.images }}
  39. <meta itemprop="image" content="{{ index . 0 }}">
  40. {{ end }}
  41. </article>
  42. {{ if .Truncated }}
  43. <nav class="readmore">
  44. <a itemprop="url" href="{{ .RelPermalink }}">Read More&nbsp;&raquo;</a>
  45. </nav>
  46. {{ end }}