Developer forum

Forum » Rapido » Render Cookie template from a page

Render Cookie template from a page

Unnsteinn Garðarsson
Unnsteinn Garðarsson
Reply

Hello, I am wondering if it is possible for me to render the Cookie Modal (ModalWarning.cshtml or PanelWarning.cshtml) templates in a custom page somehow. The reason for me asking this is that I need to be able to present the cookie modal to the customer after they have accepted so that they have the option on making changes to their selection.

Regards.


Replies

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hello,

In regular way the cookie templates cannot be defined for a page but it's possible to set for specific website level (via Edit website-Cookies). The setting overrides general cookie settings (if cookie manager is enabled).

BR, Oleg QA

 
Nicolai Pedersen
Reply

Hi Unstein

You have to just render the markup from the cookie template in your layout template. 

You could create a seperate page with cookie settings using a custom layout template or just add a paragraph on a regular page, and create a paragraph template that contains the cookie settings and the form that belongs to it.

I would not render the cookie form on every page as it would increase your response size for all pages and for no reason - so linking to a page with the cookie settings is my recommendation.

BR Nicolai

 
Unnsteinn Garðarsson
Unnsteinn Garðarsson
Reply

Nicolai, are there any plans to support adding a link to a cookie policy site in the cookie modal and also in general supporting rendering the cookie form from pages and/or paragraphs so that the user can change the previously selected cookies?

 
Nicolai Pedersen
Reply

Not for Rapiod as we do not add new features for Rapido.

We might consider it for Swift though.

 
Unnsteinn Garðarsson
Unnsteinn Garðarsson
Reply

Hello Nicolai, I am trying to create a custom page with just a copy of the CookieWarning/ModalWarning.cshtml template. I created the file Designs/Rapido/Custom__ModalWarning.cshtml and I also created the folder Designs/Rapido/Blocks.

the Custom__ModalWarning is a tweaked copy of the original and is included in attachments.
the Blocks folder that I created just contains the same components as in the CookieWarning/Blocks folder.

However when I try to open the page I get the following error, I have followed the Rapido docs for creating a custom page and I cannot see what is wrong here since the error message is not helping me at all since the parsed file does not have a line 14115
 

Error compiling template "Designs/Rapido/_parsed/Custom__ModalWarning.parsed.cshtml"
Line 14115: 'RazorTemplateModel


 
Unnsteinn Garðarsson
Unnsteinn Garðarsson
Reply

I figured out that the error has something to do with the CookieForm and/or CookieScript Blocks. Could it be due to a missing reference to the @Render method that the CookieForm uses?

 
Unnsteinn Garðarsson
Unnsteinn Garðarsson
Reply

This has been resolved! There was a leftover from the copy paste of the blocks, referencing a RazorTemplateModel.

 

You must be logged in to post in the forum