Skip to content

Conversation

Koooooo-7
Copy link
Member

@Koooooo-7 Koooooo-7 commented Jul 31, 2024

Summary

Currently, on the v5 changes, each headings/links on the sidebar has the title via #addTextAsTitleAttribute.

#addTextAsTitleAttribute(cssSelector) {

After the event refactor, the page title 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 to Configuration.
or directly jump to its sub headings configuration?id=alias.

The page title is always `Configuration`.

v5 as-is:
On the main content load the page title such as Configuration, switch the sections to Configuration. (same to v4 )
⚠️ directly jump to its sub headings configuration?id=alias via the URL,it will update the page title to sub title (alias) instead.
⚠️ On the search function, when clicks the search result, it comes to the mess innerText as page title 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,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

Yes
No

No

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge

Copy link

vercel bot commented Jul 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docsify-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 11, 2024 2:55am

@Koooooo-7 Koooooo-7 marked this pull request as ready for review July 31, 2024 15:40
@Koooooo-7 Koooooo-7 requested review from jhildenbiddle, trusktr, sy-records and a team July 31, 2024 15:40
@trusktr
Copy link
Member

trusktr commented Aug 1, 2024

Hmm, I see yeah it is inconsistent depending how you land on the page. Clicking on your link, the title is alias, but if you navigate to the page from inside Docsify, the title is Configuration.

Also I think that it would be better for the title to be Docsify - Page for each page whre Page is the name of the page, or similar. F.e. Docsify - Configuration, Docsify - Quick start, etc.

@Koooooo-7
Copy link
Member Author

Koooooo-7 commented Aug 2, 2024

Hmm, I see yeah it is inconsistent depending how you land on the page. Clicking on your link, the title is alias, but if you navigate to the page from inside Docsify, the title is Configuration.

Also I think that it would be better for the title to be Docsify - Page for each page whre Page is the name of the page, or similar. F.e. Docsify - Configuration, Docsify - Quick start, etc.

Yea, It makes sense that we could concat the name of the site as a prefix. I gonna update it.


update.

sy-records
sy-records previously approved these changes Aug 3, 2024
sy-records
sy-records previously approved these changes Aug 5, 2024
@sy-records sy-records merged commit 2eec7c4 into develop Aug 11, 2024
@sy-records sy-records deleted the fox-title-page branch August 11, 2024 02:56
@BrysonC
Copy link

BrysonC commented Sep 22, 2025

Since the name configuration can "also contain custom HTML for easier customization" (due to its primary/first use in the sidebar) using the name for page title generation can produce some ugly results.

I liked @Koooooo-7 recommendation to make a pageTitleFormatter config option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants