Developer forum

Forum » Templates » Problem with DW parsing html attributes with templates tags

Problem with DW parsing html attributes with templates tags

Emil Ryberg
Reply

Hello,

In the master template with Razor syntax, there is an issue when it is parsed.

Code being parsed:

<body data-minicart-page-id="@GetString("Item.Area.HeaderCartPage_ID")" data-maxicart-page-id="@GetString("Item.Area.Maxi_Cart_Page_ID")" data-maxicartlines-page-id="@GetString("Item.Area.MaxiCartLinesPage_ID")" data-searchapi-url="@GetGlobalValue("NOV:SearchApiUrl")">

And the result when parsed is:

<body data-minicart-page-id=""="" data-maxicart-page-id=""="" data-maxicartlines-page-id=""="" data-searchapi-url=""="">

Clearly this is incorrect. A workaround is to use ' instead of " in with the attributes, but this isn't really good HTML. Other than declaring the values as variables, is there a way to make sure it is parsed correctly?

 


Replies

 
Nicolai Pedersen
Reply

Hi Emil

Using a variable in layout templates is the way to go. It is a limitiation of the HtmlAgility pack that is not good friends with Razor and what we use internally to parse the template.

BR Nicolai

 
Emil Ryberg
Reply

Alright, thanks for the answer :)

 

You must be logged in to post in the forum