Set up PDF, Printer Friendly, and XML Configurations
With the simple demo site integrated, you want to take advantage of more system functionality and set up a PDF, printer friendly, and XML version of the pages. The first thing you need to do is set up the publishing targets. New targets are needed to specify a new type of page output. The target used in the previous two technical documents was an HTML target, and the pages associated used a HTML output. Now, you need to setup targets that have different output types.
First, you will create a PDF target.
A. Create a PDF Target
To set up a PDF target:- Go to the Administration area, and select Targets & Destinations from the left navigation bar.
- Click on the web target, and then click New Target.
- For the Name field, type in pdf.
- For the Base Folder field, select the top-level folder of the specific site being managed. In our case, we will use /web.
- For the Output File Extension field, type in .pdf.
- For the Type of Data field, select PDF from the drop down.
- For the Internal Links option, check the box for Include Target Path. This field lets the system know that the path of the target should be part of the publishing output folder and that the links should have this path taken into account.
- Click Submit to save the new target.
Now with the new target in place, you need to set up a destination to have the PDF content published.
To set up a destination:
- Click on the new target located in the asset tree, in the left navigation bar. In our case, we will select /web/pdf.
- Click New Destination.
- For the Name field, type in Local.
- For the Transport field, select an existing transport. In our case, we will select Filesystem followed by Server Hard Drive.
- Select all groups in the Applicable for Groups field, and click the green arrow to have the selected items moved to the box on the right.
- Now click the Submit button to save the new destination.
B. Create a Printer Friendly Target
With the PDF target and destination in place, you want to set up a similar one for printer friendly.
To set up a printer friendly target:
- While still in the Administration area under Targets & Destinations, click on the web target, and then click New Target.
- For the Name field, type in printer.
- For the Base Folder field, select the browse icon and choose the main asset folder for the site. In our case, we will select /web.
- For the Output File Extension field, type in .html.
- Check the Internal Links box for Include Target Path.
- Click the Submit button to save the new target.
Now set up a new local destination for the printer target in the same way it was completed previously for the pdf target. With a printer friendly target and destination in place, you need to set up the final XML target.
C. Create an XML Target
To set up an XML target:
- While still in the Administration area under Targets & Destinations, click on the web target, and then click New Target.
- For the Name field, type in xml.
- For the Base Folder field, click the browse icon, and select the main asset folder for the site. In our case, we will select /web.
- For the Output File Extension field, type in .xml.
- For the Type of Data field, select XML from the drop down.
- Check the Include Target Path box for Internal Links.
- Click the Submit button to save the target.
Now set up a new local destination for the xml target in the same way it was completed previously for the pdf target.
D. Create a PDF Template
With the three targets in place, you are ready to set up the new templates. The first template you want to set up is for PDF generation.To set up the PDF template:
- Go to the Home area, and browse to your templates folder. In our case, we will use /web/templates.
- Click New -> Default -> Template in the top navigation menu.
- For the XML field, please type in the following:
<html>
<head>
<title></title>
</head>
<body>
<!-- #BeginEditable name="PDF-HEADER" -->
<h1>The PDF Header</h1>
<!-- #EndEditable -->
<system-region name="DEFAULT" />
<!-- #BeginEditable name="PDF-FOOTER" -->
<p>The PDF Footer</p>
<!-- #EndEditable -->
</body>
</html> - Check the box Convert HTML to XHTML. This automatically creates XHTML blocks for the PDF-HEADER and PDF-FOOTER regions and puts in additional fields in the <head> portion of the template.
- Now select the System pane. For the System Name field, please enter pdf.
- For the Target field, please select your new PDF target. In our case, we will select /web/pdf.
- Now select the Regions pane. For the Stylesheet field, click the browse icon, and select /common/stylesheets/output/xhtml2fo2pdf. For this example PDF template, you’re actually just producing HTML and having the HTML converted to XSL:FO and then transformed into PDF. You can generate PDFs directly from XML without going through HTML, but for the purposes of this example, it is easier to first use HTML. Please see Google for more information about XSL:FO and the powerful capabilities it provides.
- Now click the Submit button to save the new template.
E. Create a Printer Friendly Template
With the PDF template in place, you need to create the printer friendly template.
To create the printer friendly template:- Browse to the templates folder for the site. In our case, we will use /web/templates.
- Select New -> Default -> Template from the top navigation menu.
- For the XML field, please type in:
<html>
<head>
<title><system-page-title/></title>
</head>
<body>
<!-- #BeginEditable name="PRINTER-HEADER" -->
<h1>The Printer Friendly Header</h1>
<!-- #EndEditable -->
<system-region name="DEFAULT" />
<!-- #BeginEditable name="PRINTER-FOOTER" -->
<p>The Printer Friendly Footer</p>
<!-- #EndEditable -->
</body>
</html> - Check the box that says Convert HTML to template XHTML.
- Now select the System pane. For the Name field, type in printer friendly.
- For the Target field, select the new printer friendly target created earlier. In our case, we will select /web/printer.
- Click the Submit button to save the template.
Now with the PDF and printer friendly templates in place, you need to create the final XML template.
F. Create an XML Template
To create an XML template:- Select the templates folder for the specific site. In our case, we will select /web/templates.
- Click on New -> Default -> Template in the top navigation menu.
- For the XML field, please type in:
<xml>
<metadata>
<title><system-page-title/></title>
<description><system-page-description/></description>
<keywords><system-page-keywords/></keywords>
</metadata>
<main-content>
<system-region name="DEFAULT" />
</main-content>
</xml> - Now select the System pane. For the System Name field, type in xml.
- For the Target field, please choose your XML target created previously. In our case, we will choose /web/xml.
- Now click the Submit button to save the new template.
G. Attach Templates to a Configuration Set
To add new configurations to a configuration set:- Go to the Administration area, and select Configuration Sets from the left navigation bar.
- Select the specific configuration set for the site. In our case, we will choose the Web Standard configuration set.
- Click the Edit tab, and select the Configurations pane.
- Scroll down past the default configuration to the section labeled Add.
- For the Template field, click on the browse icon to choose your new PDF template. In our case, we will choose /web/templates/pdf.
- For the Name field, type in PDF.
- Click Add this new configuration.
- You will be forwarded to the properties for the new configuration (located under the Configurations pane, in the Edit tab), which includes the regions it has inherited from the template. Click Submit to save the changes.
- Repeat this process two more times creating the Printer Friendly and XML configurations with corresponding templates.
With the configuration set updated, you can go to your pages and preview the content repurposed for the newly set up output formats. Your final task is to make the different page formats available as links on the standard HTML configuration.
H. Configuration Hyperlinks from a Template
When a page has multiple configurations, you need a way to navigate between them. A simple system-page-output attribute can be placed inside of conventional HTML anchor tags in order to enable end users to switch between different configurations for a page via standard hyperlinks. These hyperlinks will be accessible both within the system and on published page(s).
To link other configurations within a configuration set from a template (or any other XML/XHTML):
- Go to the Home area, and browse to the standard HTML template used for the pages. In our case, we will select /web/templates/standard.
- Click the Edit tab.
- Create a standard HTML anchor tag without any attributes for your desired configuration. In order for the system to find the desired configuration, use the system-page-output attribute with the name of your target matching the target used in the designated configuration. In the XML field, after the <body> tag, find the place you want the links to appear and insert the following code:
<p>
<a system-page-output="pdf">PDF</a> |
<a system-page-output="printer">Printer Friendly</a> |
<a system-page-output="xml">XML</a>
</p>
This code represents three link tags, each with a special system attribute that points to a unique target used by the chosen configuration set. The system will automatically remove this attribute and will insert in its place a correct href attribute.
The value of the attribute is the name of the target and should not be confused with the name of the particular configuration. In the “XML” output, even though the configuration is named “XML,” the system looks for the unique name of the target, which has also been named “xml.” The special system-page-output attribute is only valid for page configurations that are contained within the same configuration set (i.e. an XML configuration from another configuration set has to be linked in a different manner).
Note: If you don’t know where the code should go, just put it after the opening <body> tag. Additionally, these link values can also go into a block or stylesheet in a template region so that only certain pages make them available (e.g. press releases). - Click the Submit button to save the template.
Now, your pages are ready to go with links to the available formats.