Skip to content

Commit

Permalink
feat: add dataset structured data as JSON-LD to landing page.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkettelerij committed Oct 1, 2024
1 parent 0e6c173 commit 23914e9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/engine/templates/layout.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@

<title>{{ .Config.Title }} (OGC API)</title>

<!-- Canonical -->
<!-- canonical -->
<link rel="canonical" href="{{ .Config.BaseURL }}" />
{{ range $lang := .Config.AvailableLanguages }}
<link rel="alternate" hreflang="{{ $lang }}" href="{{ $.Config.BaseURL }}?lang={{ $lang }}" />
{{ end }}

<!-- CSS -->
<!-- css -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link href="css/gokoala.css" rel="stylesheet">

<!-- Favicons -->
<!-- favicons -->
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png">
<link rel="shortcut icon" href="img/favicon.ico">

<!-- Open Graph -->
<!-- open graph -->
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ .Config.BaseURL }}" />
<meta property="og:title" content="{{ unmarkdown .Config.Title }} (OGC API)" />
<meta property="og:title" content="{{ .Config.Title }} (OGC API)" />
<meta property="og:description" content="{{ unmarkdown .Config.Abstract }}" />
<meta property="og:image" content="img/logo-opengraph.png" />
<meta property="og:image:type" content="image/png" />
Expand Down Expand Up @@ -135,7 +135,7 @@
<!-- main content -->
<main id="main">
<div class="container py-3">
<!-- Include content -->
<!-- include content -->
{{block "content" .}}{{end}}
</div>
</main>
Expand Down
24 changes: 24 additions & 0 deletions internal/ogc/common/core/templates/landing-page.go.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
{{- /*gotype: github.com/PDOK/gokoala/internal/engine.TemplateData*/ -}}
{{define "content"}}

{{/* see https://developers.google.com/search/docs/appearance/structured-data/dataset */}}
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Dataset",
"name": "{{ .Config.Title }} (OGC API)",
"description": "{{ unmarkdown .Config.Abstract }}",
"url": "{{ .Config.BaseURL }}?f=html",
{{- if .Config.Keywords -}}
"keywords": ["{{ .Config.Keywords | join ", " }}"],
{{- end -}}
"license": "{{ .Config.License.URL }}",
"isAccessibleForFree": true,
"version": "{{ .Config.Version }}",
{{- if .Config.Support -}}
"creator":{
"@type":"Organization",
"name":"{{ .Config.Support.Name }}"
}
{{- end -}}
}
</script>

<hgroup>
<h1 class="title" id="title">{{ .Config.Title }} (OGC API)</h1>
</hgroup>
Expand Down

0 comments on commit 23914e9

Please sign in to comment.