fix: sync the page title regarding the title config #2478
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Summary
Currently, on the v5 changes, each headings/links on the sidebar has the
title
via#addTextAsTitleAttribute
.docsify/src/core/render/index.js
Line 20 in 42f2548
After the
event
refactor, the pagetitle
update function changed, especially the search page title.Example from our site.
v4:
On the main content load the page title such as
Configuration
, no matter you switch the sections toConfiguration
.or directly jump to its sub headings configuration?id=alias.
v5 as-is:
⚠️ directly jump to its sub headings configuration?id=alias via the URL,it will update the page title to
⚠️ On the search function, when clicks the search result, it comes to the mess innerText as page title instead.
On the main content load the page title such as
Configuration
, switch the sections toConfiguration
. (same to v4 )sub title
(alias
) instead.The behavior for the sidebar headings for main content, I think it makes sense to indicate the specific target and respect the title.
So, I fix the search problem via a consistent way that all retrieve page title from to the
title
attribute also.Now, it will use the
${name} - ${title}
as the page title, if no name config, use title directly.Related issue, if any:
What kind of change does this PR introduce?
Bugfix
For any code change,
Does this PR introduce a breaking change?
Yes
No
No
Tested in the following browsers: