diff --git a/README.md b/README.md index b047d81..4b96deb 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Pulp is a [Hugo](https://gohugo.io/) theme for getting a simple, easy-to-read blog site. ## Screenshots -![screenshot-top](https://user-images.githubusercontent.com/17229643/55247370-c7a5b100-528a-11e9-835b-108bd6047699.png) +![screenshot-top](https://user-images.githubusercontent.com/17229643/72672672-bd16fc80-3a01-11ea-9056-7439db39ed75.png) -![screenshot-list](https://user-images.githubusercontent.com/17229643/55247387-d12f1900-528a-11e9-8144-c984031e16c0.png) +![screenshot-list](https://user-images.githubusercontent.com/17229643/72672673-c607ce00-3a01-11ea-8356-d3cfc4ead65e.png) -![screenshot-page](https://user-images.githubusercontent.com/17229643/55247395-d5f3cd00-528a-11e9-82ed-4830523c5bfa.png) +![screenshot-page](https://user-images.githubusercontent.com/17229643/72672675-cacc8200-3a01-11ea-914e-c80876d03b16.png) ## Installation If your site is also under version control using git, the easiest way to install this theme is to add it as a submodule. If you have not created a git repo for your project yet, you need to run `git init` beforehand. Inside the folder of your Hugo site, run the following command. diff --git a/assets/js/search.js b/assets/js/search.js index 8a47ae4..a4f2f24 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -16,15 +16,6 @@ const bigramTokeniser = (obj, metadata) => { return [] } - if (Array.isArray(obj)) { - return obj.map((t) => { - return new lunr.Token( - lunr.utils.asString(t).toLowerCase(), - lunr.utils.clone(metadata) - ) - }) - } - let str = obj.toString().trim().toLowerCase() let tokens = [] @@ -70,6 +61,7 @@ const initLunr = () => { builder.pipeline.reset() builder.ref('ref') builder.field('title', { boost: 10 }) + builder.field('tags', { boost: 10 }) builder.field('body') builder.metadataWhitelist = ['position'] for (let page of pagesIndex) { @@ -112,11 +104,12 @@ const initUI = () => { const query = $(event.currentTarget).val() // Icon switching + const iconUrl = $('#searchBoxIcon').attr('src') if (query.length) { - $('#searchBoxIcon').attr('src', '../img/clear.png') + $('#searchBoxIcon').attr('src', iconUrl.replace('search.png', 'clear.png')) $('#searchBoxIcon').css('cursor', 'pointer') } else { - $('#searchBoxIcon').attr('src', '../img/search.png') + $('#searchBoxIcon').attr('src', iconUrl.replace('clear.png', 'search.png')) $('#searchBoxIcon').css('cursor', 'default') } diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 3df77db..e4758b8 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,4 +1,5 @@ {{ define "main"}} +

{{ .Title }}

{{ partial "header.html" . }}
+ +
+ +
{{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "January, 2006"}} diff --git a/layouts/_default/list.json b/layouts/_default/list.json index 0fa510c..dc748c1 100644 --- a/layouts/_default/list.json +++ b/layouts/_default/list.json @@ -3,6 +3,7 @@ "ref": "{{ $page.Permalink }}", "title": {{ $page.Title | jsonify }}, "section": "{{ $page.Section }}", + "tags": {{ $page.Params.tags | jsonify }}, "date" : {{ $page.Date.Format "2006.01.02" | jsonify }}, "body": {{ $page.Plain | jsonify }} } diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3b8774f..7a5a0c5 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,6 +1,20 @@ {{ define "main"}}

{{ .Title }}

{{ partial "header.html" . }} + + {{ $singlePageDateFormat := .Site.Params.singlePageDateFormat | default "January 2, 2006"}} +

{{ .Date.Format $singlePageDateFormat }}

+ +
+ +
{{ .Content }} diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..e729689 --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,13 @@ +{{ define "main"}} +

{{ .Title }}

+ {{ partial "header.html" . }} + +
+ +
+ {{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/index.html b/layouts/index.html index 6bba63b..58fafd7 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -15,7 +15,7 @@

- {{ .Site.Params.description }} + {{ .Site.Params.description | safeHTML }}