Stats
This plugin provides various statistical data that PicoSSG collected while processing the files.
Since you include it in the preprocess()
it can only gather the data provided until that step of the process,
which means it does not know anything about processing time or final file size, but it can (and does) provide
the last-modified timestamps across all content files and the last modified filename. It does also provide
the prettyUrlPath
as known at this point in time, if you change it later it does not know that.
In your content/_config.js
file include stats like this:
import {addStatsProperty} from "https://cdn.jsdelivr.net/npm/@wolframkriesing/picossg/src/plugins/stats.min.js";
// for a local picossg you can use this instead
// import {addStatsProperty} from "picossg/plugins/stats.js";
const preprocess = async (files, config) => {
addStatsProperty(files);
}
this will provide a _stats
inside the templates, so you can use them in a file.html.njk
like this:
_stats.lastModified
Last modification in this project was: {{ _stats.lastModified.dateISO }}
The properties and their values for the docs look like this:
Key | Value |
---|---|
_stats.lastModified.filename |
index.html.njk |
_stats.lastModified.dateISO |
2025-06-10T10:32:25.484Z |
_stats.lastModified.prettyUrlPath |
/ |
The data above were generated by iterating over all properties of _stats.lastModified
like so:
{% for key, value in _stats.lastModified %}
_stats.lastModified.{{ key }} {{ value }}
{% endfor %}
_stats.files
Key | Value |
---|---|
_stats.files.numFiles |
26 |
_stats.files.numFilesWithFrontmatter |
0 |
_stats.files.numFilesNeedProcessing |
16 |
_stats.files.numExtensions |
{".html.md":13,".png":3,".webp":3,".html.md.njk":2,".css":3,".jpeg":1,".html.njk":1} |