Skip to content

Commit

Permalink
feat: Adjust post markup to conform to h-entry spec (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
palant committed Sep 8, 2020
1 parent ca1d2b1 commit cb4fb52
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions layouts/partials/components/post-copyright.html
Expand Up @@ -4,9 +4,9 @@
<ul class="post-copyright">
<li class="copyright-item author">
{{- with $author.website -}}
<span class="copyright-item-text">{{ i18n "copyrightAuthor" }}</span>{{ i18n "colon" }}<a href="{{ . }}" target="_blank" rel="noopener">{{ $author.name }}</a>
<span class="copyright-item-text">{{ i18n "copyrightAuthor" }}</span>{{ i18n "colon" }}<a href="{{ . }}" class="p-author h-card" target="_blank" rel="noopener">{{ $author.name }}</a>
{{- else -}}
<span class="copyright-item-text">{{ i18n "copyrightAuthor" }}</span>{{ i18n "colon" }}{{ $author.name }}
<span class="copyright-item-text">{{ i18n "copyrightAuthor" }}</span>{{ i18n "colon" }}<span class="p-author h-card">{{ $author.name }}</span>
{{- end -}}
</li>
{{ if $.Params.original | default $.Site.Params.original }}
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/components/post-meta.html
Expand Up @@ -3,11 +3,11 @@
<div class="post-meta">
{{ if and $.Site.Params.displayPublishedDate (not $.PublishDate.IsZero) }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.publishedDateIcon "class" "post-meta-icon") }}
<time datetime="{{ $.PublishDate.Format "2006-01-02T15:04:05-07:00" }}" class="post-meta-item published">{{ $icon }}&nbsp;{{ $.PublishDate.Format $.Site.Params.postMetaDateFormat }}</time>
<time datetime="{{ $.PublishDate.Format "2006-01-02T15:04:05-07:00" }}" class="post-meta-item published dt-published">{{ $icon }}&nbsp;{{ $.PublishDate.Format $.Site.Params.postMetaDateFormat }}</time>
{{ end }}
{{ if and $.Site.Params.displayModifiedDate (not $.Lastmod.IsZero) }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.modifiedDateIcon "class" "post-meta-icon") }}
<time datetime="{{ $.Lastmod.Format "2006-01-02T15:04:05-07:00" }}" class="post-meta-item modified">{{ $icon }}&nbsp;{{ $.Lastmod.Format $.Site.Params.postMetaDateFormat }}</time>
<time datetime="{{ $.Lastmod.Format "2006-01-02T15:04:05-07:00" }}" class="post-meta-item modified dt-updated">{{ $icon }}&nbsp;{{ $.Lastmod.Format $.Site.Params.postMetaDateFormat }}</time>
{{ end }}
{{ if and $.Site.Params.displayExpiredDate (not $.ExpiryDate.IsZero) }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.expiredDateIcon "class" "post-meta-icon") }}
Expand Down Expand Up @@ -41,7 +41,7 @@
{{- if ne $index 0 }}
{{- $.Site.Params.categoryDelimiter | default "/" -}}
{{- end -}}
<a href="{{- $link | replaceRE `\d+/(.+)` `$1` -}}" class="category-link">
<a href="{{- $link | replaceRE `\d+/(.+)` `$1` -}}" class="category-link p-category">
{{- $title -}}
</a>
{{- end -}}
Expand All @@ -59,7 +59,7 @@
<!-- Work-around for https://github.com/gohugoio/hugo/issues/6546 -->
{{- $path := (urls.Parse ($category | urlize)).Path -}}
{{- with $.Site.GetPage (printf `/categories/%s` $path) -}}
<a href="{{- .RelPermalink -}}" class="category-link">
<a href="{{- .RelPermalink -}}" class="category-link p-category">
{{- .LinkTitle | default $path -}}
</a>
{{- end -}}
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/pages/home-posts.html
Expand Up @@ -2,14 +2,14 @@
<div class="main-inner">
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
{{ range $paginator.Pages }}
<article class="content post home">
<h2 class="post-title">
<a href="{{ .RelPermalink }}" class="summary-title-link">{{ (partial "utils/title.html" (dict "$" . "title" .LinkTitle)).htmlTitle }}</a>
<article class="content post home h-entry">
<h2 class="post-title p-name">
<a href="{{ .RelPermalink }}" class="summary-title-link u-url">{{ (partial "utils/title.html" (dict "$" . "title" .LinkTitle)).htmlTitle }}</a>
</h2>
{{ if $.Site.Params.enablePostMetaInHome }}
{{ partial "components/post-meta.html" (dict "$" . "isHome" true) }}
{{ end }}
<summary class="summary">
<summary class="summary p-summary">
{{ partial "utils/summary.html" . }}
</summary>
{{ if or .Truncated .Params.summary }}
Expand Down
14 changes: 7 additions & 7 deletions layouts/partials/pages/post.html
Expand Up @@ -3,25 +3,25 @@

{{ $attrs := partial "utils/data-attributes.html" . }}

<article class="content post"
<article class="content post h-entry"
{{- if $attrs.smallCaps }} data-small-caps="true"{{ end }}
{{- with $attrs.align }} data-align="{{ . }}"{{ end }}
{{- with $attrs.type }} data-type="{{ . }}"{{ end }}
{{- with $attrs.layout }} data-layout="{{ . }}"{{ end }}
{{- if $attrs.indent }} data-indent="true"{{ end }}
{{- if $attrs.tocNum }} data-toc-num="true"{{ end }}>

<h1 class="post-title">{{ (partial "utils/title.html" (dict "$" $ "title" $.Title)).htmlTitle }}</h1>
<h1 class="post-title p-name">{{ (partial "utils/title.html" (dict "$" $ "title" $.Title)).htmlTitle }}</h1>

{{ with .Params.subtitle }}
{{- $raw := . -}}
<div class="post-subtitle">{{ partial "utils/markdownify.html" (dict "$" $ "raw" $raw "isContent" false) }}</div>
<div class="post-subtitle p-name">{{ partial "utils/markdownify.html" (dict "$" $ "raw" $raw "isContent" false) }}</div>
{{ end }}

{{ if .Site.Params.displayPostDescription }}
{{ with .Params.description }}
{{- $raw := . -}}
<div class="post-description">{{ partial "utils/markdownify.html" (dict "$" $ "raw" $raw "isContent" false) }}</div>
<div class="post-description p-summary">{{ partial "utils/markdownify.html" (dict "$" $ "raw" $raw "isContent" false) }}</div>
{{ end }}
{{ end }}

Expand All @@ -34,18 +34,18 @@ <h1 class="post-title">{{ (partial "utils/title.html" (dict "$" $ "title" $.Titl
{{- partial "utils/toc.html" . -}}
{{- end -}}

<div class="post-body">
<div class="post-body e-content">
{{ partial "utils/content.html" . }}
</div>

{{ partial "components/post-copyright.html" . }}

</article>

{{ if and .Site.Params.enableGoogleAdUnits (eq hugo.Environment "production") -}}
{{ partial "third-party/google-adsense-unit.html" . }}
{{- end }}

{{ partial "components/post-copyright.html" . }}

{{ partial "components/post-updated-badge.html" . }}

{{ partial "components/post-gitinfo.html" . }}
Expand Down

0 comments on commit cb4fb52

Please sign in to comment.