Cleanup a bit the code that generates page and blog-post titles.
This commit is contained in:
		
							parent
							
								
									378967b37e
								
							
						
					
					
						commit
						1413b17724
					
				
					 2 changed files with 12 additions and 8 deletions
				
			
		|  | @ -93,7 +93,7 @@ fn sortedBlogPostList { | ||||||
|         ls $*^'/./' | grep '/[0-9]+.*\.md$'| sort -r -t. +1 |         ls $*^'/./' | grep '/[0-9]+.*\.md$'| sort -r -t. +1 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| fn blogTitle { | fn gen_blog_post_title { | ||||||
|     title=`{basename $1 | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' } |     title=`{basename $1 | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' } | ||||||
|     permlink= `{echo $1 | sed 's,^/[a-z/]*www/,/,; s,^sites/[^/]*/*/,/,; s/\.md$//' } |     permlink= `{echo $1 | sed 's,^/[a-z/]*www/,/,; s,^sites/[^/]*/*/,/,; s/\.md$//' } | ||||||
|     du=`{ls -l $1} |     du=`{ls -l $1} | ||||||
|  | @ -154,7 +154,7 @@ fn blog_dir_handler { | ||||||
|         #title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' } |         #title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' } | ||||||
|         #du=`{ls -l $f} |         #du=`{ls -l $f} | ||||||
|         #echo '##' $title '*('By $du(4) Last mod: $du(7 8 9) ')*' |         #echo '##' $title '*('By $du(4) Last mod: $du(7 8 9) ')*' | ||||||
|         blogTitle $f |         gen_blog_post_title $f | ||||||
|         cat $f  |         cat $f  | ||||||
|         echo  |         echo  | ||||||
|     } | $formatter |     } | $formatter | ||||||
|  | @ -162,7 +162,7 @@ fn blog_dir_handler { | ||||||
| 
 | 
 | ||||||
| fn blog_post_handler { | fn blog_post_handler { | ||||||
| 
 | 
 | ||||||
|     blogTitle $1 | $formatter |     gen_blog_post_title $1 | $formatter | ||||||
|     $formatter < $1 |     $formatter < $1 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -238,7 +238,7 @@ headers=inc/headers.tpl | ||||||
| template=_default | template=_default | ||||||
| sidebar=sidebar | sidebar=sidebar | ||||||
| baseuri=http://$site/ | baseuri=http://$site/ | ||||||
| for(i in siteTitle siteSubTitle title extraHeaders) | for(i in siteTitle siteSubTitle pageTitle extraHeaders) | ||||||
|     $i = '' |     $i = '' | ||||||
| 
 | 
 | ||||||
| . etc/initrc | . etc/initrc | ||||||
|  | @ -257,13 +257,12 @@ ifs='/' { | ||||||
| if(! ~ $#debug 0) | if(! ~ $#debug 0) | ||||||
|     dprint '  ' $SERVER_NAME^$REQUEST_URI^' - '^$"HTTP_USER_AGENT |     dprint '  ' $SERVER_NAME^$REQUEST_URI^' - '^$"HTTP_USER_AGENT | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| if (! ~ $args '') { | if (! ~ $args '') { | ||||||
|     if (~ $args($#args) 'index') |     if (~ $args($#args) 'index') | ||||||
|         perm_redirect `{ echo $REQUEST_URI | sed 's,/index$,/,' } |         perm_redirect `{ echo $REQUEST_URI | sed 's,/index$,/,' } | ||||||
|          |          | ||||||
|     #title=$args($#args) |     pageTitle=`{echo $args | sed -e 's/ / - /g' -e 's/_/ /g'} | ||||||
|     title=$args |  | ||||||
|     title=`{echo $title | sed -e 's/ / - /g' -e 's/_/ /g' } |  | ||||||
|     body=$uri |     body=$uri | ||||||
| } | } | ||||||
| if not { | if not { | ||||||
|  | @ -298,6 +297,11 @@ if not if (~ $#redirectPermanent 2 && {echo $SERVER_NAME^$REQUEST_URI|grep -s $r | ||||||
| 	perm_redirect $to | 	perm_redirect $to | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | # Set Page title | ||||||
|  | if(~ $pageTitle '') | ||||||
|  | 	pageTitle=$siteTitle^' '^$siteSubTitle | ||||||
|  | if not | ||||||
|  | 	pageTitle=$"pageTitle^' | '^$"siteTitle^' '^$"siteSubTitle | ||||||
| 
 | 
 | ||||||
| # Template/body selection | # Template/body selection | ||||||
| template=$sitedir/$template.tpl | template=$sitedir/$template.tpl | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ Content-Type: text/html | ||||||
| 
 | 
 | ||||||
| <meta name="verify-v1" content="6zEoK0WMlnLmIS/w7Pnh6+srZECHsvnMGN0kQmowSGk=" /> | <meta name="verify-v1" content="6zEoK0WMlnLmIS/w7Pnh6+srZECHsvnMGN0kQmowSGk=" /> | ||||||
| 
 | 
 | ||||||
|     <title>%($title '|' $siteTitle $siteSubTitle %)</title> |     <title>%($pageTitle%)</title> | ||||||
| 
 | 
 | ||||||
|     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||||||
|     <meta name="author" content="k" /> |     <meta name="author" content="k" /> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Uriel
						Uriel