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 <parsiya@gmail.com>2018-03-29 02:58:45 +0300
committerparsiya <parsiya@gmail.com>2018-03-29 02:58:45 +0300
commit0da406a3336f3b54f674297ea2222320a118d9aa (patch)
tree39ee71d9851cd02591aca3d61353cb19fd949b7f
parenta8d0587810a6459fc07d01e947ad50cabfab142d (diff)
Add individual page layout to theme and README
-rw-r--r--README.md9
-rwxr-xr-xlayouts/page/single.html37
2 files changed, 46 insertions, 0 deletions
diff --git a/README.md b/README.md
index 287946a..1b2b436 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,7 @@ Hugo-Octopress is a port of the classic [Octopress][octopress-link] theme to [Hu
- [Table of contents](#tableofcontents)
- [Not Found or 404.html](#notfound)
- [Taxonomy pages](#taxonomy)
+- [Individual pages](#page)
- [Disqus](#disqus)
- [Issues/TODO](#issues)
- [Attribution](#attribution)
@@ -423,6 +424,14 @@ Note: As of Hugo 0.33, `indexes` has been removed. If your taxonomy pages are no
* `/layouts/category/category.html`
* `/layouts/tag/tag.html`
+## <a name="page"></a>Individual pages
+Individual pages can be created in two ways:
+
+* Create a new content file in `content/page`.
+* Set the type of page to `page` in frontmatter. E.g. `type: page`.
+
+The template to individual page is at `Hugo-Octopress/layouts/page/single.html`. It can be overridden by a file in the website's `layouts/page/single.html`.
+
## <a name="disqus"></a>Disqus
Hugo supports Disqus. Note that previously Disqus short name was `[params]/disqusShortname` but it stopped working. It's most likely because my custom variable had the same name as Hugo's internal variable for Disqus. Disqus shortname is now directly in the config file (similar to baseurl for example):
diff --git a/layouts/page/single.html b/layouts/page/single.html
new file mode 100755
index 0000000..3ff3f6e
--- /dev/null
+++ b/layouts/page/single.html
@@ -0,0 +1,37 @@
+<!-- Layout for individual pages -->
+
+{{ partial "header.html" . }}
+
+<div id="main">
+ <div id="content">
+ <div>
+ <article class="hentry" role="article">
+ <header>
+ <h1 class="entry-title">
+ {{ .Title }} <!-- we don't need page title to be a link on the actual page -->
+ </h1>
+ <p class="meta">{{ .Date.Format "Jan 2, 2006" }} - {{ .ReadingTime }} minute read - {{ if .Site.Params.disqusShortname }} <a href="{{ .Permalink }}#disqus_thread">Comments</a>{{ end }}
+
+ <!-- if you want anything in the header between Disqus comments and categories add them here -->
+
+ {{ if isset .Params "categories" }}
+ <!-- <br/> this will make the categories go to the second line and mess with the title -->
+ {{ range .Params.categories }}<a class="label" href="{{ "/categories/" | absURL }}{{ . | urlize | lower }}">{{ . }}</a>{{ end }}
+ {{ end }}</p>
+ </header>
+ <div class="entry-content">
+ <!-- insert table of contents if it is set either in the config file or in the frontmatter - frontmatter has priority -->
+ {{ $.Scratch.Set "pagetoc" .TableOfContents }}
+ {{ if or (and (isset .Params "toc") (eq .Params.toc true)) (and (not (isset .Params "toc")) (eq .Site.Params.tableOfContents true)) }}
+ {{ $.Scratch.Get "pagetoc" }}
+ {{ end }}
+ {{ .Content }}
+ </div>
+ {{ partial "post_footer.html" . }}
+ </article>
+ </div>
+ {{ partial "sidebar.html" . }}
+ </div>
+</div>
+
+{{ partial "footer.html" . }}