diff options
| Commit | b21933aa4c8fcedc94db1719cb265870151fb885 (patch) | |
|---|---|---|
| Author | 2020-08-16 09:28:47 +0300 | |
| Committer | 2020-08-16 09:28:47 +0300 | |
| Files | a14ff0b2ee4bcaf5f99be592a11320fe460bfdd4 /layouts | |
| IPL-b21933aa4c8fcedc94db1719cb265870151fb885.tar IPL-b21933aa4c8fcedc94db1719cb265870151fb885.tar.gz IPL-b21933aa4c8fcedc94db1719cb265870151fb885.zip | ||
| Parent | fba5befbf5b9cb9b9026b8f6af7f6c5444e1a8f5 (diff) | |
Squashed 'website/themes/base16/' changes from 7b2da73..861b48a
861b48a Fix homepage for Hugo v0.57.0+
785529b Merge pull request #22 from htdvisser/dependabot/npm_and_yarn/lodash.template-4.5.0
eebef6d Bump lodash.template from 4.4.0 to 4.5.0
004fb6d Merge pull request #19 from htdvisser/dependabot/npm_and_yarn/js-yaml-3.13.1
e481251 "Urlize" Tags and Categories in Article and swap ".Hugo" for "hugo" (#20)
cdc4ae0 Humanize link text for Categories to handle spaces
72fdc0d Urlize tags and categories in article.html
623ee7c Swap deprecated '.Hugo' for 'hugo'
be36348 Bump js-yaml from 3.13.0 to 3.13.1
08da946 Fix rendering of page title
62034ea Update dependencies, rebuild and bump version
12c8463 Merge pull request #18 from denislobanov/pagination
bc4166b Move paginator to partial and add to other lists
8fde45b static css
75a3a83 Add support for Pagination #2
git-subtree-dir: website/themes/base16
git-subtree-split: 861b48ad0ff31e9b2bee50f2a87925820daac9f5
5 files changed, 29 insertions, 7 deletions
| -rw-r--r-- | layouts/_default/list.html | 4 | ||||
| -rw-r--r-- | layouts/partials/article.html | 4 | ||||
| -rw-r--r-- | layouts/partials/header.html | 4 | ||||
| -rw-r--r-- | layouts/partials/homepage.html | 7 | ||||
| -rw-r--r-- | layouts/partials/paginator.html | 17 |
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index cf5b2b2..d70204d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,8 +1,10 @@ {{ partial "header.html" . }} +{{ $paginator := .Paginate (where .Data.Pages "Section" "post") (or .Site.Params.paginate 3) }} <main role="main" class="article-list"> <h1 class="list-title">{{ .Title }}</h1> - {{ range .Data.Pages }} + {{ range $paginator.Pages }} {{ partial "article-list-item.html" . }} {{ end }} </main> +{{ partial "paginator.html" $paginator }} {{ partial "footer.html" . }} diff --git a/layouts/partials/article.html b/layouts/partials/article.html index c69a76f..a1da41b 100644 --- a/layouts/partials/article.html +++ b/layouts/partials/article.html @@ -9,7 +9,7 @@ <span class="key">{{ if $page.Date.IsZero }}published {{ end }}in</span> <span class="val"> {{ range . }} - <a href="{{ . | printf "categories/%s" | relURL }}">{{ . }}</a> + <a href="{{ . | urlize | printf "categories/%s" | relURL }}">{{ . }}</a> {{ end }} </span> {{ end }} @@ -18,7 +18,7 @@ <span class="key">tags:</span> <span class="val"> {{ range . }} - <a href="{{ . | printf "tags/%s" | relURL }}">{{ . }}</a> + <a href="{{ . | urlize | printf "tags/%s" | relURL }}">{{ . }}</a> {{ end }} </span> {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 715808c..c847d77 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -9,12 +9,12 @@ {{- with $.Param "author" }} <meta name="author" content="{{ . }}"> {{- end }} -{{ .Hugo.Generator }} +{{ hugo.Generator }} <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="{{ "css/style.css" | relURL }}" type="text/css"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700" type="text/css"> <link rel="alternate" href="{{ "index.xml" | relURL }}" type="application/rss+xml" title="{{ .Site.Title }}"> -<title>{{ $isHomePage := eq .Title .Site.Title }}{{ .Title }}{{ if eq $isHomePage false }} - {{ .Site.Title }}{{ end }}</title> +<title>{{ with .Title }}{{.}} - {{ end }}{{ .Site.Title }}</title> </head> <body> diff --git a/layouts/partials/homepage.html b/layouts/partials/homepage.html index cdbc78e..2dcfec7 100644 --- a/layouts/partials/homepage.html +++ b/layouts/partials/homepage.html @@ -5,12 +5,15 @@ <h1 class="headline">Recent Posts</h1> + {{ $paginator := .Paginate (where .Site.RegularPages "Section" "post") (or .Site.Params.paginate 3) }} <div class="article-list"> - {{ range first 3 (where .Data.Pages "Section" "post") }} + {{ range $paginator.Pages }} {{ partial "article-list-item.html" . }} {{ end }} </div> + {{ partial "paginator.html" $paginator }} + {{ with .Site.Taxonomies.categories }} <h1 class="headline">Categories</h1> @@ -18,7 +21,7 @@ <section class="categories"> {{ range $name, $value := . }} <h2 class="category"> - <a href="{{ $baseurl }}categories/{{ $name | urlize }}">{{ title $name }}</a> + <a href="{{ $baseurl }}categories/{{ $name | urlize }}">{{ humanize $name | title }}</a> <small>({{ .Count }})</small> </h2> {{ end }} diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html new file mode 100644 index 0000000..67cdfe4 --- /dev/null +++ b/layouts/partials/paginator.html @@ -0,0 +1,17 @@ +{{ if gt .TotalPages 1 }} + <nav class="paginator"> + {{ if .HasPrev }} + <a class="nav-left" href="{{ .Prev.URL }}">< Prev</a> + {{ else }} + <span class="nav-left faded">< Prev</span> + {{ end }} + + <span>{{ .PageNumber}} / {{ .TotalPages }}</span> + + {{ if .HasNext }} + <a class="nav-right" href="{{ .Next.URL }}">Next ></a> + {{ else }} + <span class="nav-right faded">Next ></span> + {{ end }} + </nav> +{{ end }} |
