S-Tags
If you are building a page type designed to pull in content from other files (such as with the widget model), you can set up the pages that pull in the content to auto-publish when the content is updated. If the page selects content with a filechooser, that parameter can have "s-tag" (short for source-tag) set as the dependency
attribute value. When the "source" page (chosen via that filechooser) is published, the page with the s-tag is published as well.
S-tags are formatted like dependency tags, for example {{s:####}}
. While a dependency tag inserts the URL of the live page on publish (/about/president.html
), an s-tag inserts the Modern Campus CMS staging file path, starting with the site name (gallena/about/president.pcf
). This builds the path to the file in staging, especially for files located in another site in the account.
Filechoosers can be used on PCFs, in page parameters and MultiEdit content, and in TCFs. When defining the parameter, it should look something like this:
<parameter name="source-file" group="Everyone" type="filechooser" dependency="s-tag" prompt="Widget"alt="Choose the widget file you want to include on your page."></parameter>
Then in the XSL, when you build the path to the file, remember that it points to the staging file. If that is what you want, then the script might look like this:
<xsl:variable name="widget-path" select="ouc:properties/parameter[@name='source-file']" /> <!-- assuming the location of parameter in current context --> <xsl:variable name="widget-doc" select="doc(concat($ou:root, $widget-path))" /> <!-- don't need to add $ou:site because the S-Tag already includes it -->
Using s-tags to target the source page's production output is not always recommended, since the triggered publish doesn't account for the time it takes for the source page to publish out to the production environment.