Merge branch 'main' into main

This commit is contained in:
Emruz Hossain 2023-07-29 21:19:22 +06:00 committed by GitHub
commit acc4dd64d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 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-term { body.kind-section, body.kind-term, body.kind-page{
.wrapper { .wrapper {
display: flex; display: flex;
padding: 0; padding: 0;