File tree 3 files changed +15
-7
lines changed 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -296,13 +296,20 @@ export function Events(Base) {
296
296
// =========================================================================
297
297
/**
298
298
* Handle rendering UI element updates and new content
299
+ * @param {string } name the site name
299
300
* @void
300
301
*/
301
- onRender ( ) {
302
+ onRender ( name ) {
302
303
const currentPath = this . router . toURL ( this . router . getCurrentPath ( ) ) ;
303
- const currentTitle = dom . find (
304
- `.sidebar a[href='${ currentPath } ']` ,
305
- ) ?. innerText ;
304
+ const currentSection = dom
305
+ . find ( `.sidebar a[href='${ currentPath } ']` )
306
+ ?. getAttribute ( 'title' ) ;
307
+
308
+ const currentTitle = name
309
+ ? currentSection
310
+ ? `${ name } - ${ currentSection } `
311
+ : name
312
+ : currentSection ;
306
313
307
314
// Update page title
308
315
dom . $ . title = currentTitle || this . #title;
Original file line number Diff line number Diff line change @@ -343,9 +343,9 @@ export function Render(Base) {
343
343
}
344
344
345
345
_bindEventOnRendered ( activeEl ) {
346
- const { autoHeader } = this . config ;
346
+ const { autoHeader, name } = this . config ;
347
347
348
- this . onRender ( ) ;
348
+ this . onRender ( name ) ;
349
349
350
350
if ( autoHeader && activeEl ) {
351
351
const main = dom . getNode ( '#main' ) ;
Original file line number Diff line number Diff line change @@ -49,9 +49,10 @@ function doSearch(value) {
49
49
50
50
let html = '' ;
51
51
matches . forEach ( ( post , i ) => {
52
+ const title = ( post . title || '' ) . replace ( / < [ ^ > ] + > / g, '' ) ;
52
53
html += /* html */ `
53
54
<div class="matching-post" aria-label="search result ${ i + 1 } ">
54
- <a href="${ post . url } ">
55
+ <a href="${ post . url } " title=" ${ title } " >
55
56
<p class="title clamp-1">${ post . title } </p>
56
57
<p class="content clamp-2">${ post . content } </p>
57
58
</a>
You can’t perform that action at this time.
0 commit comments