-
Hello, I am currently porting my blog over to statiq using statiq web. So far so good. I have a theme going on and it's working great. I have a layout page. The problem I'm trying to solve it my blog posts on my old site display the post title and date above the content on the post page and I can't find a way to override the theme for the post page to add them in. Is there a best practise for this? I don't really want to add in a separate layout for each blog. Any help appreciated! Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I think I understand the question (though let me know if I'm way off base). The thing to keep in mind when Statiq is rendering a page is that all the metadata for that document is available to the layout. That means we can insert some custom stuff into common layout elements, and have it change content based on the currently rendering page. The themes (or really just theme since there's only one official one at the moment) lean into this even more and have overridable partials that can further be customized. Let's see if I can't get you up and running - a couple questions:
|
Beta Was this translation helpful? Give feedback.
-
Hi @daveaglick, thank you for your response. I had a play around with this after I wrote the question and managed to find a solution. But to first answer your question: It's a custom theme based off of CleanBlog I forgot to mention I was porting a Jekyll blog. And actually through these solutions I've managed to replicate the url layout for posts and the blog page titles. You wouldn't know the difference. In my custom theme I have a layout. My solution was to add a new layout in input called _postlayout. I then added a _directory.yml file in input/posts which then specified the layout as _postlayout. In _postlayout I was able to get access to @Document.GetTitle(), GetDate() and @RenderBody with all of these things I'm able to present a blog post displaying its title, date and content which solves my problem. I like Statiq now I see how it works and the problems it can solve. And I'd also prefer to use something in the .net ecosystem rather than ruby. There were not any "recipes" online that I could see that I thought could help me so I might end up writing some help posts about this and hopefully helping others on the repo. Thanks! |
Beta Was this translation helpful? Give feedback.
Hi @daveaglick, thank you for your response. I had a play around with this after I wrote the question and managed to find a solution. But to first answer your question: It's a custom theme based off of CleanBlog
I forgot to mention I was porting a Jekyll blog. And actually through these solutions I've managed to replicate the url layout for posts and the blog page titles. You wouldn't know the difference.
In my custom theme I have a layout. My solution was to add a new layout in input called _postlayout. I then added a _directory.yml file in input/posts which then specified the layout as _postlayout.
In _postlayout I was able to get access to @Document.GetTitle(), GetDate() and @RenderBod…