Getting the metadata of a page via expression

Kentico User asked on September 20, 2016 23:07

Hi,

I am planning to use the following open graph meta tags and would like to use the description, title, and the current URL as a macro expression. I would like the description and the title to be the same as the description entered in the page metadata and I am hoping there is a way to find that using macros? The master page editor does not give an option to add a macros but I can use the "{% CurrentSiteName %}" so there must be a way to get description, title of the page and the URL.

Thank you,

Correct Answer

Jan Hermann answered on September 21, 2016 09:43

Roman's approach would work for you if you have all the titles and descriptions defined for all of your pages. If any page inherits page title form its parent, the macro would return null. pleas use following macros instead:

{% DocumentContext.CurrentDescription |(identity)GlobalAdministrator%}
1 votesVote for this answer Unmark Correct answer

Recent Answers


Roman Hutnyk answered on September 21, 2016 08:44 (last edited on December 10, 2019 02:30)

{% CurrentDocument.DocumentPageDescription |(identity)GlobalAdministrator%} should do that for you.

2 votesVote for this answer Mark as a Correct answer

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