you could try this: (if you have changed to using state tiddlers)
<$button>
<$list filter="[prefix[$:/state/section-editor/foldstate/changelog/]]">
<$action-setfield text="closed"/>
</$list>
button to set foldstate tiddlers for changelog to closed
</$button>
but only works if the state tiddler already exists, i.e. the section has been closed at least once
<$button>
<$list filter="[prefix[$:/state/section-editor/foldstate/]]">
<$action-setfield text="closed"/>
</$list>
button to set foldstate tiddlers for all tiddlers to closed
</$button>
but only works if the state tiddler already exists, i.e. the section has been closed at least once
code for use in a tiddler tagged with $:/tags/StartupAction
(see https://tiddlywiki.com/#StartupActions for others) that will run when the tiddlywiki is started; but only works if the state tiddler already exists, i.e. the section has been closed at least once:
<$list filter="[prefix[$:/state/section-editor/foldstate/]]">
<$action-setfield text="closed"/>
</$list>
NB this closes all the state tiddlers, even ones you might want left open.
it’s probably possible to add exceptions in the filter e.g. tag a particular foldstate tiddler and filter excluding that tag. though not very practical if you edit your tiddlers often, as the state tiddlers are actually not for particular sections, they are for the sections-in-the-order-in-the-tiddler i.e. if you insert a section between 1 and 2, the new 1.5 section “takes” the state tiddler of the old 2.