blogging support

3 views
Skip to first unread message

Tim Pease

unread,
Mar 28, 2008, 1:24:22 AM3/28/08
to Webby
I've been tinkering around with blogging support in Webby and would
like to solicit a little feedback from you. The principle idea is a
rake task (or tasks) that takes care of the legwork of creating a new
blog post ...

rake blog:post new blog post

results in the following file being created in the content directory

articles/2008/03/27/new-blog-post.text

Along with creating the new page, two other files are created as well

articles/2008/index.txt
articles/2008/03/index.txt

The first is a list of all the posts for the year 2008. The second is
a list of all the posts for March of 2008. All these files are derived
from blog tempates in the templates directory.

templates/blog_post
templates/blog_year
templates/blog_month

The first template is used to create a new post. The second creates
the list of all posts for a given year. And the last creates the list
of all posts for a given month. These last two exist so you can change
how posts are indexed and displayed.

And of course you can create different blog templates by starting the
template name with "blog_". If you wanted to parrot a Tumblr style
blog, you would create templates called blog_text, blog_photo,
blog_quote, blog_link, blog_chat, blog_audio, and blog_video.

The "articles" directory can be changed by setting the "SITE.blog_dir"
in your webby site's Rakefile. Or you can give a directory when
creating a new post ...

rake blog:post some/other/directory/new blog post
> some/other/directory/new-blog-post.txt

Thoughts? Suggestions? Comments?

Blessings,
TwP

Tim Pease

unread,
Mar 28, 2008, 1:29:04 AM3/28/08
to webby...@googlegroups.com
On Mar 27, 2008, at 11:24 PM, Tim Pease wrote:
>
> The "articles" directory can be changed by setting the "SITE.blog_dir"
> in your webby site's Rakefile. Or you can give a directory when
> creating a new post ...
>
> rake blog:post some/other/directory/new blog post
>> some/other/directory/new-blog-post.txt

Too tired to be posting, but just have to fix this typo ...

rake blog:post some/other/directory/new blog post

really will result in this path in the content folder ...

some/other/directory/2008/03/27/new-blog-post.txt


Going to bed now.
TwP

Guillaume Carbonneau

unread,
Mar 28, 2008, 2:52:32 AM3/28/08
to Webby
This is starting to stretch Webby's limits but I would probably use
it.

What I do right now for creating a blog post...
I have a subfolder called posts/ and when I create a post, I simply
type
rake create:page posts/title_of_post.markdown

Then to generate the thing in a file called index.erb...

---
filter: erb
---
<%
posts = @pages.find(:limit => :all, :in_directory =>
"posts", :recursive => true, :sort_by => :created_at, :reverse =>
true)
paginate(posts, 3) do |p|
%>
<h2><%= link_to(p.title, p)%></h2>
<div class="date">posted on <%= p.created_at.strftime("%d %b %Y") %>
at <%= p.created_at.strftime("%H:%M") %></div>
<%= p.render %>
<hr />
<% end %>

<%= link_to("Previous", @pager.prev) if @pager.prev? %>
<%= link_to("Next", @pager.next) if @pager.next? %>

...........

Also, I was planning on adding support for tags in my blog.
I've already tagged my posts but would need a task for seeing posts
related to a tag like say...
tags/ruby, tags/movies, etc.

Could also be incorporated in the blogging support

Kevin Williams

unread,
Mar 28, 2008, 10:22:45 AM3/28/08
to webby...@googlegroups.com
Awesome! I've been wanting to use Webby to create a photo blog. This
will be awesome.

--
Cheers,

Kevin Williams
http://bantamtech.com/
http://almostserio.us/
http://kevwil.com/

Greg

unread,
Mar 29, 2008, 4:13:15 PM3/29/08
to Webby
I am given serious consideration to porting Rassmalog
http://rassmalog.rubyforge.org/output/index.html
to work on top of webby.

Learning from the way Rassmalog does things:
There is not a huge gain in using rake to create a blog post- the rake
build process should automatically create/update the article indices.
Also, forcing the entry into date directories is not necessarily the
best way of creating entries. Just let the user put the articles in
whatever structure they want (usually by subject), but include a date
property in the config field for a blog entry.

There is also a disconnect between naming the directory 'articles' and
naming the tempates 'blog_', but otherwise it is a good idea. It is
probably better to just use a directory prefix like 'templates/
articles'

Greg

Tim Pease

unread,
Apr 4, 2008, 11:49:01 AM4/4/08
to Webby
On Mar 29, 2:13 pm, Greg <webs....@gmail.com> wrote:
> I am given serious consideration to porting Rassmaloghttp://rassmalog.rubyforge.org/output/index.html
> to work on top of webby.
>

Very cool! Looking forward to see what comes of that effort. Patches
and new features are gladly accepted.

> Learning from the way Rassmalog does things:
> There is not a huge gain in using rake to create a blog post- the rake
> build process should automatically create/update the article indices.
> Also, forcing the entry into date directories is not necessarily the
> best way of creating entries. Just let the user put the articles in
> whatever structure they want (usually by subject), but include a date
> property in the config field for a blog entry.
>
> There is also a disconnect between naming the directory 'articles' and
> naming the tempates 'blog_', but otherwise it is a good idea. It is
> probably better to just use a directory prefix like 'templates/
> articles'
>

Thanks for the inputs. I've taken your subdirectory idea and
implemented that. And the default blog folder is now named "blog" to
be consistent with the templates/blog folder.

All the functionality for creating a new blog post resides in a .rake
file. The default is to create date-based folders for posts; however,
this functionality can be tailored by editing the blog.rake file in
the tasks folder. If you want to create posts by increment number,
then you can do that. You just have to edit the rakefile.

<http://pastie.caboo.se/175316>

That link is what the "tasks/blog.rake" file currently looks like.
Please comment / provide feedback if you have any.

Also note that the rakefile above depends on un-released Webby
functionality. So if you plop it into your own site directory, it
won't work for you.

Again, thanks for the ideas!

Blessings,
TwP
Reply all
Reply to author
Forward
0 new messages