When showing a _header.md file for a dir listing, try to extract the page title from it. - swerc - anselm's simpler werc fork
(HTM) git clone git://git.suckless.org/swerc
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 27fa736f9668a2bdec9218ab1cfeb65df2f9fae7
(DIR) parent 99d619bf5926006ab78f021656ecc166582eaf6e
(HTM) Author: Uriel <u@berlinblue.org>
Date: Mon, 21 Jun 2010 23:41:18 +0000
When showing a _header.md file for a dir listing, try to extract the page title from it.
Diffstat:
M bin/corehandlers.rc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/bin/corehandlers.rc b/bin/corehandlers.rc
@@ -121,8 +121,13 @@ fn setup_handlers {
# Dir listing
if not if(~ $local_path */index) {
handler_body_main=(dir_listing_handler $req_path)
- if(test -f $sitedir$req_path'_header.md')
- ll_add handlers_body_head md_handler $sitedir$req_path'_header.md'
+ if(test -f $sitedir$req_path'_header.md') {
+ t=`{get_file_title $sitedir$req_path'_header.md'}
+ if(! ~ $"t '')
+ pageTitle=$t
+
+ ll_add handlers_body_head md_handler $sitedir$req_path'_header.md'
+ }
if(test -f $sitedir$req_path'_footer.md')
ll_add handlers_body_foot md_handler $sitedir$req_path'_footer.md'
}