November Happy Hour will be moved to Thursday December 5th.

Render Block in XhtmlString field

Vote:
 

Hi!

I use Episerver 11 and a standalone Nuxt front-end. I having problem rendering blocks (which are Vue components) in XhtmlString field. 

It work well when I write the same code into Views/shared/cshtml, but I want to do it with a standalone front-end.

Does anyone have experience with this?

#208423
Oct 23, 2019 14:33
Vote:
 

Hi Eirik

Can you post a sample of the rendered (wrong) markup, so we can have a look and figure out the issue?

#208672
Oct 30, 2019 7:34
Eirik - Oct 30, 2019 12:26
Here is my postman output when im rendering blocks in XhtmlString:

"content": "

Here is some text....

\n

Here is some text....

\n

Here is some text....

\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\n

More text...

\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n",

"content": = XhtmlString
n\r\n\r\n = blocks placed in XhtmlString

https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2019/8/content-delivery-api-render-any-block-inside-xhtmlstring/ 

I tried this link. I was able to get n\r\n\r out of blocks in content.


In this situation I have two block placed in Xhtml. 
I've tried to display this data cshtml, but didn't find any solution to display those blocks. 

Have not tried this yet tho, I just found the blogpost: https://world.episerver.com/blogs/Per-Magne-Skuseth/Dates/2016/1/episerver-find-index-blocks-in-xhtmlstring/

* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.