How to display a short version of a heading inside the header?

Hi,

here is a solution using hydra.

#import "@preview/hydra:0.5.1": hydra, selectors
#import selectors: custom

#let chapter(long, short) = {
  [#metadata(short)<short>]
  heading(long)
}

#set page(
  header: context hydra(
    skip-starting: false,
    custom(<short>),
    display: (_, elem) => {
      elem.value
    }
  )
)

#chapter[Long title 1][Short 1]
#lorem(2000)

#chapter[Long title 2][Short 2]
#lorem(2000)

#chapter[Long title 3][Short 3]
#lorem(2000)
2 Likes