1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-12-17 22:32:10 +00:00

Site structure: emphasize current on home, meta

- microdata for CompleteDataFeed on /posts.html instead of DataFeed
- make the home link <strong> when it's the current page, just like the
  other navlinks.
This commit is contained in:
Rohan Kumar 2022-04-19 20:16:20 -07:00
parent 49c14a8b2a
commit 02bf9e6a6b
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 17 additions and 5 deletions

View file

@ -3,8 +3,18 @@
<nav aria-label="Main navigation"> <nav aria-label="Main navigation">
<ul class="unstyled-list"> <ul class="unstyled-list">
{{- $currentPage := . -}} {{- $currentPage := . -}}
{{- $isHome := false -}}
{{- if eq $currentPage.Permalink .Site.BaseURL -}}
{{- $isHome = true -}}
{{- end -}}
<li itemscope itemtype="https://schema.org/SiteNavigationElement"> <li itemscope itemtype="https://schema.org/SiteNavigationElement">
<a rel="home" itemprop="url" href="{{ .Site.BaseURL }}"{{- if eq $currentPage.Permalink .Site.BaseURL -}} aria-current="page"{{- end -}}><span itemprop="name">{{ .Site.Title }}</span></a> <a rel="home" itemprop="url" href="{{ .Site.BaseURL }}"{{- if $isHome -}} aria-current="page"{{- end -}}>
{{- if $isHome -}}
<strong itemprop="name">{{ .Site.Title }}</strong>
{{- else -}}
<span itemprop="name">{{ .Site.Title }}</span>
{{- end -}}
</a>
</li> </li>
{{ range .Site.Menus.main -}} {{ range .Site.Menus.main -}}
{{ $isCurrent := false }} {{ $isCurrent := false }}

View file

@ -1,7 +1,9 @@
<section class="h-feed hfeed" itemscope itemtype="https://schema.org/DataFeed"> {{ $isStandalone := false }}
{{ $allPosts := false }}
{{ if eq .RelPermalink "/posts.html" -}} {{ if eq .RelPermalink "/posts.html" -}}
{{ $allPosts = true }} {{ $isStandalone = true }}
{{ end }}
<section class="h-feed hfeed" itemscope itemtype="https://schema.org/{{ if $isStandalone }}Complete{{ end }}DataFeed">
{{ if $isStandalone -}}
<h1 class="p-name" itemprop="name headline" id="posts">Posts</h1> <h1 class="p-name" itemprop="name headline" id="posts">Posts</h1>
{{ else -}} {{ else -}}
<h2 class="p-name" itemprop="name" id="posts">Posts</h2> <h2 class="p-name" itemprop="name" id="posts">Posts</h2>
@ -11,7 +13,7 @@
<p><em>Timestamp format: <code>YYYY-MM-DD</code>, as per <cite><a href="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a></cite> and <cite><a href="https://xkcd.com/1179/">ISO 8601</a></cite></em></p> <p><em>Timestamp format: <code>YYYY-MM-DD</code>, as per <cite><a href="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a></cite> and <cite><a href="https://xkcd.com/1179/">ISO 8601</a></cite></em></p>
<ol class="unstyled-list" reversed> <ol class="unstyled-list" reversed>
{{- range where site.RegularPages "Type" "in" site.Params.mainSections }} {{- range where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- if or ($allPosts) (.Params.featured) -}} {{- if or ($isStandalone) (.Params.featured) -}}
<li> <li>
<article class="h-entry hentry" itemprop="dataFeedElement" itemscope itemtype="https://schema.org/BlogPosting https://schema.org/DataFeedItem"> <article class="h-entry hentry" itemprop="dataFeedElement" itemscope itemtype="https://schema.org/BlogPosting https://schema.org/DataFeedItem">
<h3 itemprop="name headline" class="p-name entry-title"> <h3 itemprop="name headline" class="p-name entry-title">