Merge branch 'main' into main

This commit is contained in:
Emruz Hossain 2023-07-29 21:23:01 +06:00 committed by GitHub
commit 0ccc6640fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 5 deletions

View file

@ -26,7 +26,7 @@ window.addEventListener('DOMContentLoaded', () => {
const searchQuery = param('keyword') const searchQuery = param('keyword')
if (searchQuery) { if (searchQuery) {
document.getElementById('search-query').value = searchQuery document.getElementById('search-box').value = searchQuery
executeSearch(searchQuery) executeSearch(searchQuery)
} else { } else {
const node = document.createElement('p') const node = document.createElement('p')
@ -37,7 +37,7 @@ window.addEventListener('DOMContentLoaded', () => {
function executeSearch (searchQuery) { function executeSearch (searchQuery) {
const url = window.location.href.split('/search/')[0] + '/index.json' 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 pages = data
const fuse = new Fuse(pages, fuseOptions) const fuse = new Fuse(pages, fuseOptions)
const results = fuse.search(searchQuery) const results = fuse.search(searchQuery)
@ -91,8 +91,8 @@ window.addEventListener('DOMContentLoaded', () => {
snippet snippet
}) })
const doc = new DOMParser().parseFromString(output, 'text/html') const dom = new DOMParser().parseFromString(output, 'text/html')
document.getElementById('search-results').append(doc) document.getElementById('search-results').append(dom.getElementsByClassName('post-card')[0])
snippetHighlights.forEach(function (snipvalue) { snippetHighlights.forEach(function (snipvalue) {
const context = document.getElementById('#summary-' + key) const context = document.getElementById('#summary-' + key)

View file

@ -1,7 +1,7 @@
// in Hugo, Page kind can be either "section" or "page". // 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 section, then it's a page with a list of items, for example /posts
// if it is page, then it is a single page. // if it is page, then it is a single page.
body.kind-section { body.kind-section, body.kind-term, body.kind-page{
.wrapper { .wrapper {
display: flex; display: flex;
padding: 0; padding: 0;
@ -98,6 +98,22 @@ body.kind-section {
width: fit-content; 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 ======= */ /* ============= Device specific fixes ======= */
/* Large screens such as TV */ /* Large screens such as TV */

View file

@ -39,6 +39,22 @@
-webkit-box-orient: vertical; -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 ======= */ /* ============= Device specific fixes ======= */
/* Large screens such as TV */ /* Large screens such as TV */

View file

@ -189,6 +189,7 @@ params:
# Show tags under the post title # Show tags under the post title
tags: tags:
enable: true enable: true
on_card: true # enables tags in post cards
# Specify whether to show flag in the language selector. Default is true. # Specify whether to show flag in the language selector. Default is true.
flags: flags:

View file

@ -9,6 +9,16 @@
<p class="card-text post-summary">{{ .Summary }}</p> <p class="card-text post-summary">{{ .Summary }}</p>
</div> </div>
<div class="card-footer"> <div class="card-footer">
{{ if and site.Params.features.tags.enable site.Params.features.tags.on_card }}
<div class="taxonomy-terms-card">
<ul style="padding-left: 0;">
{{ range .Params.tags }}
{{ $url:= printf "tags/%s/" . }}
<li class="rounded"><a href="{{ $url | urlize | relLangURL }}" class="btn, btn-sm">{{ . }}</a></li>
{{ end }}
</ul>
</div>
{{ end }}
<span class="float-left">{{ .Date.Format "January 2, 2006" }}</span> <span class="float-left">{{ .Date.Format "January 2, 2006" }}</span>
<a <a
href="{{ .RelPermalink | relLangURL }}" href="{{ .RelPermalink | relLangURL }}"

View file

@ -11,6 +11,16 @@
<p class="card-text post-summary"> {{ .Summary }}</p> <p class="card-text post-summary"> {{ .Summary }}</p>
</div> </div>
<div class="card-footer"> <div class="card-footer">
{{ if and site.Params.features.tags.enable site.Params.features.tags.on_card }}
<div class="taxonomy-terms">
<ul style="padding-left: 0;">
{{ range .Params.tags }}
{{ $url:= printf "tags/%s/" . }}
<li class="rounded"><a href="{{ $url | urlize | relLangURL }}" class="btn, btn-sm">{{ . }}</a></li>
{{ end }}
</ul>
</div>
{{ end }}
<span class="float-left">{{ .Date.Format "January 2, 2006" }}</span> <span class="float-left">{{ .Date.Format "January 2, 2006" }}</span>
<a href="{{ .RelPermalink }}" title="{{ i18n "read" }}" class="float-right btn btn-outline-info btn-sm">{{ i18n "read" }}</a> <a href="{{ .RelPermalink }}" title="{{ i18n "read" }}" class="float-right btn btn-outline-info btn-sm">{{ i18n "read" }}</a>
</div> </div>