Compare commits
4 Commits
cc5bbd935c
...
e551c85dd2
Author | SHA1 | Date | |
---|---|---|---|
e551c85dd2 | |||
46663891c3 | |||
74192d5252 | |||
3bb0176dcf |
27
README.md
27
README.md
@ -3,10 +3,37 @@
|
|||||||
A Collection of useful Hugo Shortcodes
|
A Collection of useful Hugo Shortcodes
|
||||||
|
|
||||||
- ## [Highlight Boxes](highlight)
|
- ## [Highlight Boxes](highlight)
|
||||||
|
|
||||||
|
Add Highlight Boxes to your Website
|
||||||
|
|
||||||
![Example Highlight Boxes in Hugo](highlight/highlights.png)
|
![Example Highlight Boxes in Hugo](highlight/highlights.png)
|
||||||
|
|
||||||
- ## [Post Archive](post_archive)
|
- ## [Post Archive](post_archive)
|
||||||
|
|
||||||
|
Add an Archive of your Posts to your Website
|
||||||
|
|
||||||
![Example Post Archive in Hugo](post_archive/post_archive.png)
|
![Example Post Archive in Hugo](post_archive/post_archive.png)
|
||||||
|
|
||||||
- ## [Inserting Raw HTML](rawhtml)
|
- ## [Inserting Raw HTML](rawhtml)
|
||||||
|
|
||||||
|
Insert raw HTML Code anywhere
|
||||||
|
|
||||||
![Example Inserting Raw HTML in Hugo](rawhtml/rawhtml.png)
|
![Example Inserting Raw HTML in Hugo](rawhtml/rawhtml.png)
|
||||||
|
|
||||||
- ## [Table of Contents](table_of_contents)
|
- ## [Table of Contents](table_of_contents)
|
||||||
|
|
||||||
|
Add a automatically generated Table of Contents to any Page/Post on your Website
|
||||||
|
|
||||||
![Example Table of Contents in hugo](table_of_contents/table_of_contents.png)
|
![Example Table of Contents in hugo](table_of_contents/table_of_contents.png)
|
||||||
|
|
||||||
|
- ## [Search Engine Optimization](search_engine_optimization)
|
||||||
|
|
||||||
|
Add automatically generated Search Engine Optimization to your Website
|
||||||
|
|
||||||
|
```html
|
||||||
|
<meta name="keywords" content="default-tag1, default-tag2, default-tag3" />
|
||||||
|
<meta name="robots" content="index, follow" />
|
||||||
|
<link rel="canonical" href="http://localhost:1313/posts/example-post" />
|
||||||
|
<link rel="alternate" href="http://localhost:1313/posts/example-post" hreflang="en-us" />
|
||||||
|
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/index.xml" title="Example Blog" />
|
||||||
|
```
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Highlight boxes in Hugo
|
# Highlight boxes in Hugo
|
||||||
|
|
||||||
|
Add Highlight Boxes to your Website
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
1. Add the shortcode files to `layouts/shortcodes`
|
1. Add the shortcode files to `layouts/shortcodes`
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Post Archive in Hugo
|
# Post Archive in Hugo
|
||||||
|
|
||||||
|
Add an Archive of your Posts to your Website
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
1. Add the shortcode file `shortcodes/archive.html` to your project > `layouts/shortcodes`
|
1. Add the shortcode file `shortcodes/archive.html` to your project > `layouts/shortcodes`
|
||||||
@ -18,7 +20,7 @@ To reach your Archive you can add a new menu entry that links to it:
|
|||||||
```
|
```
|
||||||
|
|
||||||
Add a summary (description) to each Post:
|
Add a summary (description) to each Post:
|
||||||
```yaml
|
```toml
|
||||||
+++
|
+++
|
||||||
...
|
...
|
||||||
summary = "This is a Test Page for this Usage example"
|
summary = "This is a Test Page for this Usage example"
|
||||||
@ -28,4 +30,4 @@ summary = "This is a Test Page for this Usage example"
|
|||||||
|
|
||||||
## Preview
|
## Preview
|
||||||
|
|
||||||
![Highlight Boxes in Hugo](post_archive.png)
|
![Post Archive in Hugo](post_archive.png)
|
@ -1,5 +1,7 @@
|
|||||||
# Raw HTML in Hugo
|
# Raw HTML in Hugo
|
||||||
|
|
||||||
|
Insert raw HTML Code anywhere
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
1. Add the shortcode file to `layouts/shortcodes`
|
1. Add the shortcode file to `layouts/shortcodes`
|
||||||
|
99
search_engine_optimization/README.md
Normal file
99
search_engine_optimization/README.md
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
# Search Engine Optimization in Hugo
|
||||||
|
|
||||||
|
Add automatically generated Search Engine Optimization to your Website
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
1. Add this code to your `<head></head>` structure (e.g in `layouts/_default/baseof.html`):
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!-- Site Indexing toggled by key value of `private` in Page/Post Settings -->
|
||||||
|
<meta name="robots" content=
|
||||||
|
{{- if or (.Params.private) (in (string .Permalink) "404.html") (in (string .Permalink) "404.php") -}}
|
||||||
|
"noindex, nofollow"
|
||||||
|
{{- else -}}
|
||||||
|
"index, follow"
|
||||||
|
{{ end }} />
|
||||||
|
|
||||||
|
<!-- Meta Keywords/Tags for Users to search for in Search Engines -->
|
||||||
|
<meta name="keywords" content="
|
||||||
|
{{- with .Params.tags }}
|
||||||
|
{{- range . -}}
|
||||||
|
{{ with $.Site.GetPage (printf "/%s/%s" "tags" . ) }}
|
||||||
|
{{- .Title -}},
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else -}}
|
||||||
|
Tutorials, Tips, Linux, Bash, Docker
|
||||||
|
{{- end }}" />
|
||||||
|
|
||||||
|
<!-- Canonical URLs -->
|
||||||
|
<link rel="canonical" href="{{ .Permalink }}" />
|
||||||
|
<link rel="alternate" href="{{ .Permalink }}" hreflang="{{ .Site.LanguageCode }}" />
|
||||||
|
|
||||||
|
<!-- Links to RSS Feed -->
|
||||||
|
{{ range .AlternativeOutputFormats -}}
|
||||||
|
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||||
|
{{ end -}}
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Add the default key/value `private = true` to `/archetypes/default.md`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
title: "{{ replace .Name "-" " " | title }}"
|
||||||
|
date: {{ .Date }}
|
||||||
|
draft: true
|
||||||
|
|
||||||
|
## Add this key with value 'false' for indexing by search engines enabled by default
|
||||||
|
private: false
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Add these keys and values to any page's settings:
|
||||||
|
|
||||||
|
|
||||||
|
```toml
|
||||||
|
+++
|
||||||
|
...
|
||||||
|
tags = ["fruit", "apple", "health"] # Fitting keywords that describe your post/page
|
||||||
|
private = true # true if you want it private/unlisted
|
||||||
|
+++
|
||||||
|
```
|
||||||
|
|
||||||
|
## Preview
|
||||||
|
|
||||||
|
### Public
|
||||||
|
|
||||||
|
### Example Post
|
||||||
|
|
||||||
|
```html
|
||||||
|
<meta name="keywords" content="Tag1, Tag2, Tag3" />
|
||||||
|
<meta name="robots" content="index, follow" />
|
||||||
|
<link rel="canonical" href="http://localhost:1313/" />
|
||||||
|
<link rel="alternate" href="http://localhost:1313/" hreflang="en-us" />
|
||||||
|
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/index.xml" title="Example Blog" />
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Index
|
||||||
|
|
||||||
|
```html
|
||||||
|
<meta name="keywords" content="default-tag1, default-tag2, default-tag3" />
|
||||||
|
<meta name="robots" content="index, follow" />
|
||||||
|
<link rel="canonical" href="http://localhost:1313/posts/example-post" />
|
||||||
|
<link rel="alternate" href="http://localhost:1313/posts/example-post" hreflang="en-us" />
|
||||||
|
<link rel="alternate" type="application/rss+xml" href="http://localhost:1313/index.xml" title="Example Blog" />
|
||||||
|
```
|
||||||
|
|
||||||
|
### Private
|
||||||
|
|
||||||
|
> 404 Page is private by default
|
||||||
|
|
||||||
|
```html
|
||||||
|
<meta name="keywords" content="Tag1, Tag2, Tag3" />
|
||||||
|
<meta name="robots" content="noindex, nofollow" />
|
||||||
|
<link rel="canonical" href="http://localhost:1313/404.html" />
|
||||||
|
<link rel="alternate" href="http://localhost:1313/404.html" hreflang="en-us" />
|
||||||
|
```
|
9
search_engine_optimization/archetypes/default.md
Normal file
9
search_engine_optimization/archetypes/default.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
title: "{{ replace .Name "-" " " | title }}"
|
||||||
|
date: {{ .Date }}
|
||||||
|
draft: true
|
||||||
|
|
||||||
|
## Add this key with value 'false' for indexing by search engines enabled by default
|
||||||
|
private: false
|
||||||
|
---
|
||||||
|
|
5
search_engine_optimization/content/posts/example.md
Normal file
5
search_engine_optimization/content/posts/example.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
+++
|
||||||
|
title = "Example Page"
|
||||||
|
...
|
||||||
|
private = true
|
||||||
|
+++
|
@ -1,4 +1,6 @@
|
|||||||
# Highlight boxes in Hugo
|
# Table of Contents in Hugo
|
||||||
|
|
||||||
|
Add a automatically generated Table of Contents to any Page/Post on your Website
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user