Is there a list of razor helpers for templates?

Posted by geoff.white@dlgsc.wa.gov.au on 15-Mar-2019 06:24

Is there a list of razor helpers for templates? Or generally any documentation on these helpers?

Initially I would like to add a 'date modified' in a MVC template for displaying when the page was last updated.

All Replies

Posted by geoff.white@dlgsc.wa.gov.au on 21-Mar-2019 08:11

Anyone?

Posted by geoff.white@dlgsc.wa.gov.au on 05-Apr-2019 03:45

Hello?

Posted by jread on 05-Apr-2019 13:20

Hey Geoff,

This article covers how to get the current page data via page node ID:

[View:https://www.progress.com/documentation/sitefinity-cms/for-developers-query-pagedata-by-pagenode-id:550:50]

You can get the current node by following this:

var currentPageNode = SiteMapBase.GetActualCurrentNode();

Posted by markmazelin on 05-Apr-2019 14:02

Geoff: I haven't found a documentation page like you are asking. You could look through some of the HtmlHelper extensions in the Feather github repo. There are a number of HtmlHelper extension methods in the classes in this folder:

https://github.com/Sitefinity/feather/tree/master/Telerik.Sitefinity.Frontend/Mvc/Helpers

For your idea of adding date modified, it doesn't look like any of those expose that data. The closest would be a call to @SitefinityContext.Page, which ideally would have it, but Sitefinity limits the return of the Page info to Title and Keywords. My guess is you would need to write you own extension that duplicates the code in that method, but exposes more data with your own model.

This thread is closed