slidev icon indicating copy to clipboard operation
slidev copied to clipboard

`titleTemplate` not working

Open xsjcTony opened this issue 1 year ago • 1 comments

Describe the bug titleTemplate is not using the title attribute or h1 of each page, where it's always using the very first title on the first cover page. If not title defined in the first cover page, Slidev is used to replace %s

To Reproduce Steps to reproduce the behavior:

  1. Go to slides.md
  2. Add `titleTempalte: '%s - test' in FrontMatter
  3. Add a title or h1 to the first page
  4. Add second page and define a title or h1
  5. %s is not replacing with the second page's title but keeping using the first page's.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome 120
  • Slidev version: latest

xsjcTony avatar Dec 11 '23 23:12 xsjcTony

I think this is the expected behavior in the current design. For most slides, the first slide's title is the global title, but the titles of other slides are often titles of sections, and some non-first slides may even have no title.

In the future, a section option can be added to the per-slide frontmatter, which will update the page title.

kermanx avatar Feb 12 '24 01:02 kermanx