Hot answers tagged

11

I sense that what you're trying to do is replace some invalid characters while publishing. You would typically do this on the Package.Output variable, not on the Component itself. Output is the text that gets published as part of the Component Presentation. You typically don't want to modify the Component while publishing it. Before is fine, after is fine, ...


8

Template Building Blocks are executed when you publish something. They are used to transform your content, which is stored as XML in the content manager database, to something that your web application needs (typically html or, in cases like DXA and DD4T, JSON). This type of question is what most people here would consider "basic knowledge", so it may be ...


7

If your Publisher is outscaled onto a separate Windows server, then you'll need to make sure that the ECL mountpoints are configured correctly on that server too. I've been caught-out by that before! P.S. You'll need to restart the SDL Publisher Windows Service after making the change.


5

Apparently when you pass a Publication object to a function that takes in an IdentifiableObject GetXXX(IdentifiableObject identifiableObject), the identifiableObject's XML will have less information to reduce the load in Web 8.5 and I had to explicitly load the state of the object using load flags as this would impact the result of the ToXml() method. So ...


5

AFAIK, you won't be able to get the Keyword titles directly in a Razor TBB; however, you can create your own custom function in the Razor TBB that manipulates the XML and returns the titles. The example below is a custom function that takes in as parameter a category XML string and returns the Keyword titles as a list: @using System; @using System....


5

There is a change about the behaviour of the REL Component Presentation in Web 8, due to the change of the control of the target languages by the Publication Target and the new Topology Manager way of publishing. To overcome this, there is a new property that can be controlled in the deployer, changing the tcdl-conf.xml as it is explained in the following ...


3

I just want to point out that retrieving "where used" from GUI or Core Service is completely the same. So, it wont give you any additional information. The only additional thing that you can do is go through all your custom code and check if anything is programmatically reading your TBB for whatever purpose.


3

It looks like you have not added Resolve ECL items V2 to your Component Template TBB. In the template builder folder, you can see SDL External Content Library and named Resolve ECL items V2. Add this to your Component Template and it will deal with the ECL item. I hope it helps.


3

Piggy-backing on the answers of Saurabh and Sabarish, I would suggest doing something similar, but moving the XML processing code Sabarish suggests (with Saurabh's modification) out of the Razor template and into your C# TBB. Then you could simply add your Keyword titles to the package as an array and iterate through it with a foreach loop in your Razor ...


3

Adding to @Sabarish's answer, If you are interested in Titles only; get the lighter XML for Keyword list which only contains ID and Title. To do so you should apply the filter in your TOM.NET C# Code as Below: XmlDocument keywordsXml = new XmlDocument(); //Filtering to get ID and Title only Filter fltr = new Filter(); fltr.BaseColumns = ListBaseColumns....


2

If I remember correctly when using Package.CreateHtmlItem(htmlContent) (which is similar to using Package.CreateStringItem(ContentType.Html, htmlContent)) then your content will be automatically HTML encoded. So I would recommend using Package.CreateStringItem(ContentType.Text, htmlContent) instead if the automatic HTML encoding is in your way. But be aware ...


2

What I didn't explain in the answer to Embedded Razor Templates was the reason why. What's happening is that the templates get compiled dynamically, and the resulting type is loaded in the appDomain. If you create a new version of a template building block, the includes are resolved as a simple text include and become part of the resulting type. The mediator ...


2

I don't think that default values in Parameter Schemas actually work. If you want default values for your TBB parameters, you should put those in your code (in case a Package item named after the parameter is not found).


2

Certainly, take a look at the BluePrintNodesFilter filter in the TOM.NET API (chm). BluePrintNodesFilter Class Represents the Filter for a list of BluePrint nodes Example usage: SystemManager systemManager = session.SystemManager; BluePrintNodesFilter filter = new BluePrintNodesFilter(session); IEnumerable<BluePrintNode> allBlueprintNodes = ...


2

Welcome, Mahesh. Try the Convert XML to XHTML Template Building Block, which is separate from Default Finish Actions. Otherwise run Template Builder to confirm how your Output changes for each TBB.


2

To create and use Custom Dreamweaver Functions from a Razor Mediator. Refer to this below example, you can create one specific to your case. Create a custom class in C# using the TOM.NET API based on ITemplate and IFunctionSource [TemplateCallable] public String GetThumbnail(String compURI, String Prefix, int Width, int Height) { Component comp = ...


1

Your Regex looks overly complex, but does seems to work fine on plain XHTML. However, if you're using DD4T, the XHTML will be embedded in JSON. As a result, the double quotes will be escaped (preceded by a backslash), in which case the Regex no longer works. Just obtain the DD4T JSON and test it using an online Regex tester, for example: http://regexstorm....


1

As Velu says, these days it's much more common to do this in the web application, perhaps using Tridion's Contextual Image Delivery If you want to do it in templating, this is also possible. In .NET you can make use of System.Drawing.Bitmap to do things like resizing. Tridion's AddBinary method has overloads that support variants, which allows you to make ...


1

That's interesting! You can see that the InheritMetadataPageModelBuilder is expected to be in namespace Sdl.Web.Tridion.Data, but it actually is in namespace Sdl.Web.Tridion.Templates.R2.Data. See GitHub Interestingly, the DataModelBuilderPipeline in DXA 2.0 release does expect it to be in Sdl.Web.Tridion.Templates.R2.Data, but you can see that the last ...


1

It works! I don't know what changed. I deleted and re-created the Target Groups, re-published the page, and huzzah - the extension data is present in the json. Thanks to all those who commented and responded.


1

It will only generate tags if you Create a Target Group and then Add Target group with a component presentation on the page. AddTargetGroupsModelBuilder should be updated in RenderPageContent TBBs JSON output looks like this: "ExtensionData": { "TargetGroupConditions": { "$type": "Condition[]", "$values": [ ...


Only top voted, non community-wiki answers of a minimum length are eligible