dw.content
Class MarkupText
Object
dw.content.MarkupText
The class represents a content snippet with markup. This is typically a HTML content snippet. The class also processes the special links from Commerce Cloud Digital content management and automatically rewrites them into links for use in the storefront.

The following special links can be used inside of a MarkupText:

  • $url('<pipeline>' [, '<key1>', '<value1>', '<key2>', '<value2>', ...])$
  • Description:
    The $url()$ function creates and absolute URL and retains the protocol incoming request.

    Example:
    MarkupText:
       $url('MyLinkPipeline-Start', 'key1', 'value1', 'key2', 'value2')$
    is rewritten to:
       http://<host>:<port>/on/demandware.store/<current site>/default/MyLinkPipeline-Start?key1=value1&key2=value2
    Note that the incoming protocol was http in the example above.

  • $httpUrl('<pipeline>' [, '<key1>', '<value1>', '<key2>', '<value2>', ...])$
  • Description:
    The $httpUrl()$ function creates an absolute URL but always with the fix protocol "http". The protocol type of the incomming request is ignored.

    Example:
    MarkupText:
       $httpUrl('MyLinkPipeline-Start', 'key1', 'value1', 'key2', 'value2')$
    is rewritten to:
       http://<host>:'<port>/on/demandware.store/<current site>/default/MyLinkPipeline-Start?key1=value1&key2=value2

  • $httpsUrl('<pipeline>' [, '<key1>', '<value1>', '<key2>', '<value2>', ...])$
  • Description:
    The $httpsUrl()$ function creates an absolute URL but always with the fix protocol "https". The protocol type of the incomming request is ignored.

    Example:
    MarkupText:
       $httpsUrl('MyLinkPipeline-Start', 'key1', 'value1', 'key2', 'value2')$
    is rewritten to:
       https://<host>:<port>/on/demandware.store/<current site>/default/MyLinkPipeline-Start?key1=value1&key2=value2

  • $include('<pipeline>' [, '<key1>', '<value1>', '<key2>', '<value2>', ...])$
  • Description:
    The $include()$ function creates a relative URL which is post processed by the Commerce Cloud Digital Webadapter. The result is the content generated by the given pipeline call.

    Example:
    MarkupText:
       $include('MyIncludePipeline-Start','key1', 'value1', 'key2' ,'value2')$
    results in the content delivered by the 'MyIncludePipeline-Start' pipeline.

  • ...?$staticlink$
  • Description:
    The $staticlink$ function can be used to create a URL to a static resource (such as an image). The URL being generated depends on the owner of the MarkupText instance. For example, a product's long description (which is a MarkupText) will generate links to static resources within the catalog. Possible URL targets are catalogs (for catalog related objects like products and categories), the content library (for library related objects like folders and assets) or the organization (for all objects that are not catalog or library related).

    Example:
    MarkupText: (owned by a content asset)
       <img src="demo/content/bullet.gif?$staticlink$">
    is rewritten to:
       <img src="/on/demandware.static/<current site>/<library>/default/v1178201405900/demo/content/bullet.gif">

Note: The comma symbol , is not supported in parameter values for the link functions.

Properties
markup  :  String  (Read Only)
The content with all links rewritten for storefront use.
source  :  String  (Read Only)
The original content source, without any links re-written.
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
getMarkup() : String
Returns the content with all links rewritten for storefront use.
getSource() : String
Returns the original content source, without any links re-written.
toString() : String
Returns a string representation of this class, the same as getMarkup().
Salesforce Commerce Cloud Courses
Salesforce B2C Commerce Developer - Certification Tests
Why risk failing the SFCC exam? Get 180 real questions, killer content, and everything you need to crush the Salesforce B2C Commerce Developer certification.

Becoming a Salesforce B2C Commerce Developer is your ticket to higher salaries, better job opportunities, and the credibility to stand out from the competition. But let's be honestβ€”passing the certification exam isn't easy. That's where we come in.
Salesforce Javascript Developer I - Certification Tests
Not just another prep courseβ€”this is your shortcut to passing. Master JavaScript for Salesforce and go from 'hoping to pass' to knowing you will. Ready to start?

This isn't just another prep courseβ€”it's your shortcut to mastering the skills and confidence you need to pass. With multiple practice tests covering every section and a final exam simulation designed to mirror the real thing, you'll feel like you've already aced it before test day.
Salesforce B2C Commerce Architect - Certification Tests
Think the Developer exam was hard? Welcome to the next level.

The Salesforce B2C Commerce Architect certification is a whole different gameβ€”complex solutions, elevated difficulty, and skills that set you apart in the eCommerce industry. That's why we're including 11 downloadable PDF guides, packed with best practices and strategies to help you prepare for the exam and build confidence in every topic.
Method Detail
getMarkup
getMarkup() : String
Returns the content with all links rewritten for storefront use.
Returns:
the content with all links rewritten for storefront use.

getSource
getSource() : String
Returns the original content source, without any links re-written.
Returns:
the original content source, without any links re-written.

toString
toString() : String
Returns a string representation of this class, the same as getMarkup().
Returns:
a string representation of this class, the same as getMarkup().

β™₯
Notifications pending to read