aboutsummaryrefslogtreecommitdiff
path: root/src/content/blog/Blog.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/blog/Blog.hpp')
-rw-r--r--src/content/blog/Blog.hpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/content/blog/Blog.hpp b/src/content/blog/Blog.hpp
index 970c7fd..a0e35b1 100644
--- a/src/content/blog/Blog.hpp
+++ b/src/content/blog/Blog.hpp
@@ -1,10 +1,30 @@
#ifndef BLOG_H
#define BLOG_H 1
+#include <inja/inja.hpp>
+
#include "../../Content.hpp"
#include "../../Filesystem.hpp"
#include "../markdown/Markdown.hpp"
+struct blog_entry
+{
+ explicit blog_entry(std::string const & metadata_filename, std::string const & content_filename)
+ : metadata_filename(metadata_filename), content_filename(content_filename)
+ {
+ }
+
+ std::string const metadata_filename;
+ std::string const content_filename;
+ std::time_t createDate;
+ std::time_t publishDate;
+ bool published;
+};
+
+using BlogMetadata = inja::json;
+using BlogEntry = std::shared_ptr<struct blog_entry>;
+using BlogEntries = std::vector<BlogEntry>;
+
class Blog : public Content
{
public:
@@ -18,13 +38,17 @@ public:
std::string const & GetMainTemplate() const;
Redirections const & GetRedirections() const;
+ static bool ValidateAndSetMetdadata(BlogMetadata const & blogMetadata, BlogEntry & blogEntry);
+ bool ValidateEntries() const;
+ void GenerateBlogListing(RenderData & rd) const;
+
private:
std::string m_UriBasePath;
std::string m_MainTemplatePath;
std::string m_BlogPath;
Redirections m_Redirections;
- Filesystem m_BlogEntriesMetadata;
- Markdown m_BlogEntries;
+ Markdown m_BlogContents;
+ BlogEntries m_BlogEntriesSortedByDate;
};
#endif