Don't execute perm_redirects directly from conf_perm_redirect to avoid tripping over sitemaps and other code that sources config files but doesn't want to actually *do* anything. Also hide paths with simple or pattern redirects from sitemaps.

This commit is contained in:
Uriel 2009-02-14 07:09:27 +00:00
parent af66a69dd9
commit 7ba725cf92
3 changed files with 20 additions and 14 deletions

View file

@ -81,6 +81,8 @@ fn werc_exec_request {
} }
cd $werc_root cd $werc_root
if(~ $#perm_redir_to 1)
perm_redirect $perm_redir_to
f=();t=() f=();t=()
for(i in $perm_redir_patterns) { for(i in $perm_redir_patterns) {
if(~ $#f 0) if(~ $#f 0)

View file

@ -1,9 +1,11 @@
# To be used from config files # To be used from config files
fn conf_perm_redirect { fn conf_perm_redirect {
if(~ $#* 1) if(~ $#* 1)
perm_redirect $1 perm_redir_to=$1
if not if not {
perm_redir_patterns=($perm_redir_patterns $1 $2) perm_redir_patterns=($perm_redir_patterns $1 $2)
conf_hide_paths $1 # XXX Will hide paths even if replacement string is the same as matched sctring.
}
} }
fn conf_hide_paths { fn conf_hide_paths {

View file

@ -39,6 +39,7 @@ fn listDir {
if(test -f $d/_werc/config) if(test -f $d/_werc/config)
. ./$d/_werc/config . ./$d/_werc/config
if(~ $#perm_redir_to 0) {
echo '<ul class="sitemap-list">' echo '<ul class="sitemap-list">'
for(i in `{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}) { for(i in `{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}) {
@ -54,6 +55,7 @@ fn listDir {
} }
echo '</ul>' echo '</ul>'
} }
}
fltr_cache listDir $sitedir/ fltr_cache listDir $sitedir/