Headless implementation of Tridion Docs

I need to implement SDL Docs as a headless CMS.

With the OOB "Dynamic Delivery" Output Format the Topic Content(DITA XML) is published and stored as "HTML" in the Broker Database. When we retrieve rawContent.content of a topic via PCA service, the returned JSON has a TopicBody field with a value of type HTML. Of course, HTML is not headless and has all design aspects associated with it.

Now I need to serve this Topic Body content to some native mobile apps which don't want the content as HTML but a headless format like JSON.

I understand I can publish Topic Content as JSON in place of HTML to the Broker database but it requires heavy customization including DITA-OT, Post Process Plugins, Deployer extension, etc but I don't want to reinvent the wheel if there is already some solution provided by community or SDL.

Questions:

  1. Is there any out of the box offering from SDL to address this challenge?

  2. Do we have any community work related to it?

  • Hi Saurabh,

    I hope to somewhat learn more why the JSON part is important. In the end the XHTML format and the JSON format are both parse-able text based formats - I think we can abstract away the angular and curly braces in some object. That might be easier than rewriting the whole publish pipeline to have curly braces from the start :-)

    Furthermore XHTML contains DITA @class attributes to the edge, so you can find out what was a "shortdesc" or "title" as well.

    Can you help me understand why it has to be JSON?

    Thanks

  • Thanks for the answer Dave.

    Below are the main reasons we want to serve JSON in place of XHTML:
    1. JSON is a lightweight data format and preferred for storing and transporting data whereas XHTML is an XML-based version of HTML and not suitable to serve the native client apps.

    2. I understand XHTML could be parsed into the objects the same as JSON however the published XHTML losses most of the data semantics so it's not suitable for converting to Strongly Typed Data Objects.

    3. As you mentioned XHTML has class attributes however the clients need to do some semantic mapping while converting it to the data objects. Alternatively, we can also do that before serving the clients(similar to explained here) but it adds another layer of data transformation. So I was wondering why not to publish topics as JSON with all the semantics intact (similar to SDL Sites).

    Also, I am wondering what could be the advantages of publishing topics as XHTML by default?

  • Thanks Saurabh, appreciated... and I understand the "preferred" format remark. I'm looking for some justification why it is worth the quite price tag; anything you describe why it is "better"...

    What do you mean under 2 with the XHTML losses most of the data semantics anyway... I don't see the difference on what JSON has "more" to offer? As you stated under 1, it is a a parse-able container format.

    On the wondering, well, I hope today everybody is smarter and more experienced than 5+ years ago :-)

  • Thanks Dave,

    I meant though XHTML is a parsable format but not preferable (primarily because it is relatively hard to parse in data objects). I learned that DXA 2.1+ provides this functionality to map the Tridion Docs XHTML content to Strongly Typed View Models as explained here. This could be helpful.

    Sorry, I am relatively new to SDL Docs so I did not know that the publishing format was not updated in recent years.
    Coming from SDL Sites background and as we progressed there from static HTML -> XML -> JSON, I was expecting something similar.
    I think publishing the content as JSON would be a good idea as it would be aligned to published content by SDL Sites along with the other advantages.

    Thanks again for the help!