slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
32.82k stars 1.33k forks source link

`titleTemplate` not working #1217

Open xsjcTony opened 9 months ago

xsjcTony commented 9 months ago

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):

KermanX commented 7 months ago

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.