Skip to content

Commit a812714

Browse files
Koooooo-7sy-records
authored andcommitted
fix: sync the page title regarding the title config
1 parent 33f1d9a commit a812714

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/core/event/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,9 @@ export function Events(Base) {
300300
*/
301301
onRender() {
302302
const currentPath = this.router.toURL(this.router.getCurrentPath());
303-
const currentTitle = dom.find(
304-
`.sidebar a[href='${currentPath}']`,
305-
)?.innerText;
303+
const currentTitle = dom
304+
.find(`.sidebar a[href='${currentPath}']`)
305+
?.getAttribute('title');
306306

307307
// Update page title
308308
dom.$.title = currentTitle || this.#title;

src/plugins/search/component.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ function doSearch(value) {
4949

5050
let html = '';
5151
matches.forEach((post, i) => {
52+
const title = (post.title || '').replace(/<[^>]+>/g, '');
5253
html += /* html */ `
5354
<div class="matching-post" aria-label="search result ${i + 1}">
54-
<a href="${post.url}">
55+
<a href="${post.url}" title="${title}">
5556
<p class="title clamp-1">${post.title}</p>
5657
<p class="content clamp-2">${post.content}</p>
5758
</a>

0 commit comments

Comments
 (0)