Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BernatBC committed Feb 19, 2024
1 parent 0475649 commit df72eee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions assets/scripts/pages/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,10 @@ window.addEventListener('DOMContentLoaded', () => {
// pull template from hugo template definition
const templateDefinition = document.getElementById('search-result-template').innerHTML
// replace values
function tagsHTML() {
function adaptTags() {
const tags = value.item.tags;
let string = '<ul style="padding-left: 0;">';
let string = '';
tags.forEach((t) => {string += '<li class="rounded"><a href="/tags/' + t.toLowerCase() + '/" class="btn btn-sm btn-info">' + t + "</a></li>"});
string += "</ul>";
return string;
}

Expand All @@ -94,7 +93,7 @@ window.addEventListener('DOMContentLoaded', () => {
date: value.item.date,
summary: value.item.summary,
link: value.item.permalink,
tags: tagsHTML(),
tags: adaptTags(),
categories: value.item.categories,
snippet
})
Expand Down
2 changes: 2 additions & 0 deletions layouts/_default/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ <h5 class="card-title">${title}</h5>
</a>
{{ if site.Params.features.tags.on_card }}
<div class="tags">
<ul style="padding-left: 0;">
${tags}
</ul>
</div>
{{ end }}
</div>
Expand Down

0 comments on commit df72eee

Please sign in to comment.