Forums / General / Publishing static pages

Publishing static pages

Author Message

Kaustav Bhattacharya

Monday 28 July 2008 2:42:26 am

I often need to set up a CMS for my editorial staff to update content on web sites and at the final stage I need to export all the pages as static HTML pages and transfer them to my clients hosting platform. At that point the pages are totally disconnected from the CMS and just live as stand-alone static pages. The process is restrictive but works well. Recently I have started using EZ-Publish and I wanted to know if there was a way of exporting pages out of EZ-Publish as stand-alone static pages. Is there such a magic button in EZ? Do I need to install an extension plugin?

I have done a little research since posting this and I have found a useful article:

http://ez.no/developer/articles/ez_publish_performance_optimization_part_3_of_3_practical_cache_and_template_solutions/caching_overview

If there are any EZ experts reading this post can, would I be correct in assuming that once set the PreViewCache and re-publish the whole site, all the pages will be stored in static form on the filing system somewhere as XHTML files? Presumably I can copy these files and FTP them across to my client to host on their web site, or does it not work like that? This is ideally what I'd like to do.

J

Gabriel Finkelstein

Friday 01 August 2008 10:11:20 am

As far as I know, if you enable Static Cache, you'll have a version of your entire site stored in HTML in the static cache folder.
If you enable PreView cache you will only have bits of HTML stored in .cache files (with random file names, I believe). The contentes of this .cache are, for example, the different views of each object or the block caches, in HTML, accompanied by some metadata about that cache.
Therefore, I think you could use static cache, or maybe a website crawler.

Stéphane Couzinier

Friday 01 August 2008 2:19:08 pm

Hi

If you "just" have to export your website :
1) activate the static cache (in site.ini)
configure which folders/siteaccess will be generate (staticcache.ini).
enable CronjobCacheClear
you don't have to enable PreViewCache.
If you don't use ez in your front server, you don't really have to use cache-block/view cache etc

2)Activate the cron /cronjobs/staticcache_cleanup.php
It will generate the static file

3) change the staticcache_cleanup.php
You can add a code to send the HTML file to your front server(s)
Or you can use rsync or somehing else

http://www.kouz-cooking.fr

Piotrek Karaś

Friday 01 August 2008 11:21:07 pm

Let's ask eZ Systems: how do you manage your eZ Publish documentation for that matter?

Interesting topic - similar functionality comes back from time to time as our client's expectation.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Russell Michell

Thursday 14 August 2008 3:39:52 pm

Hi guys, we do this with our current Plone based website using a clunky extension to do it.

However, we're moving to eZ Publish and the native method of static content export seems to be geared towards a live, public CMS but a predefined cache setup for those pages that aren't updated frequently enough to warrant the overhead of the PHP engine and eZ template compilation (I could be wrong though).

Regardless, this was one of the "Must Have's" when I was looking at candidate CMS's so I simply spent an hour or two honing a simple bash script which statically exports the entire site.

The only addition I'd make to the script (and I will when I'm done configuring eZ for our needs) would be to clear the siteaccess cache before deployment to ensure the latest-content of our Custom Tags appears in each page they're included in. But that's just a matter of adding this to the script:

php bin/php/ezcache.php -s siteaccess

If you're interested, here is the small bash script I wrote:

#!/bin/bash
#ez-deploy.sh: A shell script to deploy an eZ Publish website.
# Russ Michell, May 1, 2008

# The URL to fetch:
URL=$1
# The dir to pile everything into locally
DIR=$2

# An array of dirs to exclude:
EXC[0]=ezpublish/index.php/eng/Community
EXC[1]=ezpublish/index.php/eng/user

# Build a list of dirs to exclude:
for exclusion in "${EXC[@]}"
        do
        LIST+="$exclusion,"
done

# Remove the last comma: (Operator "%%" means "delete FROM the RIGHT, to the LAST case of what follows.")
LIST=${LIST%,*}

# The command:
CMD="wget -mErp"
CMD="$CMD -nH"
CMD="$CMD --convert-links"
CMD="$CMD --cut-dirs=2"
CMD="$CMD -P$DIR"
CMD="$CMD --exclude-directories=$LIST"
CMD="$CMD $URL"

# Execute
$CMD

Ensure you set it to be executable and invoke it from the command line or add it to a custom script or even an extension/template/whatever:

#> ./ez-deploy.sh http://my-ez-site.co.nz/   /var/deploy/ezpublish-static/

Obviously, you'd then just use rsync or whatever to transfer your local static site-copy to the remote, public server(s).

Cheers,
Russ

Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom

Believe nothing, consider everything.

Jérôme Vieilledent

Wednesday 05 August 2009 8:26:33 am

Hi

There is an <i>official</i> extension called <b>eZStaticExport</b> to do that. You can find it here : http://projects.ez.no/ezstaticexport

Franck Grenier

Thursday 24 June 2010 6:08:37 am

Hello,

I'm trying to use this extension for static export but I do not understand how I can launch or plan an export.

I've tried to manually run the cronjobs, also with ezexec as Noven said in the documentation.

But nothing happens.

Could you help me please ?

Developer at Open Wide

Jason Dickson

Wednesday 17 November 2010 11:41:08 pm

Hello,

I have been testing the ezstaticexport extension to use with a few sites. Is there any more documentation to use it then in the extension itself. My question is what do you have to put in the apache rewrite rules on the server you exported to, so that it uses the static pages to serve the site.

Thank you for any information.