4

I am using Kentico 5.5R2 for my website, where i want to generate GoogleNewsSitemap. So far my code is able to fetch newarticle url and publication date, but i'm not able to fetch the title of news article dynamically here's code

<url>
<loc><%# GetAbsoluteUrl(GetDocumentUrl()) %></loc>
<news:news>

<news:publication>
<news:name>Yourwellness </news:name>
<news:language>eng</news:language>
</news:publication>
<news:genres>PressRelease, Blog</news:genres>
<news:publication_date>
<%# GetDateTime("DocumentModifiedWhen", "dd-MMM-yy")%>
</news:publication_date>
<news:title>method for fetching title Comes here </news:title>
<news:keywords>Health</news:keywords>
</news:news>
</url>

I tried many methods to fetch title but it comes as blank.

leroy
  • 93
  • 9

4 Answers4

1

<%# Eval("DocumentName") %> is the default for the node unless you are using something else with a custom Document Type

Ben E G
  • 971
  • 8
  • 16
0

Have you tried just a regular Eval? Can't remember the field name, and not at my work computer, but probably one of these:

<%#Eval("DocumentTitle") %>
<%#Eval("Title") %>
Doozer Blake
  • 7,677
  • 2
  • 29
  • 40
  • I tried eval methods but it is returning a blank value... for example I tried this `<![CDATA[<%# Eval("NewsTitle")%>]]>` – leroy Nov 29 '11 at 05:54
0

You might be looking for:

<%# Eval("DocumentName") %>

It depends on what the individual Document Type is using for the title. It could be the document name as above, or something like "NewTitle".

John B
  • 20,062
  • 35
  • 120
  • 170
0

Where are you using that code and what web part are you using? Have you tried to get the title in the code behind?

Jurajo
  • 21
  • 1