mirror of
https://github.com/Noettore/cocoa-eh-hugo-theme.git
synced 2025-10-15 03:36:41 +02:00
Merged new_lists_sections into master
This commit is contained in:
52
README.md
52
README.md
@@ -10,14 +10,18 @@ A [Demo](https://kodewolf.com) is available.
|
|||||||
* Suited for blogging and personal webpages
|
* Suited for blogging and personal webpages
|
||||||
* Disqus support
|
* Disqus support
|
||||||
* Built-in support for 404 pages
|
* Built-in support for 404 pages
|
||||||
* Syntax highlighting
|
* Syntax highlighting with hightlightjs
|
||||||
* Logo and title in the header for a clear identity
|
* Logo and title in the header for a clear identity
|
||||||
|
* Possibility to have sections with a header and a list of articles
|
||||||
|
* Possibility to have single pages
|
||||||
|
|
||||||
#### Differences from the original Cocoa
|
#### Differences from the original Cocoa
|
||||||
|
|
||||||
This theme is less minimalist than the original Cocoa, with some new features :
|
This theme is less minimalist than the original Cocoa, with some new features :
|
||||||
|
|
||||||
* Displays a logo on the side of the header, and there is a title different from the author name.
|
* Displays a logo on the side of the header, and there is a title different from the author name.
|
||||||
|
* Very modulable with sections and single pages.
|
||||||
|
* Group articles by month and year
|
||||||
* Fonts are different : stronger and sharper, with a clear identity.
|
* Fonts are different : stronger and sharper, with a clear identity.
|
||||||
* The font size in articles is higher, the text justified and lines are more spaced.
|
* The font size in articles is higher, the text justified and lines are more spaced.
|
||||||
* On mobile : display the date next to article's titles.
|
* On mobile : display the date next to article's titles.
|
||||||
@@ -55,20 +59,46 @@ Please see the sample [`config.toml`](https://github.com/fuegowolf/cocoa-eh-hugo
|
|||||||
|
|
||||||
Note that if you already use cocoa but have updated to Hugo 0.18, you must lowercase every params of your existing `config.toml`. (like in the sample)
|
Note that if you already use cocoa but have updated to Hugo 0.18, you must lowercase every params of your existing `config.toml`. (like in the sample)
|
||||||
|
|
||||||
#### Creating Content
|
#### Blog posts
|
||||||
|
|
||||||
* Posts should generally go under a `content/blog` directory. Typically you would run:
|
The core of this theme is a **Blog**. The last 5 months with articles will be displayed on the [homepage](#homepage), and all articles will be available in the `blog` section.
|
||||||
|
|
||||||
|
If you want to add a post, just type :
|
||||||
|
|
||||||
````
|
````
|
||||||
hugo new blog/your-new-post.md
|
hugo new blog/your-new-post.md
|
||||||
````
|
````
|
||||||
|
|
||||||
You may need to set `draft = false` in the new post's front matter for it to appear on your site.
|
#### Homepage
|
||||||
|
|
||||||
* Fixed pages such as an About page should preferably go under a `content/fixed` or be present at the root of the `contents` directory.
|
The homepage is meant to display few articles and the `home.md` post, which should be in the root of the folder. If you don't want to display something special on the front page, just don't create this file. If you want to add text before the article list :
|
||||||
|
|
||||||
````
|
````
|
||||||
$ hugo new fixed/about.md
|
hugo new home.md
|
||||||
|
````
|
||||||
|
|
||||||
|
#### Sections
|
||||||
|
|
||||||
|
You can add **Sections** like Projects or Talks by adding a directory with the name of the section. They will be automatically in the header.
|
||||||
|
|
||||||
|
* If you only want a list with articles, just create an article :
|
||||||
|
|
||||||
|
````
|
||||||
|
hugo new projects/my-project.md
|
||||||
|
````
|
||||||
|
|
||||||
|
* If you want to add a header to you section, with some markdown too, create an article with the same name as your section.
|
||||||
|
|
||||||
|
````
|
||||||
|
$ hugo new projects/projects.md
|
||||||
|
````
|
||||||
|
|
||||||
|
#### Single pages
|
||||||
|
|
||||||
|
If you want to add a small page like an About one, just create an article in the root. It will be automatically added to the header too.
|
||||||
|
|
||||||
|
````
|
||||||
|
$ hugo new about.md
|
||||||
````
|
````
|
||||||
|
|
||||||
#### Example site
|
#### Example site
|
||||||
@@ -77,6 +107,16 @@ An example site is available in `exampleSite/`.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
> v0.5.0
|
||||||
|
|
||||||
|
- Add an automatic way to add sections
|
||||||
|
- Add the possibility to add a header to a section list page
|
||||||
|
- Add an automatic way to add single pages
|
||||||
|
- Group blog articles by month and year
|
||||||
|
- Add a homepage with the possibility of adding a small text and few articles
|
||||||
|
- Update hightlightjs to v9.9.0
|
||||||
|
- Few deletions of obsolete lines
|
||||||
|
|
||||||
> v0.4.0
|
> v0.4.0
|
||||||
|
|
||||||
- Add logo and a title in header instead of only the author name
|
- Add logo and a title in header instead of only the author name
|
||||||
|
@@ -8,17 +8,13 @@ layoutdir = "layouts"
|
|||||||
publishdir = "public"
|
publishdir = "public"
|
||||||
author = "Alexis Tacnet"
|
author = "Alexis Tacnet"
|
||||||
title = "Cocoa Enhanced"
|
title = "Cocoa Enhanced"
|
||||||
pygmentsuseclasses = true
|
|
||||||
disqusshortname = ""
|
disqusshortname = ""
|
||||||
pluralizelisttitles = false
|
pluralizelisttitles = false
|
||||||
|
|
||||||
[permalinks]
|
[permalinks]
|
||||||
fixed = ":title/"
|
|
||||||
blog = "blog/:slug/"
|
blog = "blog/:slug/"
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
author = "Alexis Tacnet"
|
|
||||||
cachebuster = true
|
|
||||||
dateform = "Jan 2, 2006"
|
dateform = "Jan 2, 2006"
|
||||||
dateformfull = "Mon Jan 2 2006 15:04:05 MST"
|
dateformfull = "Mon Jan 2 2006 15:04:05 MST"
|
||||||
description = "Example blog"
|
description = "Example blog"
|
||||||
|
@@ -1,14 +1,12 @@
|
|||||||
+++
|
+++
|
||||||
date = "2015-08-22T06:42:21-07:00"
|
date = "2015-08-22"
|
||||||
draft = false
|
|
||||||
title = "About"
|
title = "About"
|
||||||
|
|
||||||
+++
|
+++
|
||||||
|
|
||||||
Along with [Ford Prefect](https://en.wikipedia.org/wiki/Ford_Prefect_\(character\)), Dent barely escapes the Earth's destruction as it is demolished to make way for a *hyperspace bypass*. Arthur spends the next several years, still wearing his dressing gown, helplessly launched from crisis to crisis while trying to straighten out his lifestyle.
|
_With this theme, it is possible to add small sections that only contains one page like this. It will automatically appears in the header, at the end._
|
||||||
|
|
||||||
> He rather enjoys tea, but seems to have trouble obtaining it in the far reaches of the galaxy.
|
Along with [Ford Prefect](https://en.wikipedia.org/wiki/Ford_Prefect_\(character\)), Dent barely escapes the Earth's destruction as it is demolished to make way for a *hyperspace bypass*. Arthur spends the next several years, still wearing his dressing gown, helplessly launched from crisis to crisis while trying to straighten out his lifestyle.
|
||||||
|
|
||||||
In time, he learns how to fly and carves a niche for himself as a sandwich-maker.
|
> He rather enjoys tea, but seems to have trouble obtaining it in the far reaches of the galaxy.
|
||||||
|
|
||||||
<img src="//placehold.it/300x300" class="profile">
|
In time, he learns how to fly and carves a niche for himself as a sandwich-maker.
|
@@ -1,156 +0,0 @@
|
|||||||
---
|
|
||||||
date: 2014-03-10
|
|
||||||
linktitle: Migrating from Jekyll
|
|
||||||
menu:
|
|
||||||
main:
|
|
||||||
parent: tutorials
|
|
||||||
prev: /tutorials/mathjax
|
|
||||||
title: Migrate to Hugo from Jekyll
|
|
||||||
weight: 10
|
|
||||||
---
|
|
||||||
|
|
||||||
## Move static content to `static`
|
|
||||||
Jekyll has a rule that any directory not starting with `_` will be copied as-is to the `_site` output. Hugo keeps all static content under `static`. You should therefore move it all there.
|
|
||||||
With Jekyll, something that looked like
|
|
||||||
|
|
||||||
▾ <root>/
|
|
||||||
▾ images/
|
|
||||||
logo.png
|
|
||||||
|
|
||||||
should become
|
|
||||||
|
|
||||||
▾ <root>/
|
|
||||||
▾ static/
|
|
||||||
▾ images/
|
|
||||||
logo.png
|
|
||||||
|
|
||||||
Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`.
|
|
||||||
|
|
||||||
## Create your Hugo configuration file
|
|
||||||
Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the [Hugo configuration documentation](/overview/configuration/) for details.
|
|
||||||
|
|
||||||
## Set your configuration publish folder to `_site`
|
|
||||||
The default is for Jekyll to publish to `_site` and for Hugo to publish to `public`. If, like me, you have [`_site` mapped to a git submodule on the `gh-pages` branch](http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html), you'll want to do one of two alternatives:
|
|
||||||
|
|
||||||
1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended).
|
|
||||||
|
|
||||||
git submodule deinit _site
|
|
||||||
git rm _site
|
|
||||||
git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
|
|
||||||
|
|
||||||
2. Or, change the Hugo configuration to use `_site` instead of `public`.
|
|
||||||
|
|
||||||
{
|
|
||||||
..
|
|
||||||
"publishdir": "_site",
|
|
||||||
..
|
|
||||||
}
|
|
||||||
|
|
||||||
## Convert Jekyll templates to Hugo templates
|
|
||||||
That's the bulk of the work right here. The documentation is your friend. You should refer to [Jekyll's template documentation](http://jekyllrb.com/docs/templates/) if you need to refresh your memory on how you built your blog and [Hugo's template](/layout/templates/) to learn Hugo's way.
|
|
||||||
|
|
||||||
As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours.
|
|
||||||
|
|
||||||
## Convert Jekyll plugins to Hugo shortcodes
|
|
||||||
Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port.
|
|
||||||
|
|
||||||
### Implementation
|
|
||||||
As an example, I was using a custom [`image_tag`](https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb) plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.
|
|
||||||
|
|
||||||
Jekyll's plugin:
|
|
||||||
|
|
||||||
module Jekyll
|
|
||||||
class ImageTag < Liquid::Tag
|
|
||||||
@url = nil
|
|
||||||
@caption = nil
|
|
||||||
@class = nil
|
|
||||||
@link = nil
|
|
||||||
// Patterns
|
|
||||||
IMAGE_URL_WITH_CLASS_AND_CAPTION =
|
|
||||||
IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i
|
|
||||||
IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i
|
|
||||||
IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
|
|
||||||
IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
|
|
||||||
def initialize(tag_name, markup, tokens)
|
|
||||||
super
|
|
||||||
if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
|
|
||||||
@class = $1
|
|
||||||
@url = $3
|
|
||||||
@caption = $7
|
|
||||||
@link = $9
|
|
||||||
elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
|
|
||||||
@class = $1
|
|
||||||
@url = $3
|
|
||||||
@caption = $7
|
|
||||||
elsif markup =~ IMAGE_URL_WITH_CAPTION
|
|
||||||
@url = $1
|
|
||||||
@caption = $5
|
|
||||||
elsif markup =~ IMAGE_URL_WITH_CLASS
|
|
||||||
@class = $1
|
|
||||||
@url = $3
|
|
||||||
elsif markup =~ IMAGE_URL
|
|
||||||
@url = $1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
def render(context)
|
|
||||||
if @class
|
|
||||||
source = "<figure class='#{@class}'>"
|
|
||||||
else
|
|
||||||
source = "<figure>"
|
|
||||||
end
|
|
||||||
if @link
|
|
||||||
source += "<a href=\"#{@link}\">"
|
|
||||||
end
|
|
||||||
source += "<img src=\"#{@url}\">"
|
|
||||||
if @link
|
|
||||||
source += "</a>"
|
|
||||||
end
|
|
||||||
source += "<figcaption>#{@caption}</figcaption>" if @caption
|
|
||||||
source += "</figure>"
|
|
||||||
source
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Liquid::Template.register_tag('image', Jekyll::ImageTag)
|
|
||||||
|
|
||||||
is written as this Hugo shortcode:
|
|
||||||
|
|
||||||
<!-- image -->
|
|
||||||
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
|
||||||
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
|
|
||||||
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} />
|
|
||||||
{{ if .Get "link"}}</a>{{ end }}
|
|
||||||
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
|
||||||
<figcaption>{{ if isset .Params "title" }}
|
|
||||||
{{ .Get "title" }}{{ end }}
|
|
||||||
{{ if or (.Get "caption") (.Get "attr")}}<p>
|
|
||||||
{{ .Get "caption" }}
|
|
||||||
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
|
|
||||||
{{ .Get "attr" }}
|
|
||||||
{{ if .Get "attrlink"}}</a> {{ end }}
|
|
||||||
</p> {{ end }}
|
|
||||||
</figcaption>
|
|
||||||
{{ end }}
|
|
||||||
</figure>
|
|
||||||
<!-- image -->
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
I simply changed:
|
|
||||||
|
|
||||||
{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg "One of my favorite touristy-type photos. I secretly waited for the good light while we were "having fun" and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." ->http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
|
|
||||||
|
|
||||||
to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`):
|
|
||||||
|
|
||||||
{{%/* fig class="full" src="http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg" title="One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." link="http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/" */%}}
|
|
||||||
|
|
||||||
As a bonus, the shortcode named parameters are, arguably, more readable.
|
|
||||||
|
|
||||||
## Finishing touches
|
|
||||||
### Fix content
|
|
||||||
Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that `hugo server --watch` is your friend. Test your changes and fix errors as needed.
|
|
||||||
|
|
||||||
### Clean up
|
|
||||||
You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it.
|
|
||||||
|
|
||||||
## A practical example in a diff
|
|
||||||
[Hey, it's Alex](http://heyitsalex.net/) was migrated in less than a _father-with-kids day_ from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this [diff](https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610).
|
|
5
exampleSite/content/home.md
Normal file
5
exampleSite/content/home.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
+++
|
||||||
|
title = "Home"
|
||||||
|
+++
|
||||||
|
|
||||||
|
Hey ! Welcome to the **Cocoa Enhanced theme**. Here are some articles :
|
@@ -1,12 +0,0 @@
|
|||||||
+++
|
|
||||||
date = "2015-08-19T20:29:37-07:00"
|
|
||||||
draft = false
|
|
||||||
title = "Projects"
|
|
||||||
|
|
||||||
+++
|
|
||||||
|
|
||||||
The Hitchhiker's Guide to the Galaxy is a comedy science fiction series created by [Douglas Adams](https://en.wikipedia.org/wiki/Douglas_Adams). Originally a radio comedy broadcast on BBC Radio 4 in 1978, it was later adapted to other formats, and over several years it gradually became an international multi-media phenomenon. Adaptations have included stage shows, a "trilogy" of five books published between 1979 and 1992, a sixth novel penned by [Eoin Colfer](https://en.wikipedia.org/wiki/Eoin_Colfer) in 2009, a 1981 TV series, a 1984 computer game, and three series of three-part comic book adaptations of the first three novels published by DC Comics between 1993 and 1996. There were also two series of towels, produced by Beer-Davies, that are considered by some fans to be an "official version" of The Hitchhiker's Guide to the Galaxy, as they include text from the first novel.
|
|
||||||
|
|
||||||
### Movie
|
|
||||||
|
|
||||||
A Hollywood-funded film version, produced and filmed in the UK, was released in April 2005, and radio adaptations of the third, fourth, and fifth novels were broadcast from 2004 to 2005. Adams did many of these adaptations, including the novels, the TV series, the computer game, and the earliest drafts of the Hollywood film’s screenplay, and some of the stage shows introduced new material written by Adams.
|
|
8
exampleSite/content/projects/projects.md
Normal file
8
exampleSite/content/projects/projects.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
+++
|
||||||
|
date = "2015-08-19T20:29:37-07:00"
|
||||||
|
title = "Projects"
|
||||||
|
+++
|
||||||
|
|
||||||
|
_In this theme, it is possible to add sections like a Projects one for example. You can add plenty of articles about your projects and a presentation page that will be displayed before the list. All is modulable, if you don't want something._
|
||||||
|
|
||||||
|
A Hollywood-funded film version, produced and filmed in the UK, was released in April 2005, and radio adaptations of the third, fourth, and fifth novels were broadcast from 2004 to 2005. Adams did many of these adaptations, including the novels, the TV series, the computer game, and the earliest drafts of the Hollywood film’s screenplay, and some of the stage shows introduced new material written by Adams.
|
14
exampleSite/content/projects/small-project.md
Normal file
14
exampleSite/content/projects/small-project.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
+++
|
||||||
|
title = "A small project example : add yours !"
|
||||||
|
description = "Blah blah blah"
|
||||||
|
date = "2017-01-01"
|
||||||
|
tags = ["projects"]
|
||||||
|
+++
|
||||||
|
|
||||||
|
Along with [Ford Prefect](https://en.wikipedia.org/wiki/Ford_Prefect_\(character\)), Dent barely escapes the Earth's destruction as it is demolished to make way for a *hyperspace bypass*. Arthur spends the next several years, still wearing his dressing gown, helplessly launched from crisis to crisis while trying to straighten out his lifestyle.
|
||||||
|
|
||||||
|
> He rather enjoys tea, but seems to have trouble obtaining it in the far reaches of the galaxy.
|
||||||
|
|
||||||
|
In time, he learns how to fly and carves a niche for himself as a sandwich-maker.
|
||||||
|
|
||||||
|
<img src="//placehold.it/300x300" class="profile">
|
Binary file not shown.
Before Width: | Height: | Size: 305 KiB After Width: | Height: | Size: 478 KiB |
BIN
images/tn.png
BIN
images/tn.png
Binary file not shown.
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 95 KiB |
@@ -1,15 +0,0 @@
|
|||||||
{{ partial "header.html" . }}
|
|
||||||
<section class="main">
|
|
||||||
<div class="container">
|
|
||||||
<div class="content">
|
|
||||||
<div class="page-heading">{{ .Title }}</div>
|
|
||||||
<ul>
|
|
||||||
{{ range .Data.Pages.ByPublishDate }}
|
|
||||||
{{ partial "li.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
{{ partial "footer.html" . }}
|
|
||||||
|
|
26
layouts/_default/section.html
Normal file
26
layouts/_default/section.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{{ partial "header.html" . }}
|
||||||
|
<section class="main">
|
||||||
|
<div class="container">
|
||||||
|
<div class="content">
|
||||||
|
{{ $globalTitle := .Title}}
|
||||||
|
<div class="markdown">
|
||||||
|
{{ range .Data.Pages }}
|
||||||
|
{{ if eq .Title $globalTitle }}
|
||||||
|
{{ .Content }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
{{ if ne (len (where .Data.Pages "Title" "!=" $globalTitle)) 0}}
|
||||||
|
<div class="page-heading">{{ .Title }}</div>
|
||||||
|
<ul>
|
||||||
|
{{ range .Data.Pages.ByPublishDate }}
|
||||||
|
{{ if ne .Title $globalTitle }}
|
||||||
|
{{ partial "li.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{{ partial "footer.html" . }}
|
@@ -6,7 +6,6 @@
|
|||||||
<div class="front-matter">
|
<div class="front-matter">
|
||||||
<div class="title-container">
|
<div class="title-container">
|
||||||
{{ partial "page-heading" . }}
|
{{ partial "page-heading" . }}
|
||||||
<div class="initials"><a href="{{ .Site.BaseURL }}">KW</a></div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<div class="date" title="{{ .Date.Format .Site.Params.dateformfull }}">{{ .Date.Format .Site.Params.dateform }}</div>
|
<div class="date" title="{{ .Date.Format .Site.Params.dateformfull }}">{{ .Date.Format .Site.Params.dateform }}</div>
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
<div class="markdown">
|
<div class="markdown">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
<br>
|
<br>
|
||||||
<p><a href="/">Back to posts</a></p>
|
<p><a href="{{ .Section }}">Back to posts</a></p>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="disqus">
|
<div class="disqus">
|
||||||
|
@@ -2,14 +2,28 @@
|
|||||||
<section class="main">
|
<section class="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="page-heading">Blog</div>
|
{{ range where .Data.Pages "Title" "Home"}}
|
||||||
|
<div class="markdown">
|
||||||
|
{{ .Content }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{{ range .Data.Pages.ByPublishDate }}
|
{{ range first 5 (.Data.Pages.GroupByDate "Jan, 2006" "desc")}}
|
||||||
{{ if eq .Section "blog" }}
|
{{ $nbPages := len (where .Pages "Section" "blog")}}
|
||||||
|
{{ if ne $nbPages 0}}
|
||||||
|
<li class="groupby">{{ .Key }}</li>
|
||||||
|
{{ end }}
|
||||||
|
{{ range where .Pages.ByPublishDate "Section" "blog"}}
|
||||||
{{ partial "li.html" . }}
|
{{ partial "li.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
{{ $nbTotalGroup := len (.Data.Pages.GroupByDate "Jan, 2006" "desc")}}
|
||||||
|
{{ if gt $nbTotalGroup 5}}
|
||||||
|
<a href="./blog/" class="see-more">See more ...</a>
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{{ if .Site.Params.highlightjs }}
|
{{ if .Site.Params.highlightjs }}
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js"></script>
|
||||||
{{ range .Site.Params.highlightjslanguages }}
|
{{ range .Site.Params.highlightjslanguages }}
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/languages/{{.}}.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/languages/{{.}}.min.js"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@@ -1,21 +1,10 @@
|
|||||||
<!-- HTTPS -->
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
var baseURL = '{{ .Site.BaseURL }}';
|
|
||||||
var host = baseURL.substring(0, baseURL.length - 1).replace(/\//g, '');
|
|
||||||
if ((host === window.location.host) && (window.location.protocol !== 'https:')) {
|
|
||||||
window.location.protocol = 'https:';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
|
|
||||||
{{ if .Site.Params.highlightjs }}
|
{{ if .Site.Params.highlightjs }}
|
||||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/default.min.css">
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/default.min.css">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/reset.css">
|
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/reset.css">
|
||||||
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/pygments.css">
|
|
||||||
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/main.css">
|
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/main.css">
|
||||||
|
|
||||||
{{range .Site.Params.extracssfiles}}
|
{{range .Site.Params.extracssfiles}}
|
||||||
@@ -34,8 +23,4 @@
|
|||||||
<!-- RSS -->
|
<!-- RSS -->
|
||||||
{{ if .RSSLink }}
|
{{ if .RSSLink }}
|
||||||
<link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
|
<link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<!--[if lt IE 9]>
|
|
||||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
||||||
<![endif]-->
|
|
@@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
<body lang="{{ .Site.Params.lang }}">
|
<body lang="{{ .Site.Params.lang }}">
|
||||||
|
|
||||||
{{ if .IsHome }}
|
{{ if .IsPage }}
|
||||||
<section class="header header-home">
|
|
||||||
{{ else }}
|
|
||||||
<section class="header">
|
<section class="header">
|
||||||
|
{{ else }}
|
||||||
|
<section class="header header-home">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="{{ .Site.BaseURL }}"><img class="logo" src="{{ .Site.Params.logofile | absURL }}" /></a>
|
<a href="{{ .Site.BaseURL }}"><img class="logo" src="{{ .Site.Params.logofile | absURL }}" /></a>
|
||||||
@@ -16,9 +16,19 @@
|
|||||||
<a href="{{ .Site.BaseURL }}"><div class="name"><h1>{{ .Site.Title }}</h1></div></a>
|
<a href="{{ .Site.BaseURL }}"><div class="name"><h1>{{ .Site.Title }}</h1></div></a>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<a href="{{ .Site.BaseURL }}"><li>Blog</li></a>
|
<a href="{{ .Site.BaseURL }}blog/"><li>Blog</li></a>
|
||||||
<a href="{{ .Site.BaseURL }}about/"><li>About</li></a>
|
{{ range .Site.Sections }}
|
||||||
<a href="{{ .Site.BaseURL }}projects/"><li>Projects</li></a>
|
{{ range first 1 (where .Pages "Section" "ne" "")}}
|
||||||
|
{{ if ne .Section "blog"}}
|
||||||
|
<a href="{{ .Section | urlize }}"><li>{{ .Section }}</li></a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ range where .Site.Pages "Section" ""}}
|
||||||
|
{{ if ne .Title "Home"}}
|
||||||
|
<a href="{{ .Permalink }}"><li>{{ .Title }}</li></a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
17
layouts/section/blog.html
Normal file
17
layouts/section/blog.html
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{{ partial "header.html" . }}
|
||||||
|
<section class="main">
|
||||||
|
<div class="container">
|
||||||
|
<div class="content">
|
||||||
|
<div class="page-heading">Blog</div>
|
||||||
|
<ul>
|
||||||
|
{{ range .Data.Pages.GroupByDate "Jan, 2006" "desc"}}
|
||||||
|
<li class="groupby">{{ .Key }}</li>
|
||||||
|
{{ range .Pages.ByPublishDate }}
|
||||||
|
{{ partial "li.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{{ partial "footer.html" . }}
|
@@ -490,6 +490,10 @@ section.main .container.f04 .content .detail {
|
|||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
section.main .container .content .groupby {
|
||||||
|
margin-top: 1em;
|
||||||
|
padding-left: 0.5em;
|
||||||
|
}
|
||||||
section.main .container .content .post-item {
|
section.main .container .content .post-item {
|
||||||
display: -webkit-flex;
|
display: -webkit-flex;
|
||||||
display: -moz-flex;
|
display: -moz-flex;
|
||||||
@@ -509,6 +513,16 @@ section.main .container .content .post-item .meta {
|
|||||||
display: none;
|
display: none;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
}
|
}
|
||||||
|
section.main .container .content .see-more {
|
||||||
|
font-style: italic;
|
||||||
|
float: right;
|
||||||
|
font-size: 0.9em;
|
||||||
|
margin-top: 2em;
|
||||||
|
color: #313537;
|
||||||
|
}
|
||||||
|
section.main .container .content .see-more:hover {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
section {
|
section {
|
||||||
padding: 0 16px;
|
padding: 0 16px;
|
||||||
}
|
}
|
||||||
@@ -551,6 +565,7 @@ section.main .container .content .post-item {
|
|||||||
section.main .container .content .post-item {
|
section.main .container .content .post-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
padding-left: 1.5em;
|
||||||
}
|
}
|
||||||
section.main .container .content .post-item .meta {
|
section.main .container .content .post-item .meta {
|
||||||
display: block;
|
display: block;
|
||||||
|
@@ -1,61 +0,0 @@
|
|||||||
.hll { background-color: #ffffcc }
|
|
||||||
.c { color: #999988; font-style: italic } /* Comment */
|
|
||||||
.err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
|
||||||
.k { color: #000000; font-weight: bold } /* Keyword */
|
|
||||||
.o { color: #000000; font-weight: bold } /* Operator */
|
|
||||||
.cm { color: #999988; font-style: italic } /* Comment.Multiline */
|
|
||||||
.cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
|
|
||||||
.c1 { color: #999988; font-style: italic } /* Comment.Single */
|
|
||||||
.cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
|
|
||||||
.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
|
|
||||||
.ge { color: #000000; font-style: italic } /* Generic.Emph */
|
|
||||||
.gr { color: #aa0000 } /* Generic.Error */
|
|
||||||
.gh { color: #999999 } /* Generic.Heading */
|
|
||||||
.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
|
|
||||||
.go { color: #888888 } /* Generic.Output */
|
|
||||||
.gp { color: #555555 } /* Generic.Prompt */
|
|
||||||
.gs { font-weight: bold } /* Generic.Strong */
|
|
||||||
.gu { color: #aaaaaa } /* Generic.Subheading */
|
|
||||||
.gt { color: #aa0000 } /* Generic.Traceback */
|
|
||||||
.kc { color: #000000; font-weight: bold } /* Keyword.Constant */
|
|
||||||
.kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
|
|
||||||
.kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
|
|
||||||
.kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
|
|
||||||
.kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
|
|
||||||
.kt { color: #445588; font-weight: bold } /* Keyword.Type */
|
|
||||||
.m { color: #009999 } /* Literal.Number */
|
|
||||||
.s { color: #d01040 } /* Literal.String */
|
|
||||||
.na { color: #008080 } /* Name.Attribute */
|
|
||||||
.nb { color: #0086B3 } /* Name.Builtin */
|
|
||||||
.nc { color: #445588; font-weight: bold } /* Name.Class */
|
|
||||||
.no { color: #008080 } /* Name.Constant */
|
|
||||||
.nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
|
|
||||||
.ni { color: #800080 } /* Name.Entity */
|
|
||||||
.ne { color: #990000; font-weight: bold } /* Name.Exception */
|
|
||||||
.nf { color: #990000; font-weight: bold } /* Name.Function */
|
|
||||||
.nl { color: #990000; font-weight: bold } /* Name.Label */
|
|
||||||
.nn { color: #555555 } /* Name.Namespace */
|
|
||||||
.nt { color: #000080 } /* Name.Tag */
|
|
||||||
.nv { color: #008080 } /* Name.Variable */
|
|
||||||
.ow { color: #000000; font-weight: bold } /* Operator.Word */
|
|
||||||
.w { color: #bbbbbb } /* Text.Whitespace */
|
|
||||||
.mf { color: #009999 } /* Literal.Number.Float */
|
|
||||||
.mh { color: #009999 } /* Literal.Number.Hex */
|
|
||||||
.mi { color: #009999 } /* Literal.Number.Integer */
|
|
||||||
.mo { color: #009999 } /* Literal.Number.Oct */
|
|
||||||
.sb { color: #d01040 } /* Literal.String.Backtick */
|
|
||||||
.sc { color: #d01040 } /* Literal.String.Char */
|
|
||||||
.sd { color: #d01040 } /* Literal.String.Doc */
|
|
||||||
.s2 { color: #d01040 } /* Literal.String.Double */
|
|
||||||
.se { color: #d01040 } /* Literal.String.Escape */
|
|
||||||
.sh { color: #d01040 } /* Literal.String.Heredoc */
|
|
||||||
.si { color: #d01040 } /* Literal.String.Interpol */
|
|
||||||
.sx { color: #d01040 } /* Literal.String.Other */
|
|
||||||
.sr { color: #009926 } /* Literal.String.Regex */
|
|
||||||
.s1 { color: #d01040 } /* Literal.String.Single */
|
|
||||||
.ss { color: #990073 } /* Literal.String.Symbol */
|
|
||||||
.bp { color: #999999 } /* Name.Builtin.Pseudo */
|
|
||||||
.vc { color: #008080 } /* Name.Variable.Class */
|
|
||||||
.vg { color: #008080 } /* Name.Variable.Global */
|
|
||||||
.vi { color: #008080 } /* Name.Variable.Instance */
|
|
||||||
.il { color: #009999 } /* Literal.Number.Integer.Long */
|
|
@@ -2,7 +2,7 @@ name = "Cocoa-EH"
|
|||||||
license = "MIT"
|
license = "MIT"
|
||||||
licenselink = "https://github.com/fuegowolf/cocoa-eh-hugo-theme/blob/master/LICENSE.md"
|
licenselink = "https://github.com/fuegowolf/cocoa-eh-hugo-theme/blob/master/LICENSE.md"
|
||||||
description = "A enhanced version of Cocoa. Consistent, responsive theme with clean typography"
|
description = "A enhanced version of Cocoa. Consistent, responsive theme with clean typography"
|
||||||
homepage = "https://kodewolf.com"
|
homepage = "https://github.com/fuegowolf/cocoa-eh-hugo-theme"
|
||||||
tags = ["open-sans", "minimal", "clean", "ionicons", "comments"]
|
tags = ["open-sans", "minimal", "clean", "ionicons", "comments"]
|
||||||
features = ["blog", "responsive", "404", "icons", "disqus", "metadata"]
|
features = ["blog", "responsive", "404", "icons", "disqus", "metadata"]
|
||||||
min_version = 0.15
|
min_version = 0.15
|
||||||
|
Reference in New Issue
Block a user