When you extend a BlogPostPage
you get support for a static blog post page.
For a Bootstrap-themed blogpost page extend HepekBootstrap5BlogPage
.
You can override def blogSettings
method with following fields:
Name | Mandatory | Type | Default value | Description |
---|---|---|---|---|
author | No | Option[String] | None | Author of this post |
createDate | No | Option[LocalDate] | None | Date when this post was written |
sections | No | List[Section] | List.empty | Sections of this post |
dateFormat | No | DateTimeFormatter | dd.MM.yyyy | Sections of this post |
Instead of overriding pageContent
, here you specify withSections
on blogSettings
.
A blog post is made of sections, so you can render a nice TOC, sitemap.xml, or even a PDF...
Section
s are tree-like, they can contain other sections.
Every section has a name, content, and optionally child sections.
Code usually looks like this:
package files
object ExampleBlogPost extends MyBlogPostPage {
override def blogSettings = super.blogSettings
.withCreateDate(LocalDate.of(2018, 9, 5))
.withSections(firstSection)
val firstSection = Section(
"Hello world!",
p("Welcome to my blog!"),
List( // child sections, optional
Section(
"..."
)
)
)
}
You can even get a link to a section!
ExampleBlogPost.firstSection.ref
would return "example-blog-post.html#hello-world"