Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/parsiya/Hugo-Octopress.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsiya@gmail.com <parsiya@gmail.com>2016-04-03 19:57:56 +0300
committerparsiya@gmail.com <parsiya@gmail.com>2016-04-03 19:57:56 +0300
commit16729781420fc9a1dc65218c2e87f6d917e5e205 (patch)
tree9ea4a94e115bf30b637f5b0866272bc971ae2dab
parent7061ae9dcabf869a4e10088d9d3e95676d4d968e (diff)
Add 404.html customization using the config file. Fixes #10
-rw-r--r--README.md17
-rw-r--r--layouts/404.html14
-rw-r--r--sample-config.toml6
3 files changed, 34 insertions, 3 deletions
diff --git a/README.md b/README.md
index 4f09273..aa0d474 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,7 @@ Hugo-Octopress is a port of the classic [Octopress][octopress-link] theme to [Hu
- [Hugo page summary bug](#summary)
- [License page](#licensepage)
- [Table of contents](#tableofcontents)
+- [Not Found or 404.html](#notfound)
- [Issues/TODO](#issues)
- [Attribution](#attribution)
- [Ported by](#porterby)
@@ -103,6 +104,12 @@ post = "/blog/:year-:month-:day-:title/"
# enable/disable Table of Contents in each page -
tableOfContents = false
+ # 404.html header and text -both support markdown
+ notfound_header = "There's nothing here"
+
+ notfound_text = """Please either go back or use the navigation/sidebar menus.
+ """
+
```
## <a name="highlight"></a>Code highlight
@@ -329,6 +336,16 @@ There are two ways to enable Table of Contents:
The `toc` variable in frontmatter has priority. If it is set `false` then the config file is ignored. It is recommended to not set use the config file and enable the ToC for individual pages. Otherwise, it can be enabled for all pages in the config file and disabled for specific pages using the frontmatter.
+## <a name="notfound"></a>Not Found or 404.html
+You can customize the `404.html` page in the config menu. For extensive customization you can modify the template at `hugo-octopress\layouts\404.html`.
+
+There are two optional parameters in the config file and both support markdown:
+
+* notfound_header: 404 page title
+* notfound_text: 404 page text
+
+If they are not set in the config file, a default page is generated.
+
## <a name="issues"></a>Issues/TODO
If you see any issues/bugs or you are looking for some features please use the Github issue tracker. Please keep in my mind that my day job is not development and I may be slow in fixing things (or I may ask you to help me with it).
diff --git a/layouts/404.html b/layouts/404.html
index b3c5d3e..56d3a08 100644
--- a/layouts/404.html
+++ b/layouts/404.html
@@ -8,11 +8,19 @@
<article role="article">
<header>
<h1 class="entry-title">
- Not Found - 404
+ {{ if isset .Site.Params "notfound_header" }}
+ {{ .Site.Params.notfound_header | markdownify }}
+ {{ else }}
+ Not Found
+ {{ end }}
</h1>
</header>
<div id="blog-archives" class="category">
- You can never go back.
+ {{ if isset .Site.Params "notfound_text" }}
+ {{ .Site.Params.notfound_text | markdownify }}
+ {{ else }}
+ Please either go back or use the navigation/sidebar menus.
+ {{ end }}
</div>
</article>
</div>
@@ -21,4 +29,4 @@
</div>
</div>
-{{ partial "footer.html" . }} \ No newline at end of file
+{{ partial "footer.html" . }}
diff --git a/sample-config.toml b/sample-config.toml
index 370ef76..4448fbd 100644
--- a/sample-config.toml
+++ b/sample-config.toml
@@ -105,6 +105,12 @@ post = "/blog/:year-:month-:day-:title/" # change the post URL to look like the
# paths should be relative to the `static` directory (either the website static directory or the theme one)
# custom_css = ["css/custom.css","css/custom2.css"]
+ # 404.html header and text -both support markdown
+ notfound_header = "There's nothing here"
+
+ notfound_text = """Please either go back or use the navigation/sidebar menus.
+ """
+
# blackfriday is Hugo's markdown engine. Options are at: https://gohugo.io/overview/configuration/ (scroll down to "Configure Blackfriday rendering")
[blackfriday]
hrefTargetBlank = true # open the external links in a new window