You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, the page's h1 heading will be used as the title of the HTML document. But if you want to use a different title, you can use Front Matter to specify the title of the page.
I assumed this meant the frontmatter.title, when given, should always be chosen over h1 heading, but the h1 heading would be chosen in the sidebar.
By inspecting the source code, it seems like this is the reason:
// plugin-auto-nav-sidebar exportasyncfunctionextractH1Title(...){
...
const match =content.match(h1RegExp);if(!match){// only fallback to frontmatter.title when h1 is not foundconst{ frontmatter }=loadFrontMatter(content,filePath,rootDir);returnfrontmatter.title||fileNameWithoutExt;}else{returnmatch[1]|| fileNameWithoutExt;}}
Version
Details
According to https://rspress.dev/api/config/config-frontmatter.html#front-matter-config:
I assumed this meant the
frontmatter.title
, when given, should always be chosen over h1 heading, but the h1 heading would be chosen in the sidebar.By inspecting the source code, it seems like this is the reason:
See:
rspress/packages/plugin-auto-nav-sidebar/src/utils.ts
Lines 41 to 46 in 4fd420d
Shall we change this?
Reproduce link
https://applink.larksuite.com/client/message/link/open?token=AmRKLqSagAAFZedZ1TCAAAY%3D
Reproduce Steps
For instance, when given:
I will have
rather than
rendered in the sidebar.
The text was updated successfully, but these errors were encountered: