#include "biawebutil.hpp"
#include "biawebdoclist.hpp"
#include "biawebtemplate.hpp"
+#include "biawebrss.hpp"
// class to implement a document tree - both with or without subtrees
namespace biaweb {
item1.set_item_url (this->stub_hierarchy() + "index.html");
bar1.get()->add_sidebar_item (item1);
}
- index.get()->add_side_bar (*bar1.get());
-
+
// create a sidebar for the child levels if there are children
std::unique_ptr<SideBar> bar2 (new SideBar ());
bar2.get()->set_title (tpl->get_stringbit (SUB_CAT) + this->title);
tree.stub + "/" + "index.html");
bar2.get()->add_sidebar_item (item);
}
- index.get()->add_side_bar (*bar2.get());
// create the path and then the index file
std::filesystem::create_directories (filepath);
par1 = par1->parent;
}
+ // rss feed
+ std::unique_ptr<RSSFeed> feed (new RSSFeed ());
+ feed.get()->set_pub_date (index.get()->get_creation_date());
+
+ // iterate through the documents and generate the document
for (Document doc : this->docs) {
+ // Add the document to RSS feed
+ RSSFeedItem fitem (doc.get_title(), doc.get_meta_desc (),
+ urlpath + doc.get_filename() + ".html",
+ doc.get_creation_date());
+ // If the items don't exceed max size of RSS feed
+ if (feed.get()->get_num_items() <= MAX_RSS_FEED)
+ feed.get()->add_rss_item (fitem);
+ // Add the document to the document list
DocListItem item (doc.get_title(),
urlpath + doc.get_filename() + ".html",
doc.get_creation_date(), doc.get_modified_date (),
doc.output_to_html (tpl, filepath);
}
+ // output the rss feed
+ feed.get()->output_to_html (tpl, filepath);
+
+ // add the side bars
+ index.get()->add_side_bar (*bar1.get());
+ index.get()->add_side_bar (*bar2.get());
+
+ // sidebar for RSS feed
+ // if there are are items in the feed add the link
+ if (feed.get()->get_num_items () > 0) {
+ std::unique_ptr<SideBar> bar3 (new SideBar ());
+ bar3.get()->set_title (tpl->get_stringbit (SUBSCRIBE));
+ bar3.get()->add_sidebar_item (
+ GenericLinkItem (tpl->get_stringbit(RSS_FEED), urlpath + "/feed.xml"));
+ index.get()->add_side_bar (*bar3.get());
+ }
+
// add the navigation bit
index.get()->set_navigation_bit (*navbit.get());
// index should contain the summary followed by the article list