Pyblosxom sorted tag cloud patch
Posted Sun, 08 Apr 2007
However, the default tag cloud isn't sorted, so finding things in it is, well, hard.
Here is a patch that will sort your tag cloud alphabetically.
However, the default tag cloud isn't sorted, so finding things in it is, well, hard.
Here is a patch that will sort your tag cloud alphabetically.
REJECT: Comment attempt by 210.113.83.6 rejected. Reason: Invalid secret token: 'pleaseDontSpam' REJECT: Comment attempt by 210.120.79.179 rejected. Reason: Invalid secret token: 'pleaseDontSpam' REJECT: Comment attempt by 200.156.25.4 rejected. Reason: Invalid secret token: 'pleaseDontSpam' REJECT: Comment attempt by 220.125.164.243 rejected. Reason: Invalid secret token: 'pleaseDontSpam' REJECT: Comment attempt by 69.57.136.39 rejected. Reason: Invalid secret token: 'pleaseDontSpam' ...The list goes on. Well over 50 invalid tokens were found. The 'pleaseDontSpam' was the original secret token I used. Just goes to show that, for the moment, most spam bots don't review the page before submitting.
Admittedly, 2 spams got through, I have not investigated why, yet.
I'm bored of deleting comments by hand. So, I wrote a little antispam plugin. This plugin creates a token that expires after a given period of time. This token is used as a hidden item in the comment form. If this token is expired when the form is submitted, the comment is rejected.
Spam seems to come entirely from solo-connection POST requests. This means that the bots don't bother viewing the page first. In theory, the bots will be using a cached idea of the form, which will be expired. We'll see how well this works.
Right now it just uses a timestamp. If that fails, I'll add other tokens such as source IP, etc. Perhaps cookies too? This should be simple to filter out, becuase the spam bots don't act anything like humans with regards to browsing behavior.
I have enabled the plugin on this site. I'll post the source when I see it actually working correctly.
Waiting for spam bots to come by is boring :(
I wrote a very short plugin to do just that. Turns out the plugin api for pyblosxom is quite easy to understand, and this hack was only about 10 lines.
pagetitle.py adds a new variable which will contain the standard page title, unless there is only one entry in view. If there is only one entry in view, the page title is augmented with the story title aswell. This makes search engine results and browsers happier, as they can recognize what your page is about by the title. User experience good, also good for search engines.
The new variable you want to use is: $blog_title_or_entry_title
If you want to get a better idea of what this plugin does, you can click the permalink below to view only this entry. The page title (in the url bar) should now reflect this entry's title.
If you use pyblosxom 1.3.x, plugin updates are ready for your use.
On that note, comment functionality is FINALLY here on this site. To those of you reading this site, feel free to comment! I love feedback.
Those entries should now be good now with fixed links, etc. Ahh, sweet productivity.
My "vim scripting"-fu is not strong, so there's probably a cleaner/fancier way to do this. Anyhoo, you'll need the following in your .vimrc:
" PyBlosxom stuff
augroup pyblosxom
autocmd BufReadPost /home/jls/public_html/entries/*/*.txt call Pyblosxom_checkdate()
autocmd BufNewFile /home/jls/public_html/entries/*/*.txt call Pyblosxom_putdate()
autocmd BufWritePost /home/jls/public_html/entries/*/*.txt call Pyblosxom_fudgedate()
augroup end
function Pyblosxom_checkdate()
" Look in the file for '#mdate foo' metadata
normal 1G
let dateline = search("^#mdate")
" If not found, append the mdate of the file to line 2
if dateline < 1
let dateline = 1
let date = system("stat -f '#mdate %Sm' " . expand("%"))
" Add the date to the file on line 1
1put=date
endif
endfunction
function Pyblosxom_putdate()
let date=strftime("#mdate %b %e %H:%M:%S %Y")
1put=date
goto 1
endfunction
function Pyblosxom_fudgedate()
let l=search("^#mdate")
let l=strpart(getline(l), 7)
let cmd="date -j -f '%b %e %H:%M:%S %Y' '" . l . "' +%y%m%d%H%M"
let touchtime=system(cmd)
let touchcmd="touch -t '" . strpart(touchtime,0,strlen(touchtime)-1) . "' '" . expand("%") . "'"
call system(touchcmd)
e
endfunction
There's still lots to do: