{"id":32,"date":"2011-02-07T21:05:15","date_gmt":"2011-02-08T02:05:15","guid":{"rendered":"\/blog\/?p=32"},"modified":"2011-02-27T04:07:00","modified_gmt":"2011-02-27T09:07:00","slug":"automatic-menu-generation-for-my-web-site","status":"publish","type":"post","link":"https:\/\/www.rfdm.com\/blog\/?p=32","title":{"rendered":"Automatic menu generation for my web site"},"content":{"rendered":"<p>It&#8217;s tedious to need to update the menu on each of my web pages when I add new children of a page, new siblings of a page, or move a page or directory.  Especially since I keep my content organized via the underlying filesystem; why should I have to do more than that to get a menu that shows child directories, siblings and ancestors?  I shouldn&#8217;t.  One could argue that the easiest way to achieve what I want is to not have any index files, but that&#8217;d be quite ugly.<\/p>\n<p>I&#8217;ve instead written a CGI program in C++ that will automatically add a &#8216;Genealogy&#8217; menu to a page&#8217;s side menu.  Within the &#8216;Genealogy&#8217; menu are submenus: &#8216;Children&#8217;, &#8216;Siblings&#8217; and &#8216;Ancestors&#8217;.  I call the CGI from the RenderHeader() member of my PageStart PHP class to add to the side menu.  Simple, always works.  The only downside is that it&#8217;s a little slow since it accesses the Xapian backend to get page titles to use in the menu.  I can live with it for now.  I may later write the menus to files in batch mode and remove the CGI.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s tedious to need to update the menu on each of my web pages when I add new children of a page, new siblings of a page, or move a page or directory. Especially since I keep my content organized via the underlying filesystem; why should I have to do more than that to get &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.rfdm.com\/blog\/?p=32\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Automatic menu generation for my web site&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,13],"tags":[23,17,36,35,34,14],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-software-development","category-web-development","tag-c","tag-cgi","tag-genealogy","tag-menu","tag-php","tag-xapian"],"_links":{"self":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=32"}],"version-history":[{"count":6,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}