Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/core/event/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,17 @@ export function Events(Base) {
* @void
*/
onRender() {
const { name } = this.config;
const currentPath = this.router.toURL(this.router.getCurrentPath());
const currentTitle = dom.find(
`.sidebar a[href='${currentPath}']`,
)?.innerText;
const currentSection = dom
.find(`.sidebar a[href='${currentPath}']`)
?.getAttribute('title');

const currentTitle = name
? currentSection
? `${currentSection} - ${name}`
: name
: currentSection;

// Update page title
dom.$.title = currentTitle || this.#title;
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/search/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ function doSearch(value) {

let html = '';
matches.forEach((post, i) => {
const title = (post.title || '').replace(/<[^>]+>/g, '');
html += /* html */ `
<div class="matching-post" aria-label="search result ${i + 1}">
<a href="${post.url}">
<a href="${post.url}" title="${title}">
<p class="title clamp-1">${post.title}</p>
<p class="content clamp-2">${post.content}</p>
</a>
Expand Down