Dynamically generate a sitemap.txt when the sitemap page is requested
This commit is contained in:
parent
842dc4e0cb
commit
692f272645
1 changed files with 13 additions and 6 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
<h1>Site map</h1>
|
<h1>Site map</h1>
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
p=`{pwd}
|
||||||
|
tmpfile=$p/tmp/sitemap_$pid.txt
|
||||||
saveddf = $dirfilter
|
saveddf = $dirfilter
|
||||||
|
|
||||||
fn getMdDesc {
|
fn getMdDesc {
|
||||||
|
|
@ -17,9 +18,11 @@ fn listDir {
|
||||||
|
|
||||||
echo '<ul>'
|
echo '<ul>'
|
||||||
|
|
||||||
if (! ~ $#blogDirs 0 || ~ $1 blog Blog )
|
# Don't hide blog dirs for now
|
||||||
echo ''
|
#if (! ~ $#blogDirs 0 || ~ $1 */blog */Blog )
|
||||||
if not {
|
# echo ''
|
||||||
|
#if not
|
||||||
|
{
|
||||||
|
|
||||||
for ( i in `{ ls -d $d/*/ $d/*.md $d/*.html $d/*.txt >[2]/dev/null |sed $dirfilter^'/index$/d;' } ) {
|
for ( i in `{ ls -d $d/*/ $d/*.md $d/*.html $d/*.txt >[2]/dev/null |sed $dirfilter^'/index$/d;' } ) {
|
||||||
desc = ''
|
desc = ''
|
||||||
|
|
@ -38,7 +41,8 @@ fn listDir {
|
||||||
if (! ~ $desc '')
|
if (! ~ $desc '')
|
||||||
desc = ' - '$"desc
|
desc = ' - '$"desc
|
||||||
tit = `{basename $i|sed 's/_/ /g'}
|
tit = `{basename $i|sed 's/_/ /g'}
|
||||||
echo '<li><a style="text-transform: capitalize" href="'$i'">'^$"tit^'</a>' $desc '</li>'
|
echo '<li><a style="text-transform: capitalize" href="/'$i'">'^$"tit^'</a>' $desc '</li>'
|
||||||
|
echo $baseuri^$i >> $tmpfile
|
||||||
if (test -d $i)
|
if (test -d $i)
|
||||||
@{ listDir $i }
|
@{ listDir $i }
|
||||||
}
|
}
|
||||||
|
|
@ -49,4 +53,7 @@ fn listDir {
|
||||||
cd $sitedir
|
cd $sitedir
|
||||||
listDir .
|
listDir .
|
||||||
|
|
||||||
|
cp $tmpfile ./sitemap.txt
|
||||||
|
rm $tmpfile
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue