Skip to main content

 Tutorials

Task-driven tutorials and recipes for PageSeeder

How to create a website (or Berlioz) publish script in PageSeeder (Advanced)

Skills requiredXML
Time required (minutes)30
Intended audienceDeveloper
DifficultyMedium
CategoryBerlioz

Objective

This tutorial demonstrates the use of advanced features in publish scripts to process folders in PageSeeder. These kinds of features are typically required for more advanced website publishing.

Pre-requisites

Please make sure you have the following items set up before proceeding:

  • PageSeeder (version 5.8 or above) installed, please see Installation guide for setting up PageSeeder;
  • Jetty and Berlioz website installed;
  • FTP server in target website server;
  • Exposure to XML language;
  • Experience in programming Apache ANT script (see manual  for more information).

Tutorial

Create PageSeeder webapp config

Create a publish configuration file. See publish-config.

[template]/publish/publish-config.xml

using the following content:

<?xml version="1.0"?>
<publishing>
  <action type="publish">
    <source type="folder"/>
    <target name="ps-publish-website-folder">
      <description>Publish folder to website</description>
    </target>
  </action>
</publishing>

Publish parameters

Following are examples of parameters available on the publish. For a complete reference, see <publishing>.

  • Sample for date pick option
<target name="ps-publish-website-folder">
<param label="File last modified date sinc"
        name="file-date"
        type="date"
     pattern="yy-mm-dd"/>
  • Sample for selective option

<param label="Document status"
        name="document-status"
        type="select"
     default="Approved">
   <value>None</value>
   <value>Initiated</value>
   <value>In Progress</value>
   <value>Approved</value>
   <value>Complete</value>
   <value>Published</value>
</param>

Define Publish FTP property file

Create a website properties file: 

/pageseeder/webapp/WEB-INF/[project]/Publish/config/website.properties

with the following content:

# --------------------------------------------------------------------------- # BERLIOZ PROPERTIES FOR A WEBSITE (Server)                                   # --------------------------------------------------------------------------- #
# This file will be copied to the /config directory of your project on the    # publisher when your deploy this publish script to the server using FTP      # (build.xml > deploy-server).                                                #
# This file will ultimately be used by the Publisher on your PageSeeder       # production server when you publish your group/document to the Website. It   # should therefore specify the properties of your production Berlioz Website. #
# ---------------------------------------------------------------------------
 
# FTP properties
ftp.server=[Host URL]
ftp.userid=[Host User ID]
ftp.password=[Host User Password]
ftp.dir=webapps[Host Remote Folder]

Publish the content of a folder

This folder publish will export all content including documents, images and binary files and then copy the files to a server via FTP.

On the target server, the corresponding folder is deleted and the new content is written on top of it.

Get the basic publishing script (refer to How to create a website (or Berlioz) publish script in PageSeeder).

To modify the ps:export options, see the reference page for the Export task. Some examples are as follows:

  • Export using document status
<filter with="psstatus:${ps.param.document-status}" />
  • Export using the document last modified date
<filter since="${ps.param.file-date}"/>
  • Export PDF files since the date selected in publishing option
<filter with="psmediatype:application/pdf"
       since="${ps.param.file-date}"/>

Check the configuration

To check that the Publish option is enabled. Go to the document folders page and that check that:

  • The Export button at the top is a drop-down with the Publish option
  • The drop-down menu for documents and folders include the Publish option

Document folders – Publish option

Created on , last edited on

Available tutorials