SiteData

A SiteData object is passed into each template, so the template author can use its attributes to display content, giving access to the entire site content and config, regardless of which page is currently being written.

For example, within a post template, you could use the following code to display a list of recent posts in the sidebar:

<aside>
    <h2>Recent Posts</h2>
    <ul>
        <li tal:repeat="post site.posts[:10]"><a href="${post.link}">${post.title}</a></li>
    </ul>
</aside>
class beemo.site_data.SiteData

A collection of site data to be passed to templates during rendering

property config: BuildConfig

The build configuration parsed from config.yml, as a BuildConfig object. Contains all settings defined by the user.

property homepage: HomePage

The homepage parsed from the “home” directory in pages_dir. This is a HomePage object containing all metadata from meta.yml, the HTML content, and any images.

property pages: list[Page]

A list of all pages found in pages_dir, excluding the homepage. Each item is a Page object containing all metadata from meta.yml, the HTML content, and any images.

property posts: list[Post]

A list of all posts found in posts_dir. Each item is a Post object containing all metadata from meta.yml, the HTML content, and any images.

property archive: dict[int, list[Post]]

A dict mapping year to a list of posts published in that year. Each post is a Post object containing all metadata from meta.yml, the HTML content, and any images.

property tags: dict[str, list[Post]]

A dict mapping tag name to list of posts with that tag. Tags are normalized to lowercase and spaces are replaced with dashes. The dict is sorted by number of posts (descending) and then alphabetically. Each post is a Post object containing all metadata from meta.yml, the HTML content, and any images.

property now: datetime

The datetime when the build process started, in UTC. Useful for displaying “last updated” timestamps or calculating “time since published” for posts.