1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 21:02:09 +00:00

Indieweb: add u-photo and h-entry where relevant

Inspired by the h-entry implementation on Charlie Owen's personal
website: https://whalecoiner.com

The u-photo re-uses the 32px favicon that the browser has already
cached, so it shouldn't bloat up the page anymore.

These changes required a bit of additional CSS. I snuck in come color
changes too.
This commit is contained in:
Rohan Kumar 2020-12-29 13:12:57 -08:00
parent 3779c08a5e
commit 1e7b2008e8
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
10 changed files with 39 additions and 10 deletions

View file

@ -15,7 +15,14 @@
"hints": { "hints": {
"apple-touch-icons": "off", "apple-touch-icons": "off",
"axe/other": "error", "axe/other": "error",
"compat-api/css": "error", "compat-api/css": [
"error",
{
"ignore": [
"filter"
]
}
],
"compat-api/html": [ "compat-api/html": [
"error", "error",
{ {

View file

@ -11,8 +11,8 @@ Seirdy
====== ======
It me! This is the personal website for It me! This is the personal website for
<a class="p-author u-url" href="https://seirdy.one" rel="home"><span class="p-given-name">Rohan</span> <a class="p-author u-url" href="https://seirdy.one" rel="home">{{% indieweb-icon %}}<span class="p-given-name">Rohan</span>
<span class="p-family-name">Kumar</span></a>, a.k.a. Seirdy (online handle). <span class="p-family-name">Kumar</span></a>, a.k.a. <span class="p-nickname">Seirdy</span> (online handle).
Other versions of this website Other versions of this website
------------------------------ ------------------------------

View file

@ -0,0 +1 @@
../shortcodes/indieweb-author.html

View file

@ -0,0 +1 @@
../shortcodes/indieweb-icon.html

View file

@ -0,0 +1,4 @@
<!-- re-using the indefinetly-cached favicon to avoid bloating page size -->
{{ $favicon := resources.Get "/favicon.png" | resources.Fingerprint "md5" -}}
<a itemprop="author" class="p-author h-card" href="https://seirdy.one" rel="author"><img class="u-photo" src="{{ $favicon.RelPermalink }}" width="1em" height="1em" type="image/png" alt="Rohan Kumar" > <span class="p-given-name">Rohan</span>
<span class="p-family-name">Kumar</span></a>

View file

@ -0,0 +1,3 @@
<!-- re-using the indefinetly-cached favicon to avoid bloating page size -->
{{ $favicon := resources.Get "/favicon.png" | resources.Fingerprint "md5" -}}
<img class="u-photo" src="{{ $favicon.RelPermalink }}" width="1em" height="1em" type="image/png" alt="Rohan Kumar">

View file

@ -4,12 +4,18 @@
color: #fff; color: #fff;
} }
/* IndieWeb u-photo should be distinct from the background */
.u-photo {
-webkit-filter: invert(100%);
filter: invert(100%);
}
a { a {
color: #0af; color: #4af;
} }
a:visited { a:visited {
color: #d7c; color: #d7f;
} }
a:active { a:active {

View file

@ -67,16 +67,23 @@ nav li {
h1, h1,
h2, h2,
h3 { h3 {
line-height: 1.25em; line-height: 1.75rem;
} }
img { img:not(.u-photo) {
display: block; display: block;
height: auto; height: auto;
margin: auto; margin: auto;
max-width: 100%; max-width: 100%;
} }
.u-photo {
display: inline-block;
height: 1em;
vertical-align: -0.1em;
width: 1em;
}
pre, pre,
code { code {
border: 1px solid #bbb; border: 1px solid #bbb;

View file

@ -5,10 +5,10 @@
<h1 itemprop="name headline" class="p-name">{{ .Title }}</h1> <h1 itemprop="name headline" class="p-name">{{ .Title }}</h1>
{{ $lastmod := .Lastmod -}} {{ $lastmod := .Lastmod -}}
{{ if lt .Date $lastmod -}} {{ if lt .Date $lastmod -}}
Originally posted <a class="u-url" href="https://seirdy.one{{ .RelPermalink }}"><time class="dt-published" itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time></a> by <a itemprop="author" class="p-author h-card" href="https://seirdy.one" rel="author">{{ .Site.Author.name }}</a>.<br> Originally posted <a class="u-url" href="https://seirdy.one{{ .RelPermalink }}"><time class="dt-published" itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time></a> by {{- partial "indieweb-author.html" -}}.<br>
Last updated <time itemprop="dateModified" class="dt-updated" datetime="{{ $lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }}">Changelog</a> Last updated <time itemprop="dateModified" class="dt-updated" datetime="{{ $lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }}">Changelog</a>
{{ else -}} {{ else -}}
Posted <a class="u-url" href="https://seirdy.one{{ .RelPermalink }}"><time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time></a>. Posted <a class="u-url" href="https://seirdy.one{{ .RelPermalink }}"><time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time></a> by {{- partial "indieweb-author.html" -}}.
{{ end }} {{ end }}
</header> </header>
<section class="e-content" itemprop="articlebody"> <section class="e-content" itemprop="articlebody">

View file

@ -2,7 +2,7 @@
<nav> <nav>
<ul> <ul>
<li class="home"> <li class="home">
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> <a rel="home" href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
</li> </li>
{{ range .Site.Menus.main.ByWeight -}} {{ range .Site.Menus.main.ByWeight -}}
<li> <li>