Ensuring No Unused Images in HTML Output Format.

Hi everyone,

I was wondering if someone would be able to give me some insight into how to ensure there are no unused images that are included in the HTML output format?

Right now, we’re seeing that for one of our publication types' HTML outputs, all images that are in the publication are being zipped up regardless of whether images have been conditioned to not appear in the output format not.

Thank you!

  • Dear Aheeka,

    Not sure which version of SDL Tridion Docs you are referring to, but the solution will be different depending the application version in use.

    1/ SDL Tridion Docs 13 SP2
    Due to the new (enhanced) publishing routines available, the requested behavior is available without any change. So in the new .NET publishing routines only the items matching the Publication context actually make it to the filesystem and hence to the generated ZIP file (for the HTML based outputs)

    2/ Any version before SDL Tridion Docs 13 SP2
    The old (VB6-based) publishing routine did put all the files referenced by the publication on the filesystem. Regardless whether or not they were matching the publication context. As such the generated ZIP file did contain files which were not applicable for the specified publication version.

    You can change this by introducing your own cleanup routine right before the zipfile gets generated. So extend the VBScript based publishing post process in order to remove the graphics not applicable for the publication version from the ‘out’-folder.

    This clean up routine can make use of the publication report file (<publicationGUID>.report.xml) which contains for each exported object (file put on the filesystem) an attribute to indicate that the object was conditionally filtered out by the publication context. So based upon the existence of the ‘condionally-filtered="yes"’ attribute you can remove the file from the ‘out’ location.

    Do keep in mind that:
    - this additional code (to be written in VBScript) will be obsolete from SDL Tridion Docs 13 SP2 onwards as from that version onwards the export routine is only exporting the files that actually are required for the publication version (matching the publication context).
    - the attribute to be verified in the publication report file is containing a spelling error. It states ‘condionally-filtered’ instead of ‘conditionally-filtered’
    - the attribute to be verified in the publication report is only existing on those objects that are filtered out. So in case the object is matching the context, NO attribute is available.

    Kind Regards,

    Raf
  • Hey Raf,

    Thanks a tonne for this; it's extremely helpful!

    I believe we're on 2016 SP4 (SDL Knowledge Center 2016), but knowing that what we're looking for is already available in the latest version helps me - I'll let my team know this so that we can start looking into our options and potentially move to it.
    I'll be sure to also share the VBScript details you provided with our team. Again, really appreciate it! Thanks a bunch!