3

are there any limitations with embedded razor templates. The issue:

<span>Level0</span>
@importRazor("/webdav/020-D%20Design%20Master/Building%20Blocks/System/Template%20Building%20Blocks/Razor%20TBBs/Component%20Layouts/Intro/Test%20Level1.cshtml")

And child Level 1 has

<span>Level1</span>
@importRazor("/webdav/020-D%20Design%20Master/Building%20Blocks/System/Template%20Building%20Blocks/Razor%20TBBs/Component%20Layouts/Intro/Test%20Level2.cshtml")

And child Level2 has

<span>Level2</span>
@importRazor("/webdav/020-D%20Design%20Master/Building%20Blocks/System/Template%20Building%20Blocks/Razor%20TBBs/Component%20Layouts/Intro/Test%20Level3.cshtml")

And Level3 has

<span>Level3</span>

So the final output should be:

Level0
Level1
Level2
Level3

but currently, I am seeing output as Level0 only. Is this expected?

3

When a template is compiled by the razor mediator, any embedded templates are resolved and the text is embedded before compilation occurs. The resulting assembly is cached, and that's the last time the embedded templates will be looked at until the embedding template is for whatever reason compiled again.

The trick is to make a small, otherwise irrelevant change in the embedding template. For example, change the title. (I usually change it back immediately - the point is to update the timestamp of the last save.) This will ensure that the cached version is now out of date, and the whole process of resolving embedded templates will happen again.

The other way to clear the cache is to restart the publisher service. I'd usually recommend that in development, the quickest/easiest way is the first method, while in production, your best bet is to restart the publisher after the content porter import.

| improve this answer | |
  • Thank you Dominic, i did try restarting the service (actually i restarted all inlcuding COM+ as its a dev env) but no luck. But this is a valuable info. Thank you – Harish A Aug 23 '16 at 13:33
  • Oh well... it was worth a try. I'd suggest downloading the sources of the razor mediator and examining the logic. You could even make a debug build and step through what's happening. – Dominic Cronin Aug 24 '16 at 8:59
1

It seems to be the issue with TBB that are generating output to placed in broker DB.

If you are using DD4T TBB for publishing then there is parameter LinkLevel, which identifies how much deep it should traverse through to render the output.

The default value of LinkLevel is 1.

Looking at the output, it seems that you have not specified the LinkLevel parameter.

Given below is the syntax for adding LinkLevel parameter

<TemplateInvocation>
    <Template xlink:href="tcm:x-xxxx-2048" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:title="Title" />
    <TemplateParameters>
      <Parameters xmlns="DD4T.Templates.Schemas.DynamicDeliveryParameters">
<LinkLevels>6</LinkLevels>
</Parameters>
    </TemplateParameters>
  </TemplateInvocation>

Here, I have given LinkLevel as 6 that means it will go down until 6 levels.

| improve this answer | |
  • Thank you Hiren, though we are not using DD4T as of now, this actually makes a complete sense. I will start looking in this direction. Again, thanks for the valuable pointer. Will mark the answer as soon as i get that working, if its ok. – Harish A Aug 22 '16 at 18:13
  • That's fine, let us know your finding on this. I ll be interested to know what is causing this behavior in non-dd4t implementation. – Hiren Kaku Aug 22 '16 at 18:15
  • @HarishA - The first place where you should look is odata output, if it contains all the levels. If it doesn't contain then TBB is the problem where you are not retrieving components recursively during rendering. – Hiren Kaku Aug 22 '16 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.