Widgets
Time
Render a <time>
containing:
text
<span>
with relative time- temporal classes accordingly:
past
,future
,today
,tomorrow
- add readable date as title
{% include widgets/time.html datetime=site.time %}
Includes
datetime
: reference instant, default tosite.time
text
: text before relative time, optionalduration
: repeating event, ISO-8601 duration (P)eriod string, optional
/^P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/
repetition
: number of repetitions of the duration period, optionalstyle
: can benarrow
orshort
, default tolong
{% include widgets/time.html datetime='2025-01-07T08:00:00' duration='P2W' text='Blue' %}
Rolls
Compute a dice roll from a string (rolls)d(sides)(+/-modifier)
.
Expose the liquid array rolls_rolls
of the rolls.
Changes with site build.
{% include widgets/rolls.html roll='1d6' mod=0 %}
include.roll
: Roll string default to1d6
include.mod
: modifier default to 0
- Default rolls 5, array [5]
View
Render data files or liquid objects.
csv
,json
oryml
: data filename, no extensionliquid
: liquid objecttitle
: optional, heading text, default tocategory
or filenameclass
: optional, space separated class list for the element
{% include widgets/view.html csv='csv' sort='desc' %}
{% include widgets/view.html liquid=page.list %}
{% include widgets/view.html json='json' %}
{% include widgets/view.html yml='yml' %}
Options for csv
limit
: hide extra rows if data-limit attribute is set, negative limit show table bottom rowscategory
: filter rows given a string for thecategory
propertysort
: optional, can beasc
ordesc
to sort the first column numeric values
default state isunsorted
Csv table
<table class='...' data-sort='...' data-limit='...'>
<tr data-row='1'>
<td data-header='...' data-value='...'>
<!-- if header is `date` or `unix` -->
<time datetime='date_to_rcf822'>ISO 8601 </time>
...
Styles
td[data-value='briefing']{color:var(--color-green)}
td[data-value='bill']{color:var(--color-orange)}
td[data-value='trash']{color:var(--fg-muted)}
Progress
Render a progress bar.
max
: Max value, default to 100value
: Value to be filled, default to 50class
: Space separated classnamesinfo/success/warning/error
Toc
Add a table-of-content excluding the preceding heading.
{% include widgets/toc.html %}
Form
Render a functional form from a yml
object in the page front matter
{% include widgets/form.html form=page.form %}
include.form
: yml form, front-matter or data file
Form properties
file:
fields.jsontimestamp
:file
orfolder
user
: trueclass
: space separated listfields
:type
: text, hidden, email, textarea, number, boolean, color, date, datetime, select, select multiple, radio, ref, random, roll (csv)options
: required, disabled, placeholder
Form bottom contains a message box for the future
<div data-input="message" role='status'></div>
{% include widgets/form.html form=site.data.form %}
Input
Render a form to create or edit a data file, or perform automatic functions.
Fields and destination are passed with a data file or in the front matter.
include.class
: class added to output element.include.form
: front-matter or data file, default topage.form
.{% include widgets/input.html form=page.form %}
include.function
: javascript function.{% include widgets/input.html function='a/b=c/d' %}
Forms schema
file_name
:file_extension
:file_path
:file_overwrite
:file_append
:
Aside
page.aside: true
will append an <aside>
element to <main>
with existing front-matter
variables.
page.author
page.date
page.category
page.categories
page.tag
page.tags
Pagination
page.pagination: true
will append a div.pagination[aria-label='Pagination']
to <main>
with the links to the previous and next collections’s document.