Reputation: 18
I need set the page title dynamically because in my node actually exist 1000 documents, so I think that exist a way to do it automatly. I'm using Kentico 10
Upvotes: 0
Views: 387
Reputation: 247
I'm not sure that I understand your question, but if you want:
To set page title for your documents, to be shown in browser, you should follow link in documentation.
To iterate over all nodes and update document name/ page title with some custom text, you should look into Kentico API docs. You should look into section for Updating published pages (see code example bellow):
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
var pages = tree.SelectNodes()
.Path("/Articles/", PathTypeEnum.Children)
.WhereLike("DocumentName", "Coffee%")
.OnSite("DancingGoat")
.Culture("en-us");
foreach (TreeNode page in pages)
{
page.DocumentName = "Updated article name";
page.SetValue("ArticleTitle", "Updated article title");
page.Update();
}
Upvotes: 0
Reputation: 6117
Use a macro. In the parent page of all your documents, you can use a field from the specific page type or use the document name.
For example if you have a page tree like this:
-Products
--Product 1
--Product 2
In the -Product pages metadata add
Page title: {%DocumentName%}
or
Page title: {%PageTypeField%}
Using the macro will allow you to dynamically get those values vs. having to code each one manually.
Upvotes: 2