From 55560f40bd03dae0660ac99dbbd618f71ae18ca9 Mon Sep 17 00:00:00 2001 From: Emruz Hossain Date: Fri, 28 Jul 2023 00:15:51 +0600 Subject: [PATCH 1/4] Fix CSS not being applied in tags (#780) Signed-off-by: hossainemruz --- assets/styles/layouts/list.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/styles/layouts/list.scss b/assets/styles/layouts/list.scss index 4b1512a..bb24e8a 100644 --- a/assets/styles/layouts/list.scss +++ b/assets/styles/layouts/list.scss @@ -1,7 +1,7 @@ // in Hugo, Page kind can be either "section" or "page". // if it is section, then it's a page with a list of items, for example /posts // if it is page, then it is a single page. -body.kind-section { +body.kind-section, body.kind-term { .wrapper { display: flex; padding: 0; From 678d9550444ccf7472dc656b9cb3be94f97deb75 Mon Sep 17 00:00:00 2001 From: hossainemruz Date: Sat, 29 Jul 2023 00:57:50 +0600 Subject: [PATCH 2/4] Fix search using incorrect element id Signed-off-by: hossainemruz --- assets/scripts/pages/search.js | 2 +- assets/styles/layouts/list.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/scripts/pages/search.js b/assets/scripts/pages/search.js index c7b7b73..1d55914 100644 --- a/assets/scripts/pages/search.js +++ b/assets/scripts/pages/search.js @@ -26,7 +26,7 @@ window.addEventListener('DOMContentLoaded', () => { const searchQuery = param('keyword') if (searchQuery) { - document.getElementById('search-query').value = searchQuery + document.getElementById('search-box').value = searchQuery executeSearch(searchQuery) } else { const node = document.createElement('p') diff --git a/assets/styles/layouts/list.scss b/assets/styles/layouts/list.scss index bb24e8a..8ee9f63 100644 --- a/assets/styles/layouts/list.scss +++ b/assets/styles/layouts/list.scss @@ -1,7 +1,7 @@ // in Hugo, Page kind can be either "section" or "page". // if it is section, then it's a page with a list of items, for example /posts // if it is page, then it is a single page. -body.kind-section, body.kind-term { +body.kind-section, body.kind-term, body.kind-page{ .wrapper { display: flex; padding: 0; From 0e12222cc3bdb283d9406de8fe6f7f39cdd593ad Mon Sep 17 00:00:00 2001 From: Emruz Hossain Date: Sat, 29 Jul 2023 02:09:17 +0600 Subject: [PATCH 3/4] Fix index featching during search (#783) Signed-off-by: hossainemruz --- assets/scripts/pages/search.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/scripts/pages/search.js b/assets/scripts/pages/search.js index 1d55914..cd5eb08 100644 --- a/assets/scripts/pages/search.js +++ b/assets/scripts/pages/search.js @@ -37,7 +37,7 @@ window.addEventListener('DOMContentLoaded', () => { function executeSearch (searchQuery) { const url = window.location.href.split('/search/')[0] + '/index.json' - fetch(url).then(function (data) { + fetch(url).then(response => response.json()).then(function (data) { const pages = data const fuse = new Fuse(pages, fuseOptions) const results = fuse.search(searchQuery) @@ -91,8 +91,8 @@ window.addEventListener('DOMContentLoaded', () => { snippet }) - const doc = new DOMParser().parseFromString(output, 'text/html') - document.getElementById('search-results').append(doc) + const dom = new DOMParser().parseFromString(output, 'text/html') + document.getElementById('search-results').append(dom.getElementsByClassName('post-card')[0]) snippetHighlights.forEach(function (snipvalue) { const context = document.getElementById('#summary-' + key) From 08017d5977fb6bdbe3545a820bf963809c5f3d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernat=20Borr=C3=A0s=20Civil?= <70479573+BernatBC@users.noreply.github.com> Date: Sat, 29 Jul 2023 17:21:26 +0200 Subject: [PATCH 4/4] Add possibility to show tags on post cards (#782) * Add possibility to show tags on post cards * Add on_card tags in exampleSite --------- Co-authored-by: Emruz Hossain --- assets/styles/layouts/list.scss | 16 ++++++++++++++++ assets/styles/sections/recent-posts.scss | 16 ++++++++++++++++ exampleSite/config.yaml | 1 + layouts/partials/cards/post.html | 10 ++++++++++ layouts/partials/cards/recent-post.html | 10 ++++++++++ 5 files changed, 53 insertions(+) diff --git a/assets/styles/layouts/list.scss b/assets/styles/layouts/list.scss index 8ee9f63..d79b7eb 100644 --- a/assets/styles/layouts/list.scss +++ b/assets/styles/layouts/list.scss @@ -98,6 +98,22 @@ body.kind-section, body.kind-term, body.kind-page{ width: fit-content; } + .taxonomy-terms-card { + text-align: left; + } + .taxonomy-terms-card li { + font-size: 0.5em; + list-style-type: none; + display: inline-block; + background: #248aaa; + margin-left: 0.1em; + margin-right: 0.1em; + } + + .taxonomy-terms-card a { + color: #f9fafc; + } + /* ============= Device specific fixes ======= */ /* Large screens such as TV */ diff --git a/assets/styles/sections/recent-posts.scss b/assets/styles/sections/recent-posts.scss index 7ff1704..1b30c8b 100644 --- a/assets/styles/sections/recent-posts.scss +++ b/assets/styles/sections/recent-posts.scss @@ -38,6 +38,22 @@ -webkit-line-clamp: 5; /* number of lines to show */ -webkit-box-orient: vertical; } + + .taxonomy-terms { + text-align: left; + } + .taxonomy-terms li { + font-size: 0.5em; + list-style-type: none; + display: inline-block; + background: #248aaa; + margin-left: 0.2em; + margin-right: 0.2em; + } + + .taxonomy-terms a { + color: #f9fafc; + } /* ============= Device specific fixes ======= */ diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 99d29f9..ad283d5 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -189,6 +189,7 @@ params: # Show tags under the post title tags: enable: true + on_card: true # enables tags in post cards # Specify whether to show flag in the language selector. Default is true. flags: diff --git a/layouts/partials/cards/post.html b/layouts/partials/cards/post.html index afabab9..200cf84 100644 --- a/layouts/partials/cards/post.html +++ b/layouts/partials/cards/post.html @@ -9,6 +9,16 @@

{{ .Summary }}