DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
Static Publishing¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed: | 2010-09-03T16:46:29.200000000 |
Author: | Kasper Skårhøj |
Email: | kasperYYYY@typo3.com |
Info 3: | |
Info 4: |
Static Publishing¶
Extension Key: staticpub
Copyright 2005-2007, Kasper Skårhøj, <kasperYYYY@typo3.com>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
Static Publishing 1
Introduction 1
What does it do? 1
Screenshots 1
Installation and Configuration 3
Publishing directory 3
Configuring URLs to publish 3
staticpub options for crawler configuration: 3
Introduction¶
What does it do?¶
Publishes pages to static files for purposes to a) speed up a website by applying Apache mod_rewrite rules to serve the static pages or b) upload a site with ftp somewhere (of course with no dynamic functionality).
It works based on the “crawler” extension queue system. It has and administration module for overview and management of published files.
Installation and Configuration¶
After installation you will find that the “crawler” extension offers a new “Processing Instruction” called “tx_staticpub_publish”. Before you can use that you must:
- use either “realurl” or “simulateStaticDocuments” on your site (staticpub will figure out itself what the filenames must be).
- configure a publishing directory.
- configure which URLs to publish in the crawler
Publishing directory¶
Simply:
- Set in localconf.php:$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['staticp ub']['publishDir'] = '_staticpub_/';
- Create the directory “_staticpub_” in the root of the TYPO3 website (PATH_site)
You can choose another name than “_staticpub_” for your directory.
Configuring URLs to publish¶
With Page TSconfig you can configure which URLs the crawler will try to publish. Please refer to the crawler extension for a detailed understanding of this format. Its a generic one. Here is an example:
tx_crawler.crawlerCfg.paramSets {
staticpub = &L=[|_TABLE:pages_language_overlay;_FIELD:sys_language_uid]
staticpub.procInstrFilter = tx_staticpub_publish
staticpub.baseUrl = http://localhost:8888/typo3/dummy_4.0/
}
This configuration is enough to publish URLs which even combines with the various languages available on pages. The published pages of a default configuration like this will be the html-files ONLY - so no resources (images / flash / stylesheets). This mode is useful if you wish to create HTML files for performance improvements on the same server using mod_rewrite. In such a case you would set up some mod_rewrite wizardry that checks if a static file exists in the publish directory, if so, serve that file while all resource files (which are not served by TYPO3) are already on the server.
Alternatively, you may want a variant of this; namely exporting all resources as well. This can be done with a little setting. This modified configuration does that:
tx_crawler.crawlerCfg.paramSets {
staticpub = &L=[|_TABLE:pages_language_overlay;_FIELD:sys_language_uid]
staticpub.procInstrFilter = tx_staticpub_publish
staticpub.procInstrParams.tx_staticpub_publish.includeResources=relPath
staticpub.procInstrParams.tx_staticpub_publish.overruleBaseUrl =
staticpub.baseUrl = http://localhost:8888/typo3/dummy_4.0/
}
It asks to include resources. It also asks to set the path relative to these. This is necessary because in this case a base-url is set in the rendered files because we use “realurl”. This is also the reason why the base url is set blank in the second line I introduced above.
staticpub options for crawler configuration:¶
The following options are set with “....procInstrParams.tx_staticpub_publish.” as prefix. See also the “crawler” extension documentation for information on “procInstrParams”.
includeResources¶
Property
includeResources
Data type
boolean/string
Description
If true, resources (images, flash etc) is also moved to the publish directory.
If its a string matching “relPath” the paths to these resources will be prefixed so a base-url can be avoided.
Default
overruleBaseUrl¶
Property
overruleBaseUrl
Data type
string
Description
If found, this will be the value of the <base> tag URL.
If blank: <base> tag is removed if any.
Any other value is set as <base href=”VALUE”>
Default
sys_domain_base_url¶
Property
sys_domain_base_url
Data type
Integer
Description
Same as overruleBaseUrl only with an id of a Sys Domain
Default
checkLinks¶
Property
checkLinks
Data type
boolean
Description
If set, all <a> tag links are checked:
- If they link to a directory, “index.html” is appended.
- If the file linked to exists - and if not a javascript message is shown instead.
Useful option if generating site for offline browsing on a CD.
Very important: WIth this option you must publish the site twice in a row because otherwise most links will not exist when checked for and javascript error messages will appear. On the second publishing (or exactly the same) all files have already been created, therefore are found and links are made right!
Default
publishDirForResources¶
Property
publishDirForResources
Data type
string
Description
If set, al recources would be published in this folder and not in de publish folder of the pages
Default
Static Publishing - 4