Developer forum

Forum » Templates » Set template title/description in razor template

Set template title/description in razor template

Kim Pilgaard
Reply

When writing Dynamicweb templates using the html-template syntax it is possible to use the Title and Description (Layout.Title, Layout.Description) tags to modify the title/description shown in the dropdown when picking the template from the backend.

How do we modify these values using Razor syntax?


Replies

 
Thomas Schroll
Reply

Hi Kim

Try:

@Title("Your title")
@Description("Your description")

Regards Thomas

 

 
Kim Pilgaard
Reply

I investigated this further and discussed it with Dynamicweb support. And will share my findings here in case others are curious.

For pages I noticed that the following worked

@Title( "")

@Description( "" )

However the following did not work

@{

Title( "" )

Description( "" )

}

This made me curious so I tried something which does not make sense from a razor point of view. The following works:

@{

@Title( "" )

@Description( "" )

}

As far as I can tell the razor functions Title and Description doesn't do anything, there is likely a regex which scans for @Title and @Description. This is worth keeping in mind when creating your razor templates.

In my situation we where trying to set the title and description tag for paragraph templates, here no syntax allowed me to set the title. During my dicussion with Dynamicweb support they discovered a bug  23169 which caused the @Title tag from working in paragraph templates. This was fixed in version 8.8.1.4

 

 

You must be logged in to post in the forum