4

我正在为我的网站使用 Kentico 5.5R2,我想在其中生成 GoogleNewsSitemap。到目前为止,我的代码能够获取 newarticle url 和发布日期,但我无法动态获取新闻文章的标题这里的代码

<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>

我尝试了很多方法来获取标题,但它是空白的。

4

4 回答 4

1

<%# Eval("DocumentName") %> 是节点的默认值,除非您使用其他具有自定义文档类型的东西

于 2011-12-19T05:26:00.040 回答
0

您在哪里使用该代码以及您使用的是什么 Web 部件?您是否尝试过在后面的代码中获取标题?

于 2011-11-29T13:52:42.130 回答
0

您可能正在寻找:

<%# Eval("DocumentName") %>

这取决于标题使用的单个文档类型。它可以是上面的文档名称,也可以是“NewTitle”之类的名称。

于 2011-11-29T12:42:30.167 回答
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") %>
于 2011-11-25T16:46:59.830 回答