Page Transformation

john martin asked on April 11, 2017 13:13

I need to use this option for generating sitemap with H-tags. Can I use it using sitemap webpart?

Recent Answers


Jan Hermann answered on April 11, 2017 13:43

If you really need to use the Site map web part you can access the smElem.RenderedHTML property in the code and inject those H tags to it, but I would recommend to build the site map via a hierarchical transoformation where you have a full control over generated code.

https://docs.kentico.com/k10/developing-websites/loading-and-displaying-data-on-websites/writing-transformations/using-hierarchical-transformations

1 votesVote for this answer Mark as a Correct answer

john martin answered on April 11, 2017 14:11

@Jan Hermann any example how to inject the code? Actually I am new in Kentico

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on April 11, 2017 14:17

It is a string so anything that can parse the string. You can write a regular expression or do some workaround like this:

smElem.RenderedHTML = smElem.RenderedHTML.Replace("<a ", "<h1><a ");
smElem.RenderedHTML = smElem.RenderedHTML.Replace("</a>", "</a></h1>");
0 votesVote for this answer Mark as a Correct answer

john martin answered on April 11, 2017 15:11 (last edited on April 11, 2017 15:12)

@Jan Hermann Can you please help me what will be the file name where m going to write this smElem.RenderedHTML code? I have tried to find it but didn't get success

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on April 12, 2017 13:21 (last edited on April 12, 2017 13:21)

You can find the code file in the Web parts application when you edit a web part. The one you need is here:

\CMSWebParts\Navigation\cmssitemap.ascx.cs

0 votesVote for this answer Mark as a Correct answer

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