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"}}
<h1 class='title'>{{ .Title }}</h1>
<article class="h-entry">
<h1 class='title p-name'>{{ .Title }}</h1>
{{ partial "header.html" . }}
<!-- date -->
{{ if not .Date.IsZero }}
{{ $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 }}
<!-- tags -->
<div id="tags">
@ -12,14 +14,31 @@
{{ range .Param "tags" }}
{{ $name := . }}
{{ 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 }}
</ul>
</div>
<!-- content -->
<div id="contentBody">
<div id="contentBody" class="e-content">
{{ .Content }}
</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" . }}
{{ end }}

View file

@ -3,18 +3,19 @@
{{- partial "head.html" . -}}
<body>
<div id="profileContainer">
<div id="profile">
<div id="profile" class="h-card">
<header class="home">
<!-- avator -->
<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">
</div>
<!-- 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>
<!-- description -->
<p>
<p class="p-note">
{{ .Site.Params.description | safeHTML }}
</p>
<!-- navigation -->
@ -23,10 +24,20 @@
{{ range .Site.Menus.main }}
<li><a href="{{ .URL }}" aria-label="{{ .Identifier }}">{{ .Pre }}<br>{{ .Name }}</a></li>
{{ end }}
{{ range .Site.Menus.profile }}
<li><a href="{{ .URL }}" rel="me" aria-label="{{ .Identifier }}">{{ .Pre }}<br>{{ .Name }}</a></li>
{{ end }}
</ul>
</nav>
</div>
</div>
{{- partial "footer.html" . -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "{{ .Permalink }}"
}
</script>
</body>
</html>

View file

@ -1,39 +1,48 @@
<head>
<title>
{{ if eq .Title .Site.Title }}
{{ .Site.Title }}
{{ else }}
{{ .Title }} - {{ .Site.Title }}
{{ end }}
</title>
<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="supported-color-schemes" content="light dark" />
<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 }}">
<!-- Identities -->
{{ range .Site.Params.identities}}
{{- range .Site.Params.identities -}}
<link href="{{.}}" rel="me"/>
{{ end }}
{{ end -}}
<!-- 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" }}
<!-- RSS Links -->
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
<!-- 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 }}
<link rel="stylesheet" href="{{ $css.Permalink }}" integrity="{{ $css.Data.Integrity }}">
{{ $styleDark := resources.Get "css/style-dark.css" }}
{{ $markdownDark := resources.Get "css/markdown-dark.css" }}
{{- $styleDark := resources.Get "css/style-dark.css" -}}
{{- $markdownDark := resources.Get "css/markdown-dark.css" -}}
{{ $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="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous"> -->
<!-- custom css -->
{{ range .Site.Params.custom_css }}
{{- range .Site.Params.custom_css -}}
<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 */}}
{{- 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>
<![endif]-->` | safeHTML }}
<!-- Analytics -->
{{- if and (not .Site.IsServer) .Site.GoogleAnalytics -}}
{{ template "_internal/google_analytics_async.html" . }}
{{- end -}}
<!-- MathJax -->
{{ if or .Params.math .Site.Params.math }}
{{- if or .Params.math .Site.Params.math -}}
{{ partial "mathjax_support.html" . }}
{{ end }}
{{- end -}}
</head>

View file

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

View file

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

View file

@ -1,6 +1,11 @@
{{- $pctx := . -}}
{{- 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 -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}