Gollum Tricks
August 23, 2015I recently started using Gollum again for note-taking and figured I’d share some of the customizations I’m using with setup.
Generate a List of All Pages
The last time I used Gollum, I manually maintained a table of contents for my entire wiki on my Home
page. It turns out, since then, a macro has been created to generate this automatically. You can use this snippet in any file and a list of all the files in your wiki will be rendered in its place:
<<GlobalTOC()>>
If you want to customize this, you can take a look at the macro implementation and modify it as necessary.
Add Table of Contents to Every Page
Instead of manually adding the [[_TOC_]]
tag to the top of every page, you can have the table of contents for a page automatically added to the top or sidebar of every page by creating a file named _Header.md
(or other file extension) or _Sidebar.md
(if you want the table of contents as a sidebar) and add [[_TOC_]]
to it. Commit the new file to git, refresh the page, and you should have table of contents on every page.
HTTP Basic Authentication
There’s a gist that adds HTTP basic auth to Gollum. Note that this requires you to run Gollum with Rack. Alternatively, you could put Gollum behind nginx or Apache and add authentication there.
Custom CSS and JavaScript
This is a pretty well known and well documented feature, but you can create custom.css
and custom.js
in your repository root and launch Gollum with the --css
and --js
flags respectively and have custom CSS/JS injected into every page of your wiki.
Fix List Margins
For some reason, the default styles for Gollum put huge margins before and after lists. This CSS fixes that and makes them look more normal:
.markdown-body ul, .markdown-body ol {
margin-top: 0;
margin-bottom: 0;
}
Comments