Hiya @Cheesey,
Quick and to the point:
To insert the title, you can use:
// insert at the top
#let title = "The new title" // or `[The new title]` if you want content
// replace line 51
#text(blue, size: 24pt, "Document Title (from above)" )
// with
#text(blue, size: 24pt, title )
// also replace line 36
title: [Document Title],
// with
title: title,
To insert the level 1 heading into the header you can:
// insert at the top
#import "@preview/hydra:0.6.2": hydra
// replace line 58
#text(blue, size: 18pt, "Current Level 1 Heading (e.g. 'Introduction')" )
// with
#text(blue, size: 18pt, hydra(1))
// or (if you want the first page to display the heading)
#text(blue, size: 18pt, context hydra(1, skip-starting: false))
// or EDIT: Section body only (no section number)
#text(blue, size: 18pt, context hydra(1, display: (_, it) => it.body, skip-starting: true))
Now, before you go too far, perhaps your “template” could benefit from some refactoring. This to help you along the road. Some reading that would be beneficial (please don’t mind the titles):
- What is the best way to retrieve template argument outside the template? - #3 by PgBiel
- How to structure a single page template so that one can continue the document after the show function? - #4 by bluss
I am sure you have read: https://typst.app/docs/tutorial/making-a-template/. The two posts above are helpful in understanding templates better, as well as many other posts on this forum.
The suggested solution is quick and to the point, and I mean by that that it is not using the full potential of templates. I haven’t refactored your code and it could be done in a much more elegant way with some refactoring.