Download the PHP package la-haute-societe/craft-page-exporter without Composer
On this page you can find all versions of the php package la-haute-societe/craft-page-exporter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download la-haute-societe/craft-page-exporter
More information about la-haute-societe/craft-page-exporter
Files in la-haute-societe/craft-page-exporter
Package craft-page-exporter
Short Description Export Craft CMS entries to a zip archive containing a static HTML files and its assets
License proprietary
Informations about the package craft-page-exporter
Craft Page Exporter
This plugin allows you to export entries in ZIP format from the control panel. The resulting archive contains a static HTML rendering of the entry along with its images, videos, scripts and styles.
Example of resulting archive: `
Requirements
This plugin requires Craft CMS 3.0.0-RC1 or later.
Installation
You can install this plugin from the Plugin Store or with Composer.
From the Plugin Store
Go to the Plugin Store in your project’s Control Panel and search for “Page exporter”. Then click on the “Install” button in its modal window.
With Composer
Open your terminal and run the following commands:
`
Usage
Select one or more entries from admin/entries
, then select Export
from the
context menu.
You can also export a single entry from its edit page.
Configuration
You can configure the plugin's behavior from the plugin settings page.
Or, for more options, from the configuration file
config/craft-page-exporter.php
.
Example of (simple) configuration file : ``
Configuration settings
The configuration file can contain the following settings:
inlineStyles
Default: true
Whether external stylesheets must be inlined in the main HTML page inside a
style
tag.
If true
, external stylesheets content will be moved inside a <style>
tags.
If false
, external stylesheets will be left in external files.
inlineScripts
Default: true
Whether external scripts must be inlined in the main HTML page inside a script
tag.
If true
, external scripts content will be moved inside a <script>
tags.
If false
, external scripts will be left in external files.
exportPathFormat
Default: {dirname}/{basename}
Format of the asset path in the ZIP archive. This path is relative to the root of the archive.
It's possible:
- to keep the structure of the original folders:
{dirname}/{basename}
- to put all assets in a single folder:
media/{filename}{extension}
In that case it's recommended to add a hash in the file name to avoid any filename collision:media/{filename}-{hash}{extension}
The following variables are available:
Variables | Values |
---|---|
{filename} |
filename |
{extension} |
.png (the dot is already contains in the value) |
{basename} |
filename.png |
{dirname} |
/path/to/folder |
{hash} |
c023d66f (hash of the file content) |
{year} |
date('Y') |
{month} |
date('m') |
{day} |
date('d') |
{hour} |
date('H') |
{minute} |
date('i') |
{second} |
date('s') |
You can also use any Twig expression like:
`
which will create this path:
\my-folder\2019-05\1\8\18f4a488\MY-IMAGE.png
exportUrlFormat
Default: {dirname}/{basename}
Format of the asset URL in the ZIP archive.
In most cases, this path should correspond to the exportPathFormat
setting.
This parameter accepts the same variables as exportPathFormat
.
If you plan to place your assets on a CDN for example, you can specify an absolute URL : `
archiveFilename
Default: export
Filename of the ZIP archive.
assetTransformers
Default: []
Collection of transformers that can be used to modify the content or path of assets.
For example, to add a comment at the beginning of an HTML file:
``
If you modify content of child assets you should call the method
$asset->updateInitiatorContent()
after updating the asset in order to forward
the update to his parent.
customSelectors
Child assets are found thanks to XPath expressions.
If you want to add asset to the ZIP archive with custom XPath, for something like:
`
you can add selectors like that:
``
selectors
: collection of XPath expressionassetClass
: one of the followingAsset
class:ImageAsset
: external image(s) URLInlineStyleAsset
: inline stylesheetStyleAsset
: external stylesheet URLScriptAsset
: external script URLMiscAsset
: any type of external asset URL (video, audio...)
sourcePathTransformer
Default: null
Function used to transform the absolute url of assets to file path.
If not set, paths are defined like that:
``
By default, if asset file is not found, its content will be empty. No error is displayed.
entryContentExtractor
Default: null
If not set, the content of entries is generated with th Craft method
Controller::renderTemplate()
.
You can define a custom callback function which return HTML content from entry:
``
failOnFileNotFound
Default: false
If true
an exception will be thrown if an asset file is not found.
Otherwise, no error is displayed and an empty file will be created in the
archive.
Register assets explicitly
If some assets cannot be targeted by an XPath expression, for example if you need to generate a JSON containing URLs, you can explicitly register assets from the twig template:
`
Licensing
This plugin is free to try in development environments, but requires payment to be used in production environments. The license fee for this plugin is $29 (license + one year of updates) via the Craft Plugin Store, then $5 per year for updates (optional).
All versions of craft-page-exporter with dependencies
ext-json Version *
ext-zip Version *
craftcms/cms Version ^4.0.0
symfony/dom-crawler Version ^3.3.0
nystudio107/craft-plugin-vite Version ^4.0.0
php Version ^8.0.2