Skip to content

Commit

Permalink
Merge pull request #206 from kinow/add-schemaorg
Browse files Browse the repository at this point in the history
Closes #153 add Schema.org JSON-LD
  • Loading branch information
kinow authored Apr 19, 2024
2 parents 3d2c748 + 448ca34 commit 7863a6d
Show file tree
Hide file tree
Showing 12 changed files with 505 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.91.2'
hugo-version: '0.124.1'
extended: true
- name: Build
run: hugo --minify
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.91.2'
hugo-version: '0.124.1'
extended: true
- name: Build
run: hugo --minify
Expand Down
14 changes: 10 additions & 4 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ pygmentsStyle = "emacs"
# Enable Git variables like commit, lastmod
enableGitInfo = true

[author]
name = "Bruno P. Kinoshita"
# email = "[email protected]"

[menu]
[[menu.main]]
name = "About"
Expand Down Expand Up @@ -88,3 +84,13 @@ enableGitInfo = true
tag = "tags"
category = "categories"
series = "series"

[params]
description = "Personal website of Bruno P. Kinoshita, kinow"
images = ["/assets/photos/about/2023-me-closeup.png"]
title = "Personal website of Bruno P. Kinoshita, kinow"
copyright = "Bruno P. Kinoshita All rights reserved"
[params.social]
facebook_admin = 'bruno.kinoshita'
[author]
name = 'Bruno P. Kinoshita'
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ tags:
- github
- github actions
- python
images:
- '/assets/posts/2023-05-29-coverage-report-for-a-github-private-repository-with-github-actions/coverage.png'
---

Normally when you add test coverage to a GitHub repository, the reporting part
Expand Down
4 changes: 2 additions & 2 deletions themes/kinoshita.eti.br/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en">
{{ partial "head.html" . -}}
{{ partial "head.html" . }}
<body>
{{ partial "header.html" . -}}
{{ block "main" . }}
{{ .Content }}
{{ end }}
{{- partial "footer.html" . -}}
{{ partial "footer.html" . -}}
</body>
</html>
18 changes: 9 additions & 9 deletions themes/kinoshita.eti.br/layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{- define "main" -}}
<main class="content">
{{- .Content -}}
{{- range .Pages.ByPublishDate.Reverse -}}
<div class="post-link">
<a class="title" href="{{ .RelPermalink }}">{{- .Title -}}</a>
{{- partial "metadata.html" . -}}
</div>
{{- end -}}
</main>
<main class="content">
{{- .Content -}}
{{- range .Pages.ByPublishDate.Reverse -}}
<div class="post-link">
<a class="title" href="{{ .RelPermalink }}">{{- .Title -}}</a>
{{- partial "metadata.html" . -}}
</div>
{{- end -}}
</main>
{{- end -}}
86 changes: 41 additions & 45 deletions themes/kinoshita.eti.br/layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -1,46 +1,42 @@
{{ define "main" }}
<main>
<article class="content">
{{ if ne .Params.noheading true }}
<h1>{{ .Title }}</h1>
{{- partial "metadata.html" . -}}
{{ end }}
<aside>
{{ .TableOfContents }}
</aside>

{{ .Content }}

{{ $taxonomy := "categories" }}
{{ with .GetTerms $taxonomy }}
<p>
{{ (site.GetPage $taxonomy).LinkTitle }}:
{{ range $k, $_ := . -}}
{{ if $k }}, {{ end }}
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end }}
</p>
{{ end }}
{{ $taxonomy := "tags" }}
{{ with .GetTerms $taxonomy }}
<p>
{{ (site.GetPage $taxonomy).LinkTitle }}:
{{ range $k, $_ := . -}}
{{ if $k }}, {{ end }}
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end }}
</p>
{{ end }}

<aside class="links">
{{ with .PrevInSection }}
<a class="previous" href="{{ .Permalink }}">&laquo; Previous</a>
{{ end }}
{{ with .NextInSection }}
<a class="next" href="{{ .Permalink }}">Next &raquo;</a>
{{ end }}
</aside>

</article>
</main>
{{ end }}
<main>
<article class="content">
{{- if ne .Params.noheading true }}
<h1>{{ .Title }}</h1>
{{ partial "metadata.html" . -}}
{{- end }}
<aside>
{{ .TableOfContents }}
</aside>
{{ .Content }}
{{- $taxonomy := "categories" -}}
{{- with .GetTerms $taxonomy }}
<p>
{{ (site.GetPage $taxonomy).LinkTitle }}:
{{- range $k, $_ := . -}}
{{ if $k }}, {{ end }}
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end }}
</p>
{{- end -}}
{{- $taxonomy := "tags" -}}
{{- with .GetTerms $taxonomy }}
<p>
{{ (site.GetPage $taxonomy).LinkTitle }}:
{{- range $k, $_ := . -}}
{{ if $k }}, {{ end }}
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end }}
</p>
{{- end }}
<aside class="links">
{{ with .PrevInSection -}}
<a class="previous" href="{{ .Permalink }}">&laquo; Previous</a>
{{- end }}
{{- with .NextInSection -}}
<a class="next" href="{{ .Permalink }}">Next &raquo;</a>
{{- end }}
</aside>
</article>
</main>
{{- end -}}
29 changes: 15 additions & 14 deletions themes/kinoshita.eti.br/layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{ template "_internal/opengraph.html" . }}
{{- range .AlternativeOutputFormats }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
{{- $sass := resources.Get "sass/main.scss" -}}
{{- $style := $sass | resources.ToCSS | resources.Fingerprint -}}
<link rel="stylesheet" type="text/css" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
{{- $title := print .Site.Title " | " .Title }}
{{ if .IsHome }}{{ $title = .Site.Title }}{{ end -}}
<title>{{ $title }}</title>
</head>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{ partial "opengraph.html" . -}}
{{- range .AlternativeOutputFormats -}}
{{ printf ` <link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
{{- $sass := resources.Get "sass/main.scss" -}}
{{- $style := $sass | resources.ToCSS | resources.Fingerprint -}}
<link rel="stylesheet" type="text/css" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
{{- $title := print .Site.Title " | " .Title }}
{{ if .IsHome }}{{ $title = .Site.Title }}{{ end -}}
<title>{{ $title }}</title>
{{- partial "site_schema.html" . }}
</head>
52 changes: 26 additions & 26 deletions themes/kinoshita.eti.br/layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<header role="banner" class="content">
<nav id="nav" aria-label="Main" role="navigation" class="content">
<ul>
{{- $currentPage := . -}}
{{- range .Site.Menus.main -}}
{{- $menu_item_url := .URL | relLangURL -}}
{{- $page_url:= $currentPage.RelPermalink | relLangURL -}}
<li>
<a
href="{{- .URL -}}"
{{ if eq $menu_item_url $page_url }}
class="active"
aria-current="true"
<header role="banner" class="content">
<nav id="nav" aria-label="Main" role="navigation" class="content">
<ul>
{{- $currentPage := . -}}
{{- range .Site.Menus.main -}}
{{- $menu_item_url := .URL | relLangURL -}}
{{- $page_url:= $currentPage.RelPermalink | relLangURL -}}
<li>
<a
href="{{- .URL -}}"
{{ if eq $menu_item_url $page_url }}
class="active"
aria-current="true"
{{- end -}}
>
{{- if .Pre -}}
{{- $icon := printf "<i data-feather=\"%s\"></i> " .Pre | safeHTML -}}
{{- $icon -}}
{{- end -}}
>
{{- if .Pre -}}
{{- $icon := printf "<i data-feather=\"%s\"></i> " .Pre | safeHTML -}}
{{- $icon -}}
{{- end -}}
{{- $text := print .Name | safeHTML -}}
{{- $text -}}
</a>
</li>
{{- end }}
</ul>
</nav>
</header>
{{- $text := print .Name | safeHTML -}}
{{- $text -}}
</a>
</li>
{{- end }}
</ul>
</nav>
</header>
19 changes: 6 additions & 13 deletions themes/kinoshita.eti.br/layouts/partials/metadata.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
<div class="metadata">
{{ $dateTime := .PublishDate.Format "2006-01-02" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }}
<i data-feather="calendar"></i>
<time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>
<!--{{ with .Params.tags }}-->
<!-- <i data-feather="tag"></i>-->
<!-- {{ range . }}-->
<!-- {{ $href := print (absURL "tags/") (urlize .) }}-->
<!-- <a class="btn btn-sm btn-outline-dark tag-btn" href="{{ $href }}">{{ . }}</a>-->
<!-- {{ end }}-->
<!--{{ end }}-->
</div>
<div class="metadata">
{{- $dateTime := .PublishDate.Format "2006-01-02" -}}
{{- $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }}
<i data-feather="calendar"></i>
<time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>
</div>
72 changes: 72 additions & 0 deletions themes/kinoshita.eti.br/layouts/partials/opengraph.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<meta property="og:url" content="{{ .Permalink }}">

{{- with or site.Title site.Params.title | plainify }}
<meta property="og:site_name" content="{{ . }}">
{{- end }}

{{- with or .Title site.Title site.Params.title | plainify}}
<meta property="og:title" content="{{ . }}">
{{- end }}

{{- with or .Description .Summary site.Params.description | plainify }}
<meta property="og:description" content="{{ . }}">
{{- end }}

{{- with or .Params.locale site.Language.LanguageCode site.Language.Lang }}
<meta property="og:locale" content="{{ . }}">
{{- end }}

{{- if .IsPage }}
<meta property="og:type" content="article">
<meta property="article:section" content="{{ .Section }}">
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
{{- with .PublishDate }}
<meta property="article:published_time" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
{{- end }}
{{- with .Lastmod }}
<meta property="article:modified_time" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
{{- end }}
{{- range .GetTerms "tags" | first 6 }}
<meta property="article:tag" content="{{ .Page.Title | plainify }}">
{{- end }}
{{- else }}
<meta property="og:type" content="website">
{{- end }}

{{- with partial "_funcs/get-page-images" . }}
{{- range . | first 6 }}
<meta property="og:image" content="{{ .Permalink }}">
{{- end }}
{{- end }}

{{- with .Params.audio }}
{{- range . | first 6 }}
<meta property="og:audio" content="{{ . | absURL }}">
{{- end }}
{{- end }}

{{- with .Params.videos }}
{{- range . | first 6 }}
<meta property="og:video" content="{{ . | absURL }}">
{{- end }}
{{- end }}

{{- range .GetTerms "series" }}
{{- range .Pages | first 7 }}
{{- if ne $ . }}
<meta property="og:see_also" content="{{ .Permalink }}">
{{- end }}
{{- end }}
{{- end }}

{{- with site.Params.social }}
{{- if reflect.IsMap . }}
{{- with .facebook_app_id }}
<meta property="fb:app_id" content="{{ . }}">
{{- else }}
{{- with .facebook_admin }}
<meta property="fb:admins" content="{{ . }}">
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit 7863a6d

Please sign in to comment.