The whole world of 'tilde' accounts is to give you a little server space where you can monkey around in bash and maybe build a website the 1990s way -- by editing HTML in nano, emacs or vim. At least, so I believe.
I have set it up so that if I scp files into the right directory, they will be automatically added to the index.html.
Consider the following bash script. I log into my account and run it from ~/public_html using nohup so that it does not stop when I log out. The makelinks.sh script lives in the ~/public_html/pages directory and just creates a block of HTML with links to each of the HTML files it finds in there.
The script then creates a little file with the time and date updated information in it, then cats all the bits together, then sleeps for a day and runs again. My scripting is very crude, but seems to work.
while true do cd pages ./makelinks.sh cd .. echo \<p\> \</p\> > date echo \<p\> \</p\> >> date echo Last updated: `date` >> date cat index.top.html pages/index.middle.html date index.tail.html > index.html rm date sleep 24h done
Here is the text of makelinks.sh. It loops over all the .html files in the directory. The echo command prints out a line of the form of a basic HTML link. It grabs the second line of the html file for use as the link text (that is what the head/tail bit does) then creates the link.
rm index.middle.html for f in *.html do echo \<p\>\<a href=\"pages/$f\"\>$(head -2 $f | tail -1)\</a\>\</p\> >> index.middle.html done
The output of makelinks.sh looks something like
$ cat pages/index.middle.html <p><a href="pages/hermes10.html">The Hermes 10 electric typewriter</a></p>
So all I have to do is make sure I upload an HTML file (with its dependencies) that looks something like the one below. Top 3 lines are:
After that, any legit HTML should do.
<!-- Link text - always here. --> <html><head> <title>Title</title> </head> <center> <h1>Main heading</h1> </center> Content </body></html>
So I make up my new page locally, with the correct 3-line header, then scp it to the correct folder, and the script wakes up once a day and adds the page to the index.
Crude, but effective. Obviously, I can complexify what I do and add more features, but I'll let that evolve with time.