Crates.io | statical |
lib.rs | statical |
version | 0.2.0 |
source | src |
created_at | 2022-05-26 04:30:00.396711 |
updated_at | 2024-01-03 03:17:14.786692 |
description | A calendar aggregator and generator to make maintaining calendars on static websites easier. |
homepage | https://github.com/egrieco/statical |
repository | https://github.com/egrieco/statical |
max_upload_size | |
id | 593931 |
size | 262,523 |
A calendar aggregator and generator to make maintaining calendars on static websites easier.
While there is no shortage of calendaring services available, they all have drawbacks:
None of the available options met my needs so I decided to build my own. This project was also excellent motivation and practice for Rust software development.
This program is now mostly usable for basic calendar generation functionality. It is thus now in the Beta stage of development and with a little more work can hit the version 1.0 milestone.
The documentation needs to be completed as well as adding a setup guide. The code is nearing general usability, but may still require a bit of tinkering and digging.
To make configuration easier, statical can now generate an example config file with the --generate-default-config
flag.
The default templates are starting to look acceptable and we are planning a final design pass shortly. While the templates and CSS are fully customizable, the goal is for the defaults to produce a calendar with good user experience, interface and aesthetics. There is still a bit of work to be done here.
*.ics
files or live calendar feeds
Statical is built with three types of users in mind:
Statical should be easy enough for someone with basic CLI knowledge to install it, modify the default configuration, and have calendars that look good in minutes.
For those who want more control of the calendars generated:
If complete control is desired, this code is released under the BSD 3 clause license.
Statical is intended to be used in a "Static Site Generator chain" (credit to CloudCannon for the term). Statical should run before tools like Pagefind and Jampack as its output pages will need to be indexed and optimized.
An example chain might look like the following:
Statical must have a config file is order to run. Create the example config file with the command:
statical --create-default-config
Edit the config file as necessary with your favorite text editor. Only the keys below are strictly necessary:
display_timezone
: One of the TZ identifiers from the IANA Time Zone Databasedefault_calendar_view
: one of Month, Week, Day, or Agendacalendar_sources
Multiple sources can be provided.
name
: must be kebab-casesource
: can be the URL of a calendar feed or a local *.ics
fileThe rest have default values that should work for most users. There are comments in the generated config file explaining the purpose of each option.
Statical needs to be run every time there are changes to the calendar. This can be done manually or via cron job, Git hook or CI pipeline.
Statical will look in the current directory for its config file named statical.toml
. Alternately, you can specify one or more config files as arguments to statical e.g.:
statical site-one/statical.toml site-two/statical.toml ...
Default assets and templates are built into statical, but can be overridden by the user if desired.
If you would like to customize the CSS run:
statical --restore-missing-assets
The assets directory will be created at the location specified in the configuration file (paths are relative to the config file itself). The default is assets
.
Any missing asset files will be re-created from those built-in to statical. Assets can be edited as desired, or deleted to return to the built-in defaults. If an asset is already present with the same name as one of the defaults, it will not be overwritten.
To customize the views themselves run:
statical --restore-missing-templates
The templates directory will be created at the location specified in the configuration file (paths are relative to the config file itself). The default is templates
.
Any missing template files will be re-created from those built-in to statical. Templates can be edited as desired, or deleted to return to the built-in defaults. If a template is already present with the same name as one of the defaults, it will not be overwritten.
Statical uses Tera templates to allow customization of calendar views. For detailed information about Tera its capabilities see the Tera Documentation.
To see what data is available for use within a given template, add the following code somewhere in your template:
<pre>
{{ __tera_context }}
</pre>
If statical does not do exactly what you need, check out these projects instead.
The below got rather large and probably needs to be cleaned up and reorganized. We'll leave it here for now, but it will likely be split out into a separate doc later.
statical.toml
file in the current dir--restore-missing-assets
optionstatical.css
head
section