Do Not Inherit Metadata Title, Description, Keywords

Brendon McCarthy asked on January 26, 2015 22:05

Out of the box Kentico 8 pages inherit the parent metadata (title, description, keywords). You can uncheck the "inherit" option and type in manually a title, description, etc.

However, for pages that have not been set manually, the properties are inherited and the result could be hundreds of pages with the same title, description, keywords. This is obviously bad for SEO.

In Settings > Content here is a "Page title format" setting property that by default looks like {%pagetitle_orelse_name%}. This is what the expected page title should be, except that if all pages by default inherit their parent's title, the "orelse name" will actually never be used.

What we need to do is to turn off inheritance for all new pages by default (and all existing pages where there is currently no metadata set) and have it use the Page Name (orelse_name) instead.

I've not found a way to configure this. Also note that all first-level parent pages have the inherit option unchecked and manual page title, description, etc. set.

I found this older post that seems to contradict what is actually occurring: http://devnet.kentico.com/forums/f48/fp1/t28717/stop-meta-data-inheritance-on-all-pages-within.

Recent Answers


Virgil Carroll answered on January 27, 2015 14:46

Brendon, So you are saying your first level pages are set to not inherit but when you add another page below one of those..Luther inherit? What is the template inheritance? If you are inheriting the settings from the nearest master, I wonder if this would cause this behavior. I would try messing with that inheritance level to see if you can get that to not inherit (like unchecking the setting in the master page)...this is just a guess.

If it's actually something with 8 that is causing this, I would say you are probably going to have to run and override during the page create process to uncheck after the create of the page type object.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on January 28, 2015 16:48

If you're looking to create custom metadata for your pages, then remove the "default" value in Settings > Content (on a global level and site specific level). Doing this won't affect any of the pages already created but will affect the new pages. Then in your page you can set some dynamic macros by using {% DocumentName %} or some logical statement like

{%if(ClassName == "cms.blog" || ClassName == "cms.blogmonth"){"A Day in the Life of a Kentico Developer - "}else{""}@%}{%DocumentName@%} 
1 votesVote for this answer Mark as a Correct answer

Brendon McCarthy answered on February 4, 2015 00:18

@Virgil Yes, the "parent" page (anywhere in the tree) has Page Title inherit "unchecked" with a custom value or blank value. When you add a child page, it by default "checks" the inherit checkbox requiring the user to uncheck, clear any existing value (to leave blank) or optionally add a custom Page Title.

@Brendan The Global Settings are what I want them to be, in this case I have Settings > Content > Metadata > Page title format = {%pagetitle_orelse_name%} | {%prefix%}. This is what I want, when the Page Title is empty, use the Page Name (followed by the prefix I've defined). Your suggestion seems to say to remove this and set a macro on the parent page or maybe I misunderstood?

What I am looking for is the option to never inherit the "Page title", "Page description" or "Page keywords" from the parent by default while leaving the Global Settings. This would have the effect of a blank "Page title" on every new page which would cause the global rule to use the "Page name" in every case by default.

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on February 4, 2015 09:20 (last edited on December 10, 2019 02:30)

Hello Brendon,

I am a bit lost in your description, however following macro applies your title format in case there is no page title specified for a page (inherited or empty), otherwise it applies just the page title:

{%CurrentDocument.DocumentPageTitle.ToString()==""?pagetitle_orelse_name+"|"+prefix:CurrentDocument.DocumentPageTitle|(identity)GlobalAdministrator%}

If this is not what you need, please describe your requirement once again with some example.

Best regards,
Jan Hermann

0 votesVote for this answer Mark as a Correct answer

Brendon McCarthy answered on February 4, 2015 15:25

Hi @Jan. Are you suggesting to put this in the Global Settings or the Master Page?

This does not resolve the actual request though. By default, I do not want a new page meta properties to be set to inherit, I want the inherit checkbox unchecked with an empty textbox for the property. Then it will use the Global Setting for Page Title Format I already have set (which does work as expected).

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on February 4, 2015 15:56

Hello Brendon,

If you simply don't want your pages to have those metadata to be inherited by default when a new page is created (for already created pages, you would need to write a script or change it in the database), you can simply uncheck the checkbox in the DocumentEvents.Insert.After event:

var doc = e.Node;
doc.SetValue("DocumentPageTitle", "");

Best regards,
Jan Hermann

1 votesVote for this answer Mark as a Correct answer

Olivier Cozette answered on February 7, 2015 15:59

Brendon, did you find a solution to your problem ?

0 votesVote for this answer Mark as a Correct answer

Brendon McCarthy answered on April 3, 2015 02:01

@Jan, where exactly in the CMS project would this code go? What file?

@Juan, no solution yet unfortunately. I will update when I have one.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on April 3, 2015 10:08

Hi Brendon,

To use the object event handler mention by Jan you need to create the class code file for the handler as described in this example.

0 votesVote for this answer Mark as a Correct answer

Bernhard Kvarda answered on April 14, 2015 16:18 (last edited on April 14, 2015 16:28)

Hi Jan, hi all,

I am working on exactly the same problem as Brendon for our site. I have a question regarding your answer:

"If you simply don't want your pages to have those metadata to be inherited by default when a new page is created (for already created pages, you would need to write a script or change it in the database),..."

I searched the database and could not find the value defining the "inherit" checkmark. Can you please tell me where to find this setting in the database or give me a hint how a script unchecking all those checkmarks could look like? I need uncheck the inheritance for all pages on our site. Thanks for your help!

P.S.: Brandon: The exact answer to how the custom event code could look like is here: http://devnet.kentico.com/docs/7_0/devguide/index.html?event_handlers_overview.htm Just tested it and works fine!

0 votesVote for this answer Mark as a Correct answer

Dave Nelson answered on July 28, 2016 16:53

I also have this problem and am surprised that Inherit is the default behavior for metadata. For SEO it is vital that the Title, Description, and Keywords be unique for every page.

To add a custom event I would have to hire a developer, I would prefer a solution that can be accomplished in the web interface.

0 votesVote for this answer Mark as a Correct answer

Joel Dahlin answered on August 11, 2016 19:15 (last edited on August 11, 2016 19:15)

I am running into this same issue as well. Specifically the Page title. In the Settings > Content : Metadata section I have Page title set to {%prefix%} - {%pagetitle_orelse_name%}. However when a new page is create it just inherits the Parents page title and disregards the settings. Wondering if something changed along the way? This always worked for me before.

0 votesVote for this answer Mark as a Correct answer

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