by Mountaineerbr

#5 - Using Poor Man's Web Master Tools


Falando um pouco da descoberta das ferramentes em shell do site Poor Man's Web Master Tools e como isso me aliviou e me motivou a tentar escrever uns scripts para gerenciar a área do blog..

IMPORTANTE: parece que o site do PMWMT está fora do ar?? Espero que não tenha parado de vez (dead link?).. Se o link não voltar, ainda bem que há uma cópia na Wayback machine.


Searching for personal website tips or something, I found some really interesting stuff. For example, this website talks about website cracking and hackery in general, which I found very amusing..

Anyways, it seems that indeed a webmaster needs to deal with some data base and layout management. He could avoid them by using Jekyll or WordPress, or if he knows some programming, he can try and manage his website all by himself. Reading Jekyll documentation, it seems to deal with three types of web pages:

I reckon that for unrelated and individual pages, it is a plus if we can craft them manually. There are so many structural HTML tags which can be used that I doubt Jekyll can apply half of them from a marked down text.. That seems incompatible: either use a mark up or a mark down language.
Such intricate structures can one make with HTML tagging, although much is condemned to null or discreet rendering by web browsers at this present time..

About the second bullet point, the blog portal and individual post management can be a hassle. It is easy if you just write in a single page, which gets ever longer. However, if you want to point to individual posts only, then you should also have got individual pages for them.
Jekyll (and other static webpage generators) uses a lot of databases, and that is not the easiest to familiarise with its defaults structures, although I am sure you can customise almost everything..

At this point, I was almost overwhelmed and giving up on trying to create my own tools for the job of managing a post database.. Most surprisingly, I found the Poor Man's Web Master Tools (PMWMT) and some silly scripts for maintaining a static website. Do note the referred scripts are shell scripts. I was most delighted! IMPORTANT: It seems the website for PMWMT is down, hopefully that is temporary.. If the link does not come online again, we still have got a copy from Wayback machine.

Much refreshed and elated, I got to work on my previous shell script, which dealt only badly with concatenating all blog post into a single page.
Some template files were created. One holds most of HEAD and HEADER contents while the other most of the BODY and FOOTER contents.
Now, article text is written in HTML but are written in individual files and only contains some metatags in a HEAD section and a ARTICLE section, which are then merged with the templates to generate a complete individual page for the post.
Finally, a function that merges all article sections of individual posts into a long page with all posts. There is a hard corner which is to fix all locally relative resource dirpaths in src tags, for example for images or gifs. Here, I had to think long and hard and created another directory at the root of the blog directory called res/ for resources, as it cannot be called gfx for graphics because I will be linking txt plain text, as well. When all resources moved there, I was able to use sed to remove '../' references in these fields..

The third bullet of the list above seems irrelevant as a worry now. Either we can specially craft individual webpages or use the same blog system for an eventual collection of related pages..

There are still some improvements or features to implement for my own use, that is a way to automatically update the website portal blog post section and the blog portal with latest post titles.. That should not be too hard to do with some shell scripting and sed..
You can check a script snapshot in this link. I will be improving that over time, but I provide it here just so as a reference of what can be done for the reader.

Although I am not currently using PMWMT's code (I am writing my own), reading those scripts are a blow of fresh air.. When I next write a script for generating a sitemap.xml file, I may use some of PMWMT code, though..

There may be a vague resemblance of functionality with Luke Smith's lb and sup, a blog script and site updater he wrote for his own blog. However, he does not seem to care about adding metatags to blog posts, such as keywords.. Other blogs could use their post categories as keyword metatags..

Just for the record, there are two more scripts o deal with website or blogging. The first one is Roman Zolotarev's ss5, which is a static site generator written in shell. There is also Slackjeff's hacktuite, a shell script that makes a static microblog.

[Company Logo]
Fig 1. Logo from the Silly Software company, provider of PMWMT and other interesting software.

PS: package tree can also make a directory (and file) listing in HTML with option -H. One can use flag -P to search for filetypes and flag -I to ignore some files. It must be run at the root directory of the website. Example:


$ tree -H "https://mountaineerbr.github.io" \
	-P '*.htm|*.html|*.php|*.asp|*.aspx|*.jsp' \
	-L 6 -F -o "tree.html" -v --noreport --charset utf-8 \
	-I '[a-z].html|index.html|fool.html|bak|css|gfx|js|res|misc|google*|PMWMT'