- Suppport newer docutils
- Updated bundled jquery assets
- New
default-b5template using Bootstrap 5
- Updated bundled jquery assets
- Made default theme extensible (#64)
- Implemented
-V/--version(#62) - Implemented
ignore: [patterns]in.staticsiteto set patterns for filenames to ignore (#63)
- Add a marker file in built directories to make staticsite skip them if found inside contents. (#60)
- Removed a premature optimization that caused issues when processing assets (#60)
- Prune empty leaf nodes from loaded contents, to avoid generating empty directory indices for empty directories, directories that are skipped, or directories that only contain drafts (#60)
- Fixed autoreload in
ssite serveandssite show
- Fixed using
datetime_format()with noformatargument - Updated reference documentation
- staticsite can now detect changes since the last build and only rebuild the pages that changed! (#1)
- New template filter
next_monththat given a date returns the date of the beginning of the following month - Code has been thoroughly cleaned up, and is almost mypy clean
- Breaking changes:
- All templates:
url_forin templates now requiresstatic=Trueto refer to static assets, whose location may change based onsettings.STATIC_PATH. Default templates have been fixed accordingly - Alias pages: alias handling has been refactored, and they are now rendered
as first-class pages. In its template, what was
{{url_for(page)}}to refer to the defining page, now needs to be{{url_for(page.meta.page)}}. Therender.htmltemplate has been changed accordingly. - link page templates:
page.linksbecomespage.link_collection.data-links.htmlhas been changed accordingly. - dir page templates:
site_pathhas disappeared from page metadata. Basename is now accessible aspage.node.namedir.htmlhas been changed accordingly. - All templates:
category_page.series_info()is nowcategory_page.series_info.lib/blog.htmlhas been changed accordingly. - The feature plugin system has been significantly redesigned. Get in touch if you have custom plugins, and I can help with porting
autogenerated_pagessequencing step for features is not needed anymore, and has been removedsyndicated_pagesjinja2 macro no longer accepts a list of Page objects as argument. I'm not aware that this was ever used
- All templates:
- Deal gracefully with broken symlinks (#55)
- Open links from link collections in new tabs
- Use topological sorting from python's stdlib if available (#56)
- Fixed
titleandparentmetadata of dir pages to match documentation (#56) - Fixed missing
page.meta.site_namewhen evaluatingtemplate_titleandtemplate_description(#51) - Fixed broken
page.namereferences in example site (#50) - Added a title to archive pages in the default theme (#50)
- Documented that taxonomy archive pages are created using the syndication feature (#50)
- Forward port to Jinja3. Thanks Tobias Gruetzmacher
- Work with newer python3-markdown, Thanks @donkult (#58)
- Fixed filesystem-dependent test failure (#54)
- Force escape HTML content in syndication feeds, to fix displaying contents in some feed readers
- Added links feature
- Fixed issue #49: "Inline image links in syndication feeds are relative to the wrong page"
ssite editcan now filter by taxonomies- Fixed generation of "continue reading" links in markdown inline pages
- Fixed use of markdown archetypes
- New images support (see #39, #46)
- Use a horizontal rule with 3 or more underscores to introduce a introduction/rest of the post split in markdown pages
- New
copyrightandtemplate_copyrightmetadata - Added
ssite shellto play with the builtSiteobject for a site - Added nav metadata to add pages to the top navbar
pagesheader can now be just a string, defaulting to filtering bypath. (#34)syndicationcan betrueto turn on syndication with default settingssyndication.add_to, if omitted, defaults to adding syndication links to all the pages in the syndication. It can befalseto disable adding syndication links to syndicated pages.syndication.pagesandsyndicaton.filterare now removed: usepagesto select which pages are syndicated- markdown pages can now use markdown code blocks as front matter delimiters, making markdown pages with front matter valid markdown pages.
site_pathmetadata is now normalized to be absolute. The site path for the root page is now/instead of the empty string, and all page site paths now begin with/.build_pathis still without leading slashes.- Page lookup by
url_for(),page_for(),site_pages()in themes, and front matter headers likepagesorsyndication.add_to, is now relative to the current page, unless an absolute path is used. - Implemented
Page.find_pages, so in templates you can usepage.find_pagesinstead ofsite_pages site_pages()does not sort by reverse date by default anymore.template_copyrightdefaults to"© {{page.meta.date.year}} {{page.meta.author}}"authordefaults to the current user's name- syndicaton archive pages are now autogenerated
- New
page.meta.relatedmetadata - Feed links are now created based on
page.meta.related.rss_feedandpage.meta.related.atom_feed - Taxonomy now reuses blog and archive templates by default
ssite buildnow warns of broken internal links- Added tutorials and HOWTOs on making a blog (#36)
- Use
content:prefix for template names to distinguish templates in content directory from templates in theme directories. The content directory is no longer in the template search path by default. - Added a link to the archive at the bottom of blog posts in default
lib/blog.html
- Use
pagesinstead ofsyndication.pagesorsyndication.filter - If you looked up pages by site path, they are now absolute paths, instead of
paths relative to
/ - If you looked up pages relative to pages up the parent chain of the current page, that does not work anymore. Use paths to source files instead, which don't change according to how the site is laid out.
- If you looked up pages by relative paths assuming they were anchored on the site root, that does not work anymore: use absolute paths instead.
- If you relied on
site_pagesdefault sorting order, add asort="-date"to yoursite_pagesinvocations - You can remove manually created archive pages now, and use the autogenerated ones
- Feed links are now created based on
page.meta.related.rss_feedandpage.meta.related.atom_feed: you may need to update your templates if they still looked forpage.meta.syndication.rss_pageandpage.meta.syndication.atom_page - The default template for taxonomy pages is now
taxonomy.htmlinstead oftaxonomy/taxonomy.html - The default template for taxonomy categories is now
blog.htmlinstead oftaxonomy/category.html - The default template for taxonomy category archives is now
archive.htmlinstead oftaxonomy/archive.html - Use
content:prefix for template names to load templates from the content directory: the content directory is no longer in the template search path by default.
- New page metadata:
author,site_name,site_url, andsite_root. - The contents of a
.staticsitefile can also now be loaded from theindex.html/index.md/index.rstfile in the directory, if present. This is now the recommended way to set directory metadata - If no title is set in the front matter of a jinja2 template page, it defaults
to the rendered
{% block title %} site_name, if not set, defaults to the title of the toplevel index page, if present.taxonomyfiles do not need to be listed inTAXONOMIESsettings anymore:TAXONOMIESis now ignored in settings.- Restructured theme directory organization. See Upgrade notes for details.
- Set
site_pathin a directory metadata to choose where that directory appears in the target site. This replacessettings.SITE_ROOT, which now acts as a defaultsite_pathfor the toplevel directory. - Added
THEME_PATHSsettings, as a sequence of paths where themes are looked up THEME, if set to a string, it represent a name of a theme to be looked up underTHEME_PATHS- Themes are now installed in
/usr/share/staticsite/themes, making it possible to make multiple themes available system-wide for use - Themes can now inherit from other themes. See theme documentation for details
- Added
page_for()function to templates - Renamed
syndication.filtertosyndication.pages(see syndication. For backwards compatibility,syndication.filterstill works as an alias forsyndication.pages. - Added
syndicated_pagesfunction to templates. See syndication documentation. - Added
syndicatedmetadata to allow excluding pages from syndication. - Added
syndication_datemetadata to allow to control when a page gets syndicated. - jinja2 pages are now
indexedby default. - jinja2 and data pages can now render inline as part of a blog. By default,
their
page_contentblock is rendered, or thecontentblock ifpage_contentdoes not exist. - data feature: use
data_typeinstead oftype. Any page metadata with adata_typevalue will be tracked as data. - Moved reference documentation to
doc/reference - Make build destination of theme static assets configurable via
STATIC_PATHsetting
- If you used
SITE_NAMEorsite.site_name, usepage.meta.site_nameinstead blog.htmlis now inlib/blog.htmlin default theme, to make space for the introduction of a default blog page template.tags.htmlis nowtaxonomy/taxonomy.htmltag.htmlis nowtaxonomy/category.htmltag-archive.htmlis nowtaxonomy/archive.htmlurl_fornow always needs to accesspagefrom the current template context. If you are importing template libraries likelib/blog.html, import themwith contextso they can accesspage.
- Since jinja2 pages are now
indexedby default, they may accidentally appear in blogs and syndication. You can use thesyndicatedheader to prevent them from being added. You can also applysyndicated: noto multiple pages using thefiles:matching patterns in a directory index page. - In data pages, use
data_typeinstead oftype.
- RestructuredText Feature, see <doc/reference/rst.rst>, thanks to @valholl.
- Taxonomies:
- Renamed
tagsfeature totaxonomy - Taxonomies now need to be explicitly listed in settings as a
TAXONOMIESlist of taxonomy names. staticsite prints a warning if a.taxonomyfile is found that is not listed inTAXONOMIES. - You can use
tags: tagnameas short fortags: [tagname]if you only have one tag - Significantly reengineered 'taxonomy' feature.
- Taxonomy pages are now ordered by ascending dates. You need to reverse
them in templates (you can use the
|reversejinja2 filter) if you want them sorted as newest first. - Series are now generated from any category:
series_tagsis now ignored. - Removed
seriesfeature, merged intotaxonomy
- Renamed
- Page metadata:
descriptioncan now be used for page metadata.template_titleandtemplate_description, if present whiletitleanddescriptionare not, are rendered with jinja2. See [doc/reference/metadata.md] for details.templatemetadata can be used to choose a custom template to render the page, similar to Jekill's layouts.indexed(true or false) is used to tell if a page appears in a directory index and in page filter results.
- Themes:
- Vendorized assets in
theme/static/are now read by asset library name, as ifstatic/were the same as/usr/share/javascript/. Now you need to refer to/jquery/jquery.min.jsand/bootstrap4/css/bootstrap.min.cssinstead ofjquery.min.jsandcss/bootstrap.min.css. - If a
configfile exists in the theme directory, it is loaded as yaml/json/toml (same as a page front matter) and used as theme configuration static_assetsin theme configuration can be used to load assets from/usr/share/javascript- Turned
inline_pages.htmltemplate into ablog.htmlmacro library for blogs and category pages.
- Vendorized assets in
- Jinja2 pages
- New setting
JINJA2_PAGES: now*.htmlpages are considered jinja2 templates by default. - Renamed
j2feature tojinja2
- New setting
- Content loading
- A
.staticsitefile in a content directory is read as directory metadata, and can be used to provide metadata to.j2.htmlpages. See <doc/reference/contents.md> for details. - Static assets loaded by the theme have been moved to
static/in the rendered site, to avoid cluttering the rest of the contents. Referring to them inurl_forin templates has not changed. - Set
assetto true for a file in.staticsitedirectory metadata, to force loading it as a static asset. - Allow marking entire subdirectories as assets in directory metadata.
- Try harder to localize timestamps as the configured site TIMEZONE.
- A
- Added a
ssite showcommand to open a directory in a browser without loading possibly unsafe settings. - When run without a
settings.py, take more defaults from repo mode. This makes running staticfile or arbitrary directories quite useful, and similar to viewing a repository on GitLab/GitHub. - Improved logging in case of jinja2 errors. Use --debug to see a full stacktrace.
- Instantiate Feature classes in dependency order: this allows a feature constructor to register hooks with another one.
- Added syndication feature (see <doc/reference/syndication.md>) to simplify generation of RSS and Atom feeds
- Added
ssite dump_metato page information as available to templates - One can now match pages by regexp and not just by glob. See <doc/reference/page-filter.md>.
- Cleaned up reference documentation.
- Allow selecting a language code for rendering. See
LANGUAGESin settings. - Added
BUILD_COMMANDsetting. - Removed compatibility
Feature.load_dirmethod. The oldtry_load_pagemethod is no longer supported. Now a feature that does not load files does not waste time during content loading. - New
pagesfeature that allows defining a page filter in apagesmetadata element, and then setpage.meta.pagesto a list of the matching pages. This can be used to simplify templates, so that with only one page filter one can control both the syndication and the page listing aspect of a blog page. - New
arrange()template filter to do efficient sorted sampling from a list of pages. ssite edit: when paginating results, an empty input goes to the next page- cleanup and documented directory index feature
page.meta.aliasis honored for all page typespage.meta.templateis honored for all page types- Started developers documentation
- Started usage HOWTO documentation
- Switch to jinja2 sandboxed environment
by default. Site settings can turn it off, which is ok
because
settings.pyis a point where arbitrary code can be injected. This means that you now only have to secure access tosettings.py, and can be a bit more free with allowing others to participate in the site development. Also, you need to usessite show, and notssite serve, to preview potentially untrusted sites:ssite showwill not load asettings.py.
- If you use taxonomies, explicitly list them in the new
TAXONOMIESsetting. item_namein a.taxonomyfile does not have a special meaning anymore, and templates can still find it in the taxonomy page metadataoutput_dirin a.taxonomyfile is now ignored, and the taxonomy pages will be in a directory with the same name as the file, without extensiontags.html,tag.html, andtag-archive.htmltemplates need updating: see the versions inexample/themefor an updated exampleseries_tagsis now ignored- The
seriesfeature is merged intotags: add aseriestaxonomy to keep using theseriesmetadata in pages - You may need to update the series rendering part of your templates: see
the series documentation and the
page.htmlexample template for details and an example. - In templates, use
page.meta.pagesinstead ofpage.pages
PROJECT_ROOTsetting now defaults toNoneinstead of., and if None will be filled using the directory where the settings file is found, or the current directory otherwise. The resulting behaviour should be in practice very similar to the previous.setting.TIMEZONEsetting now defaults to the system or user timezone instead ofUTCCONTENTsetting now defaults toPROJECT_ROOTinstead ofcontent. Set it tocontentexplicitly if you depend on the previous valueOUTPUTsetting now defaults toNoneinstead ofweb, andssite buildwill ask you to set it or provide a--outputoption. Set it towebexplicitly if you depend on the previous valueSITE_NAMEsetting now defaults toNoneinstead ofSite name not set, and will be filled with the title of the toplevel index page, or the basename of the toplevel content directory if the toplevel index page has not title set or is autogenerated.
- Running
ssite serveon a random repository cloned off the internet can expose you to arbitrary code execution if the project includes a.staticsite.pysettings file: usessite showinstead. Usessite servefor authoring your own websites, whose settings you control.
.htmlfiles are now parsed as jinja2 templates by default. If you have bundles of HTML in your site content that you'd like copied as-is, you can mark them as 'asset' in.staticsitedirectory metadata.
tag/archive.htmlis nowtag/archive- Static assets loaded by themes are now moved into a
static/directory in the rendered website.url_forgenerates the right links for them, but if one had hardcoded links to them in the site, or external sites linked to the site static assets, those links may end up broken
- Where you used
page.pages, now usepage.meta.pages - Where you used
contentsfor rendered page contents, now you usepage.contents - Data pages now honor the
page.meta.templatemetadata, and are rendered directly by that template, with using one template for contents and one for the page layout. If you use data pages, change yourdata-$TYPE.htmltemplates to extendpage.htmland render into thepage_contentblock.
- Documented and consolidated the Features feature
- Reuse existing static content in destination directory to speed up rendering
- Allow invoking feature-specific code from the command line
(
ssite site --cmd …)
- Refactored codebase to introduce the concept of pluggable Features. Most
staticsite features are now implemented as pluggable features, and new
features can be provided with python modules placed in the
$THEMEDIR/features/directory - Implemented data pages, as yaml, toml, or json, that provide pure datasets.
data-$type.htmljinja2 templates can be used to render their contents. - Speed up site rebuilds by caching intermediate markdown contents
Upgrade notes:
- To prevent the creation of a cache directory in your
PROJECT_ROOT, set the newCACHE_REBUILDSsetting toFalse.
- Allow filtering by taxonomies in
site_pages() - New settings
SYSTEM_ASSETSto list directories in/usr/share/javascriptto include to site assets - Generate unique IDs in footnotes by default. Thanks DonKult!
- Implement rendering raw JSON, YAML, or TOML data files
- Fixed markdown syntax for link targets in
example/archetypes/links.md
- Pages with dates in the future are considered drafts not yet to be published. Added option --draft to include them in the rendering.
- Added
{{next_month}}to the template variables. - Default editor configuration appends a
+to the command line to open the file with the cursor at the end. - If the archetype does not need a title or a slug, the
-targument tossite serveis optional and no title will be asked interactively. - Documented how to use staticsite to blog a monthly collection of links.
- Allow pointing to .py configuration instead of project on command line. This means you can potentially have a farm of .py site descriptions pointing at various other directories in the file system.
- archetypes and output directory configurable in
settings.py. See settings.md for details. - Added
--theme,--content,--archetypesand--outputto command line to override the corresponding settings. - Fixed a bug in taxonomy generation
- Configurable site layout, using
CONTENTandTHEMEinsettings.py. See the settings reference for details. - The example
settings.pyhas been updated to usecontentfor site contents, like Hugo does. - Directory indices: if in your contents you have
dir/foo.mdwithoutdir/index.mdor `dir/index.j2.html", then a directory index for dir will be generated automatically, showing links to all site pages in that directory. - Documentation has been expanded and split into separate files under
doc/ - New template function
taxonomies()that returns a list of taxonomies. See templates.md. - New template filter
|basenamethat returns the basename of a path. See templates.md.