A GitHub action for generating a static site from a Roam Graph.
Required Your Roam username
Required Your Roam password
Required Your Roam Graph
uses: dvargas92495/[email protected]
with:
roam_username: [email protected]
roam_password: ${{ secrets.ROAM_PASSWORD }}
roam_graph: dvargas92495
Most other configuration happens from your Roam DB, on a page called roam/js/public-garden
. The following configuration options are supported:
- Index - The page name that will serve as the entry point of the site. Could be raw text or a page link.
- Filter - A set of rules that specifies which pages to build. If a page matches any child rule, it will be built into the site. The following rules are supported:
- Starts With - If a page starts with the given text, it will be included in the site. Useful for namespacing, e.g.
Article/Article
. - Tagged With - If a page contains a tag with the given text, it will be included in the site. Includes pages with any form of tags or attributes. Could be raw text or a page link.
- Starts With - If a page starts with the given text, it will be included in the site. Useful for namespacing, e.g.
- Template - An HTML Code block that will be used as the template for every generated HTML file.
- It supports a few variables that can be interpolated:
PAGE_NAME
- The name of the pagePAGE_CONTENT
- The content of the page
- The default template looks like
- It supports a few variables that can be interpolated:
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>${PAGE_NAME}</title>
</head>
<body>
<div id="content">
${PAGE_CONTENT}
</div>
</body>
</html>
Here's an example configuration, that uses the Personal Website
page as the entry point and includes all pages that start with a P
:
- Index
- Personal Website
- Filter
- Starts With
- P
- Starts With
Here's an example configuration, that uses the Blog Post
page as the entry point and includes all pages that are Tagged with Blog Post
:
- Index
- Blog Post
- Filter
- Tagged With
- Blog Post
- Tagged With
You could ignore specific blocks in pages that are included. Nest everything that you would like to keep on the page but have filtered out of the static site under a block that just says [[roam/js/public-garden/ignore]]
.
I have an example repository showcasing this action. The resulting site is reachable at https://garden.davidvargas.me.