dokufreaks/plugin-blog

Avoid empty title / ugly pagename

Opened this issue · 3 comments

It would be nice if blog__newentry_title gets the html attribute required="required" - maybe as an option?!

Yes, that makes sense, though I'm wondering if then it shouldn't also be checked in the PHP code. I'm a bit reluctant to add more configuration options so I would probably make this default. I'm only wondering one thing: if people are using this to simply create pages that are just named after the current date by using the date prefix configuration option which would mean that an empty title is okay.

I think it would be ok to use the html-attribute only.
An option is a must in my opinion. I recognized that if you use a namesspace e.g. ymd with a trailing ":", the page gets the name "start" automatically. I think, there may be a usage, where an empty title is ok. But if you use e.g. ymt_ as prefix, an empty title results in an ugly pagename. The template may fit with the title, too.
So i would be glad to force the user to use a title.

This is a quite important change imo, because users entering an empty title will create blog/start.txt, which is not shown in the blog list. So, a possibly long text appears to be lost, when in fact it's just in the start page of the blog.

I have added required="yes" to the input file. Now, if the input field is empty, a popup will flash up.

syntax/blog.php
205 DOKU_TAB.DOKU_TAB.'<input class="edit" type="text" name="title" id="blog__n ↪ewentry_title" size="40" tabindex="1" required="yes"/>'.DOKU_LF.