Skip to content

Commit

Permalink
fix: rework site header for better title and decription handling (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys authored Apr 22, 2021
1 parent d51f514 commit 5eff47c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 9 deletions.
3 changes: 2 additions & 1 deletion exampleSite/content/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Documentation
description: Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there.
---

<!-- markdownlint-capture -->
Expand All @@ -13,7 +14,7 @@ title: Documentation

<!-- markdownlint-restore -->

Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there. You can find a demo and the full documentation at [https://geekdocs.de](https://geekdocs.de).
Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there.

## Features

Expand Down
2 changes: 2 additions & 0 deletions exampleSite/content/usage/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ weight: -20

This page tells you how to get started with the Geekdoc theme, including installation and basic configuration.

<!--more-->

{{< toc >}}

## Install requirements
Expand Down
6 changes: 5 additions & 1 deletion layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<html lang="{{ .Site.Language.Lang }}">

<head>
{{ partial "head" . }}
{{ partial "head/meta" . }}
<title>Lost? Don't worry</title>

{{ partial "head/favicons" . }}
{{ partial "head/others" . }}
</head>

<body>
Expand Down
6 changes: 5 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<html lang="{{ .Site.Language.Lang }}">

<head>
{{ partial "head" . }}
{{ partial "head/meta" . }}
<title>{{ if not (eq .Kind "home") }}{{ partial "title" . }} | {{ end }}{{ .Site.Title }}</title>

{{ partial "head/favicons" . }}
{{ partial "head/others" . }}
</head>

<body itemscope itemtype="https://schema.org/WebPage">
Expand Down
1 change: 1 addition & 0 deletions layouts/partials/head/favicons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="icon" href="{{ "favicon/favicon-32x32.png" | relURL }}" type="image/x-icon">
12 changes: 12 additions & 0 deletions layouts/partials/head/meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

{{ $description := default (default .Site.Title .Site.Params.description) (default .Summary .Description) }}
{{ $keywords := default .Site.Params.Keywords .Keywords }}

{{ with $description }}
<meta name="description" content="{{ . }}">
{{ end }}
{{ with $keywords }}
<meta name="keywords" content="{{ delimit . "," }}">
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ partial "title" . }}">

<title>{{ partial "title" . }} | {{ .Site.Title -}}</title>

<link rel="icon" href="{{ "favicon/favicon-32x32.png" | relURL }}" type="image/x-icon">

<link rel="preload" as="font" href="{{ "fonts/Metropolis.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous">
Expand Down

0 comments on commit 5eff47c

Please sign in to comment.