StaticSite is a Plone Add-on designed to deploy a static version of your plone site to the filesystem. There are many configuration options available for StaticSite, which should be reviewed before deploying a static site.
The StaticSite control panel is available for the Site Setup link, underneath the Add-on Product Configuration
The Deployment Path defines the root folder on the filesystem to which files will be written. The base folder will always be defined by where the Data.fs is stored within your instance. The Deployment Path is appended to that path.
For instance:
Data.fs path :: /path/to/your/instance/var/Data.fs
Static Site path :: /path/to/your/instance/var/static
The Deployment URL defines the base url for the static site. You will need to configure Apache accordingly. This value is utilized in the document filters, which rewrite relative and absolute paths appropriately.
Base Files are typically resources that are acquired by acquisition in Plone. These resources are written to the root of your static site deployment, and referenced accordingly. You may add and remove Base Files as needed.
CSS Images are images utilized in customized themes. These images are written to the deployment path of the CSS resources on the filesystem. If you are utilizing anything but a custom logo, you must add the files to the CSS Images field.
By default, only content in the published state is deployed to the filesystem. If your instance utilizes other states that are visible to the public, you may add that state to the Add States field.
Static site deploys a version to the filesystem that is purely .html driven. Therefore, certain sections and actions that are driven by dynamic functionality must be removed from each deployed page.
Many portlets rely on dynamic content/interactivity. Static site will extract portlets defined below.
Additional Views can be defined for:
For views that are not based on HTML, you may define them as Non HTML Views. This will allow XML and other non-html views to be deployed properly.
If you do choose to add additional views, you will likely need to extend the functionality of the utility to account for these views. You may do this by customizing the default code, or overwriting the utility in a separate product:
<utility provides="enpraxis.staticsite.utilities.interfaces.IStaticSiteUtility" factory=".utilities.staticsiteutility.eduStaticSiteUtility" />
The filtering mechanism utilizes BeautifulSoup to parse the HTML of each static object. Typically, additionally filters will be added to runDocumentFilters to account for additional/custom views. For example, the Add-on product PloneBookmarklets renders links that must be dealt with differently than other document actions:
class eduStaticSiteUtility(StaticSiteUtility): """ Deploy a static site """ implements(IStaticSiteUtility) def runDocumentFilters(self, portal, current, soup, ssprops): self.filterBaseTag(soup, current) ... ... self.filterBookmarkletsLinks(soup, current, portal, ssprops) ... ... ... def filterBookmarkletsLinks(self, soup, current, portal, ssprops): bookmarks = soup.find('span', id="toggledBookmarks") if bookmarks: links = bookmarks.findAll('a') for link in links: href = link['href'] parts = href.split('=') index = 0 for part in parts: if portal.portal_url() in part: url_parts = part.split('&') if len(url_parts) > 0: if '.htm' not in current: current += '.html' url_parts[0] = current newurl = '&'.join(url_parts) else: newurl = current parts[index] = newurl index += 1 newurl = '='.join(parts) newurl = newurl.replace(portal.portal_url(), ssprops.getProperty('deployment_url')) link['href'] = newurl
To deploy a static version of your plone instance, navigate to the deploy action in the upper right hand corner.
Press the Deploy Site button to being the process of generating a static site. Be patient, as this may take quite some time for large instances.