How to have H1 and byline in the master page - Kentico

Chris Kling asked on February 17, 2017 12:58

I'm trying to work out a way I can add a H1 and byline markup to my Root master page and then have all the pages underneath fill them in. I'm using the Portal Engine development mode.

The H1 and byline are in a different web part zone to the page placeholder. They are showing on all the pages under my root node but I can't find a way to populate the title or byline on those pages.

I've tried a few things: - editable text web part - but this is only editable on the Root node and not the pages underneath - I thought maybe I could use <%# Eval("Byline" %> and add this as a field to the Page type but that doesn't show through either.

Is there any way to include something in the master page that is dynamically filled in (or editable in the designer) on all pages under the root node? Or do I need to move my H1 and byline out of the master page and include in every template that my pages use?

Correct Answer

Mariia Hrytsai answered on February 17, 2017 13:30

You can add additional field to your page type named 'Byline'. This field will be editable on Form tab of each page. Then you can include some viewer web part like Document Viewer or repeater. Then configure Path like './' (it means to display information for current page). And add transformation where you cat do something like <%# Eval("Byline") %>.

Or alternative way is to use static html web part and add macro there {%CurrentDocument.Byline|(identity)GlobalAdministrator%}.

4 votesVote for this answer Unmark Correct answer

Recent Answers


Peter Mogilnitski answered on February 17, 2017 13:28

You can do it using macros: add a static text web part on your master and set text property to : <h1>{%CurrentDocument.DocumentPageTitle@%}</h1> or <h1>{%CurrentDocument.DocumentName@%}</h1> Depending on where you keep your page title.

1 votesVote for this answer Mark as a Correct answer

Chris Kling answered on February 17, 2017 13:38

Thanks to both Mariia and Peter! The macro bit was what I was missing - I tried all sorts of other ways with no luck but the static text element using the macro worked a treat :)

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on February 17, 2017 14:48

No need to post both in DevNet and SO as the DevNet will bring the SO posts over automatically. http://stackoverflow.com/questions/42297255/how-to-have-h1-and-byline-in-the-master-page-kentico

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on February 17, 2017 17:03

This is how I would achieve this.

  1. Create a Page Type field "ByField" which will be common to all my page types where I would want H1 tag to appear.
  2. Put a HEAD HTML web part in the Master Template and access it's value in an H1 tag.

Head HTML webpart is important as it is a good practice to have H1 in your HEAD tag

I will put this code in the webpart

<h1>{%ByLine%}</h1>

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.