Added h-card, h-entry, rel-me links

This commit is contained in:
Brandon Rozek 2022-02-15 01:13:11 -05:00
parent d683165125
commit e699ce661e
6 changed files with 86 additions and 48 deletions

View file

@ -1,10 +1,12 @@
{{ define "main"}} {{ define "main"}}
<h1 class='title'>{{ .Title }}</h1> <article class="h-entry">
<h1 class='title p-name'>{{ .Title }}</h1>
{{ partial "header.html" . }} {{ partial "header.html" . }}
<!-- date --> <!-- date -->
{{ if not .Date.IsZero }} {{ if not .Date.IsZero }}
{{ $singlePageDateFormat := .Site.Params.singlePageDateFormat | default "January 2, 2006"}} {{ $singlePageDateFormat := .Site.Params.singlePageDateFormat | default "January 2, 2006"}}
<p class="date">{{ .Date.Format $singlePageDateFormat }}</p> <p class="date"><time class="dt-published" datetime='{{ .Date.Format "2006-01-02" }}'>{{ .Date.Format $singlePageDateFormat }}</time></p>
<a style="display: none" class="u-url" href="{{ .Permalink }}"></a>
{{ end }} {{ end }}
<!-- tags --> <!-- tags -->
<div id="tags"> <div id="tags">
@ -12,14 +14,31 @@
{{ range .Param "tags" }} {{ range .Param "tags" }}
{{ $name := . }} {{ $name := . }}
{{ with $.Site.GetPage (printf "/tags/%s" ($name | urlize)) }} {{ with $.Site.GetPage (printf "/tags/%s" ($name | urlize)) }}
<li><a href="{{ .Permalink }}">{{ $name }}</a></li> <li><a class="p-category" href="{{ .Permalink }}">{{ $name }}</a></li>
{{ end }} {{ end }}
{{ end }} {{ end }}
</ul> </ul>
</div> </div>
<!-- content --> <!-- content -->
<div id="contentBody"> <div id="contentBody" class="e-content">
{{ .Content }} {{ .Content }}
</div> </div>
</article>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "NewsArticle",
"headline": "{{ .Title }}",
"image": [
"{{ .Site.BaseURL }}/img/{{ .Site.Params.avatar }}"
],
"datePublished": "{{ .Date.Format "2006-01-02" }}",
"author": [{
"@type": "Person",
"name": "{{ .Site.Params.Author }}",
"url": "{{ .Site.BaseURL }}"
}]
}
</script>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}
{{ end }} {{ end }}

View file

@ -3,18 +3,19 @@
{{- partial "head.html" . -}} {{- partial "head.html" . -}}
<body> <body>
<div id="profileContainer"> <div id="profileContainer">
<div id="profile"> <div id="profile" class="h-card">
<header class="home"> <header class="home">
<!-- avator --> <!-- avator -->
<div class="avatar"> <div class="avatar">
<img class="avatarMask" src="{{ .Site.BaseURL }}/img/{{ .Site.Params.avatar }}" alt="avatar"> <img class="avatarMask u-photo" src="{{ .Site.BaseURL }}/img/{{ .Site.Params.avatar }}" alt="avatar">
<img src="{{ .Site.BaseURL }}/img/avatar-border.svg" alt="avatar-border"> <img src="{{ .Site.BaseURL }}/img/avatar-border.svg" alt="avatar-border">
</div> </div>
<!-- author --> <!-- author -->
<h1 class="author title">{{ .Site.Params.Author }}</h1> <h1 class="author title p-name">{{ .Site.Params.Author }}</h1>
<a style="display: none" rel="me" class="u-url" href="https://brandonrozek.com"></a>
</header> </header>
<!-- description --> <!-- description -->
<p> <p class="p-note">
{{ .Site.Params.description | safeHTML }} {{ .Site.Params.description | safeHTML }}
</p> </p>
<!-- navigation --> <!-- navigation -->
@ -23,10 +24,20 @@
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
<li><a href="{{ .URL }}" aria-label="{{ .Identifier }}">{{ .Pre }}<br>{{ .Name }}</a></li> <li><a href="{{ .URL }}" aria-label="{{ .Identifier }}">{{ .Pre }}<br>{{ .Name }}</a></li>
{{ end }} {{ end }}
{{ range .Site.Menus.profile }}
<li><a href="{{ .URL }}" rel="me" aria-label="{{ .Identifier }}">{{ .Pre }}<br>{{ .Name }}</a></li>
{{ end }}
</ul> </ul>
</nav> </nav>
</div> </div>
</div> </div>
{{- partial "footer.html" . -}} {{- partial "footer.html" . -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "{{ .Permalink }}"
}
</script>
</body> </body>
</html> </html>

View file

@ -1,39 +1,48 @@
<head> <head>
<title>
{{ if eq .Title .Site.Title }}
{{ .Site.Title }}
{{ else }}
{{ .Title }} - {{ .Site.Title }}
{{ end }}
</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>
{{- if eq .Title .Site.Title -}}
{{ .Site.Title }}
{{- else -}}
{{ .Title }} - {{ .Site.Title }}
{{- end -}}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="supported-color-schemes" content="light dark" />
<meta name="author" content="{{ .Site.Params.Author }}" /> <meta name="author" content="{{ .Site.Params.Author }}" />
<meta name="robots" content="index,follow" />
<link rel="shortcut icon" type="image/x-icon" href="{{ .Site.BaseURL }}img/{{ .Site.Params.favicon }}"> <link rel="shortcut icon" type="image/x-icon" href="{{ .Site.BaseURL }}img/{{ .Site.Params.favicon }}">
<!-- Identities --> <!-- Identities -->
{{ range .Site.Params.identities}} {{- range .Site.Params.identities -}}
<link href="{{.}}" rel="me"/> <link href="{{.}}" rel="me"/>
{{ end }} {{ end -}}
<!-- css --> <!-- RSS Links -->
{{ $style := resources.Get "css/style.css" }} {{ range .AlternativeOutputFormats -}}
{{ $markdown := resources.Get "css/markdown.css" }} {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ $fontawesome := resources.Get "css/fontawesome.css" }} {{ end -}}
{{ $syntaxHighlight := resources.Get "css/syntax-highlight.css" }}
<!-- CSS -->
{{- $style := resources.Get "css/style.css" -}}
{{- $markdown := resources.Get "css/markdown.css" -}}
{{- $fontawesome := resources.Get "css/fontawesome.css" -}}
{{- $syntaxHighlight := resources.Get "css/syntax-highlight.css" -}}
{{ $css := slice $style $markdown $fontawesome $syntaxHighlight | resources.Concat "css/style.css" | resources.Minify | resources.Fingerprint }} {{ $css := slice $style $markdown $fontawesome $syntaxHighlight | resources.Concat "css/style.css" | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $css.Permalink }}" integrity="{{ $css.Data.Integrity }}"> <link rel="stylesheet" href="{{ $css.Permalink }}" integrity="{{ $css.Data.Integrity }}">
{{ $styleDark := resources.Get "css/style-dark.css" }} {{- $styleDark := resources.Get "css/style-dark.css" -}}
{{ $markdownDark := resources.Get "css/markdown-dark.css" }} {{- $markdownDark := resources.Get "css/markdown-dark.css" -}}
{{ $cssDark := slice $styleDark $markdownDark | resources.Concat "css/style-dark.css" | resources.Minify | resources.Fingerprint }} {{ $cssDark := slice $styleDark $markdownDark | resources.Concat "css/style-dark.css" | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $cssDark.Permalink }}" media="(prefers-color-scheme: dark)" integrity="{{ $cssDark.Data.Integrity }}"> <link rel="stylesheet" href="{{ $cssDark.Permalink }}" media="(prefers-color-scheme: dark)" integrity="{{ $cssDark.Data.Integrity }}">
<!-- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous"> --> <!-- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous"> -->
<!-- custom css --> <!-- custom css -->
{{ range .Site.Params.custom_css }} {{- range .Site.Params.custom_css -}}
<link rel="stylesheet" href="{{ . }}"> <link rel="stylesheet" href="{{ . }}">
{{ end }} {{ end -}}
{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}} {{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}}
{{- template "_internal/opengraph.html" . -}} {{- template "_internal/opengraph.html" . -}}
@ -51,14 +60,8 @@
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->` | safeHTML }} <![endif]-->` | safeHTML }}
<!-- Analytics -->
{{- if and (not .Site.IsServer) .Site.GoogleAnalytics -}}
{{ template "_internal/google_analytics_async.html" . }}
{{- end -}}
<!-- MathJax --> <!-- MathJax -->
{{ if or .Params.math .Site.Params.math }} {{- if or .Params.math .Site.Params.math -}}
{{ partial "mathjax_support.html" . }} {{ partial "mathjax_support.html" . }}
{{ end }} {{- end -}}
</head> </head>

View file

@ -1,13 +1,13 @@
<header> <header class="h-card p-author">
<!-- avator --> <!-- avator -->
<div class="avatar"> <div class="avatar">
<img class="avatarMask" src="{{ .Site.BaseURL }}/img/{{ .Site.Params.avatar }}" alt="{{ .Site.Params.avatarDescription }}"> <img class="avatarMask u-photo" src="{{ .Site.BaseURL }}/img/{{ .Site.Params.avatar }}" alt="{{ .Site.Params.avatarDescription }}">
<a href="{{ .Site.BaseURL }}"><img class="avatar-border" src="{{ .Site.BaseURL }}/img/avatar-border.svg" alt=""></a> <a href="{{ .Site.BaseURL }}"><img class="avatar-border" src="{{ .Site.BaseURL }}/img/avatar-border.svg" alt=""></a>
</div> </div>
<!-- author --> <!-- author -->
<h2><a class="author" href="{{ .Site.BaseURL }}">{{ .Site.Params.Author }}</a></h2> <h2 class="p-name"><a class="author u-url" rel="me" href="{{ .Site.BaseURL }}">{{ .Site.Params.Author }}</a></h2>
<!-- Alternative Formats --> <!-- description (for h-card) -->
{{ range .AlternativeOutputFormats -}} <p style="display: none" class="p-note">
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ .Site.Params.description | safeHTML }}
{{ end -}} </p>
</header> </header>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
{{ partial "head.html" . }} {{- partial "head.html" . -}}
<body> <body>
{{ block "main" . }}{{ end }} {{- block "main" . -}}{{- end -}}
</body> </body>
</html> </html>

View file

@ -1,6 +1,11 @@
{{- $pctx := . -}} {{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := $pctx.RegularPages -}} {{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}} {{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}} {{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}} {{- $pages = $pages | first $limit -}}