plainblack.com
Username Password
search
Bookmark and Share

Exporting Content

When you have a system as powerful as WebGUI it seems unlikely that you'd ever want to export your content out of it. However, there are lots of reasons that you may wish to do just that:

  • You need some content that can be easily formatted into an email or some other external publication.

  • Your web host only allows HTML uploads, but you still want to use WebGUI to create the content.

  • You need to run the content on multiple caching servers around the globe.

  • Certain pages in your site are hit very hard all the time, so it's a better use of system resources to make those pages as static HTML.

 

Whatever your reason for wanting to export your content, WebGUI provides three mechanisms to help you do it: Single Page, Branch, and With Commit

 

Exporting a Single Page

Exporting a single page in WebGUI is quite trivial. Run the following command:

 

cd /data/WebGUI/sbin
perl generateContent.pl --help

 

That will produce the following output:

 

Usage: perl generateContent.pl --configFile=<webguiConfig> --url=home



Options:



--configFile WebGUI config file (with no path info).





--assetId Set the asset to be generated.



--help Displays this message.



--styleId Set an alternate style for the page.

Defaults to asset's default style.



--toFile Set the path and filename to write the

content to instead of standard out.



--url The URL of the asset to be generated.



--userId Set the user that should view the page.

Defaults to "1" (Visitor).

 

Therefore you could export the home page like this:

 

cd /data/WebGUI/sbin
perl generateContent.pl --conf=www.example.com.conf --url=home

 

And you could export it to a file called “index.html” by appending the following onto the command:

 

--toFile=index.html

 

This can be useful if you only need to export a page or to, or if you want to export content in a scripted fashion, such as running it from a cron job.

 

Exporting a Branch

WebGUI also has a mechanism to allow you to export an entire branch of content whenever you like. To use this you first must enable it your WebGUI config file. You need to add a directive like this:

 

“exportPath” : “/var/www/exports”,

 

Then restart modperl to have the change take effect. Going forward anyone in the “Export Managers” group will be able to export a branch of content. The export function is available under the class icon context menu of all assets.

 

 

That will bring you to the export page. Here you can choose how many levels deep in the branch you'd like to export, what user should be logged in for exporting the pages, the default file name your web server will look for on directory index files, and finally whether or not to create symbolic links for extras, uploads, and root urls.

 

 

When you hit “save”, you'll be presented with a screen that shows you the export status in real time:

 

 

Exporting With Commit

You can also export content as you make modifications to it. In this way you don't have to export content that you've already exported before, and you don't have to remember to export it. Note that this option uses the “exportPath” config file directive too. See the previous section for details.

 

To set this up go to Admin Console > Workflow and edit your content approval workflow. For this example we'll edit the “Commit Without Approval” workflow. Then add the “Export Version Tag To HTML” activity so that it has two activities, like this. Be sure the export happens after the commit, or you won't get the results you expect.

 

 

From now on when you commit your changes, those changes will also be exported out to static HTML in the export folder defined in your config file.

 

Exporting Caveats

There are a few things to be concerned about when exporting content out from WebGUI.

  1. WebGUI has a lot of dynamic features like polls, login macros, etc that will not work in a statically exported site. So be sure not to use any of that stuff in your content if you plan to export.

  2. If you don't put file extensions on your asset URLs, WebGUI will export them as a folder and then create an index.html inside that folder with the content from that asset. If you don't like the idea of those folders, then use file extensions on all your URLs.

  3. If you upload your files to another server, you should also upload your WebGUI uploads folder, as it will contain images and files that your site likely needs.

Keywords: export html static html

Search | Most Popular | Recent Changes | Wiki Home
© 2018 Plain Black Corporation | All Rights Reserved