Added %%site_title%% template keyword.
authorAaron Taylor <ataylor@subgeniuskitty.com>
Sun, 7 Jan 2018 02:38:03 +0000 (18:38 -0800)
committerAaron Taylor <ataylor@subgeniuskitty.com>
Sun, 7 Jan 2018 02:38:03 +0000 (18:38 -0800)
bin/cmless.py
bin/config.py
bin/template.py

index ddba963..6663cdc 100755 (executable)
@@ -13,8 +13,9 @@ def main():
     print("Content-Type: text/html;charset=utf-8\n")
 
     content = misc.load_file(config.site_template_prefix + "/" + config.template_file)
     print("Content-Type: text/html;charset=utf-8\n")
 
     content = misc.load_file(config.site_template_prefix + "/" + config.template_file)
-    content = template.tpl_title(content)
-    content = template.tpl_body(content)
+    content = template.page_title(content)
+    content = template.site_title(content)
+    content = template.body(content)
     print(content)
 
 if __name__ == "__main__":
     print(content)
 
 if __name__ == "__main__":
index 6d9e90b..5ee585f 100644 (file)
@@ -1,6 +1,13 @@
 # (c) 2017 Aaron Taylor <ataylor at subgeniuskitty dot com>
 # See LICENSE file for copyright and license details.
 
 # (c) 2017 Aaron Taylor <ataylor at subgeniuskitty dot com>
 # See LICENSE file for copyright and license details.
 
+#####
+# Site Configuration Options
+#####
+
+# Site name. For example, "Microsoft" or "Bob's Hardware".
+site_name = "Site Name"
+
 #####
 # CMless Configuration Options
 #####
 #####
 # CMless Configuration Options
 #####
index c5b1d19..f27f493 100644 (file)
@@ -7,12 +7,18 @@ import os
 # CMless imports
 import config, misc
 
 # CMless imports
 import config, misc
 
-def tpl_title(template):
+def page_title(template):
     keyword = "page_title"
     return template.replace(config.template_delimiter + keyword +
     keyword = "page_title"
     return template.replace(config.template_delimiter + keyword +
-            config.template_delimiter, os.environ['REQUEST_URI'])
+            config.template_delimiter, config.site_name + " - " +
+            os.environ['REQUEST_URI'])
 
 
-def tpl_body(template):
+def site_title(template):
+    keyword = "site_title"
+    return template.replace(config.template_delimiter + keyword +
+            config.template_delimiter, config.site_name)
+
+def body(template):
     keyword = "page_content"
     body = misc.load_file(config.site_data_prefix + os.environ['REQUEST_URI'] +
             config.markup_file_extension)
     keyword = "page_content"
     body = misc.load_file(config.site_data_prefix + os.environ['REQUEST_URI'] +
             config.markup_file_extension)