We have seen how to set some attributes to a card using the +++
separator. But let's face it : it can be a bit annoying to define the same type = movie
over and over again (imagine you have 200 movies...).
Apart from just wasting time defining the same property indefinitely is that we can easily mistype it, and worst: we may need to rename it... once again, imagine renaming 200 cards type from type = WIP
to type = project
...
This is why we introduced the __config
card. The __config
card (note the 2 underscores) must sit in the special __root
list.
__config
will allow two things: - add global properties for the whole site - set default properties to other cards
Nothing to be scared of, just understand that: whatever you put into the __config
card works exactly like other card, the only thing is that conceptually, the content of __config
is for the whole site and not for one specific page. That's it.
So this is where will go things like logo
, menus
, social icons
etc... For example:
[[ menu.item ]]
text = Home
link = /
[[ menu.item ]]
text = Blog
link = /blog
[[ menu.item ]]
text = About
link = /about
+++++++
Looks scary at first sight, but this is just describing a menu with 3 items, each defining a link and its text. If you are not familiar with this way of describing data, this is TOML: have a look at it here, it is quite simple.
IMPORTANT POINT : this is like a classic card, DO NOT FORGET THE +++
at the end, otherwise Troglio will interpret it as the body of a page...
In addition to classic card properties/metadata, two properties are introduced for this special card: cards
and list
.
These properties are extremely powerful: cards
will take any classic card parameters and propagate them to each cards.
So let's take an example. If we define __config
in a list named __root
with this config:
[ cards ]
type = post
+++
it means that from now on, all cards will see their type
defined as post
. One can always override this default property by setting the type
in the card directly.
This is handy if most cards should be of type = post
except one or two exceptions, and will prevent repeating the same property in each and every cards...
The list
property acts exactly the same as cards
, but targeting all cards in a specific list
!
[ list.posts ]
type = post
+++
here we define that all cards in the Trello list named posts
should now take the property type
set to post
. Isn't that cool ?
You can define as many list settings as you wish, like:
[ cards ]
type = page
permalink = /:list/:title
[ list.posts ]
type = post
[ list.projects ]
type = project
[ list.others ]
permalink = /:title
+++
Ok let's see what's going on here. First, cards
defines that all cards in the board should get a type
of page
and an URL of the form /:list/:title
(see permalinks docs). Right after, list
defines that all cards in the lists posts
and projects
should get types of respectively post
and project
. Finally, all cards in the list others
already have their type of page
inherited from the first cards
property but we want their URL to look like /:title
.
And here is how you get superpowers ! But more seriously, it allows to forget about some settings within a card: once it is defined here, you just write content and critical properties will follow.