A Pelican plugin to add meta-data to generated HTML pages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.0 KiB

5 years ago
#Page Meta-Data
4 years ago
A Pelican plugin to add the total page size to each generated page of your site.
5 years ago
4 years ago
It calculates the weight of the HTML page including all image media and returns that in a human readable format (B, KB, MB).
5 years ago
4 years ago
## Caveats:
it currently is tailored to https://solar.lowtechmagazine.com and needs work in the following areas:
* add options to show file name and generation time
* properly handle subsites plugin (currently it only works for dither+subsites)
* make sure it works with --relative-urls flag
* handle static assets
4 years ago
## Use:
4 years ago
To enable the plugin add it to the `PLUGINS` list in `pelicanconf.py`.
4 years ago
Add a div with id `page-size` to your template and `page_metadata` will place the result there.
have fun!
5 years ago
4 years ago
## in case we add generation time:
To use this plugin first import `strftime` at the top of `pelicanconf.py`:
`from time import strftime`
Then add `NOW = strftime('%c')` somewhere in that document as well. This saves the time of generation as a variable that is usable by the `page_metadata` plugin.