Categories/tags? #25

Open
girasquid opened this Issue Feb 11, 2010 · 11 comments

Comments

Projects
None yet
8 participants
@girasquid

I'd like to switch a Wordpress blog with about 200 posts to Toto - but in order to do that, I would need to be able to categorize and tag my posts. I'm not a Ruby guy - I've been trying to wrap my head around how to make the chances I'm thinking of, but so far I haven't had any luck.

Are these features planned additions to Toto, or are they outside of Toto's scope?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 11, 2010

You can add post categorization right now with meta inside text files. For example, on my blog (usabilitypost.com) I have a couple of posts categorized as book reviews. I show these posts on a different page of the blog. You can select posts by their meta using Ruby like this:

<% @articles.select {|a| a[:category] == 'book' }[0...10].each do |article| %>
... html here to render book articles ...
<% end %>

Not sure about posts with multiple categories or tags, could probably work something out though. Cloudhead - what do you think?

ghost commented Feb 11, 2010

You can add post categorization right now with meta inside text files. For example, on my blog (usabilitypost.com) I have a couple of posts categorized as book reviews. I show these posts on a different page of the blog. You can select posts by their meta using Ruby like this:

<% @articles.select {|a| a[:category] == 'book' }[0...10].each do |article| %>
... html here to render book articles ...
<% end %>

Not sure about posts with multiple categories or tags, could probably work something out though. Cloudhead - what do you think?

@MikeAbner

This comment has been minimized.

Show comment
Hide comment
@MikeAbner

MikeAbner Feb 13, 2010

This is something I'd like to see as well. Perhaps add it to the header info.

categories: Programming, Book Review, Ruby
tags: Ruby, Rails, Design Patterns in Ruby, etc.

Then have a single page that lists everything that falls within those tags. Could probably re-use the index.rhtml for that by passing in some vars.

This is something I'd like to see as well. Perhaps add it to the header info.

categories: Programming, Book Review, Ruby
tags: Ruby, Rails, Design Patterns in Ruby, etc.

Then have a single page that lists everything that falls within those tags. Could probably re-use the index.rhtml for that by passing in some vars.

@cloudhead

This comment has been minimized.

Show comment
Hide comment
@cloudhead

cloudhead Feb 13, 2010

Owner

Categories are planned — they'll essentially just be folders inside articles/.

Tags can be done as shown above, any metadata you add to the article headers can be accessed in the templates.

Owner

cloudhead commented Feb 13, 2010

Categories are planned — they'll essentially just be folders inside articles/.

Tags can be done as shown above, any metadata you add to the article headers can be accessed in the templates.

@girasquid

This comment has been minimized.

Show comment
Hide comment
@girasquid

girasquid Feb 15, 2010

Awesome, I'll look forward to that.

Awesome, I'll look forward to that.

@jrwest

This comment has been minimized.

Show comment
Hide comment
@jrwest

jrwest Feb 23, 2010

For tags as shown above using metadata is there a way to view articles by tag. Example: I tag two articles with ruby. If I make a template tagged.rhtml file does toto already have support for something like /tagged/ruby or will this try to find pages/tagged/ruby.rhtml? If it doesn't is something like this planned?

jrwest commented Feb 23, 2010

For tags as shown above using metadata is there a way to view articles by tag. Example: I tag two articles with ruby. If I make a template tagged.rhtml file does toto already have support for something like /tagged/ruby or will this try to find pages/tagged/ruby.rhtml? If it doesn't is something like this planned?

@cloudhead

This comment has been minimized.

Show comment
Hide comment
@cloudhead

cloudhead Feb 23, 2010

Owner

For now, you could do that manually, by fetching the articles, and doing a select:
@articles.select {|a| a.tags.include?('ruby') }
It's all cached after the first load, so there isn't really a performance hit.

Owner

cloudhead commented Feb 23, 2010

For now, you could do that manually, by fetching the articles, and doing a select:
@articles.select {|a| a.tags.include?('ruby') }
It's all cached after the first load, so there isn't really a performance hit.

@rb2k

This comment has been minimized.

Show comment
Hide comment
@rb2k

rb2k Jul 3, 2010

I think the main problem is to get the "ruby" tag from e.g. the URL
How would you pass the tag name in a dynamic way to the "tagged.rhtml"?

rb2k commented Jul 3, 2010

I think the main problem is to get the "ruby" tag from e.g. the URL
How would you pass the tag name in a dynamic way to the "tagged.rhtml"?

@5v3n

This comment has been minimized.

Show comment
Hide comment
@5v3n

5v3n Jul 18, 2010

It's still a bit messy, but: http://github.com/5v3n/karakuri adresses this feature, it might come handy to you. To see it in action, have a look at 5v3n.com.

Thanks cloudhead for opening the erb renderer to include the ENV data, that mainly did the trick.

5v3n commented Jul 18, 2010

It's still a bit messy, but: http://github.com/5v3n/karakuri adresses this feature, it might come handy to you. To see it in action, have a look at 5v3n.com.

Thanks cloudhead for opening the erb renderer to include the ENV data, that mainly did the trick.

@ixti

This comment has been minimized.

Show comment
Hide comment
@ixti

ixti Aug 9, 2011

I'm going to implement categories for toto (I have already implemented
tags and now want to have categories as well) here's my ideas about how
it will work (comments are appreciated):

files hierarchy

* file: ./articles/2011-08-01-one.txt
  permalink: /2011-08-01-one
  category: nil

* file: ./articles/abc/2011-08-02-two.txt
  permalink: /abc/2011-08-02-two
  category: abc

* file: ./articles/abc/def/2011-08-03-three.txt
  permalink: /abc/def/2011-08-03-three
  category: abc > def

browse categories

* `/category/abc` - will list articles from `abc` category:
** `./articles/abc/2011-08-02-two.txt`
** `./articles/abc/def/2011-08-03-three.txt`

* `/category/abc/def` - will list articles from `abc > def` category:
** `./articles/abc/def/2011-08-03-three.txt`

@cloudhead, will really appreciate your comments and/or wishes about implementation.

ixti commented Aug 9, 2011

I'm going to implement categories for toto (I have already implemented
tags and now want to have categories as well) here's my ideas about how
it will work (comments are appreciated):

files hierarchy

* file: ./articles/2011-08-01-one.txt
  permalink: /2011-08-01-one
  category: nil

* file: ./articles/abc/2011-08-02-two.txt
  permalink: /abc/2011-08-02-two
  category: abc

* file: ./articles/abc/def/2011-08-03-three.txt
  permalink: /abc/def/2011-08-03-three
  category: abc > def

browse categories

* `/category/abc` - will list articles from `abc` category:
** `./articles/abc/2011-08-02-two.txt`
** `./articles/abc/def/2011-08-03-three.txt`

* `/category/abc/def` - will list articles from `abc > def` category:
** `./articles/abc/def/2011-08-03-three.txt`

@cloudhead, will really appreciate your comments and/or wishes about implementation.

@seanlin

This comment has been minimized.

Show comment
Hide comment
@seanlin

seanlin Aug 14, 2011

@ixti good thing on category...but how about assigning a post to multiple categories?

seanlin commented Aug 14, 2011

@ixti good thing on category...but how about assigning a post to multiple categories?

@ixti

This comment has been minimized.

Show comment
Hide comment
@ixti

ixti Aug 14, 2011

@seanlin, I have implemented tags before, see pull request #90. So you can mark your post with several tags, but category is always one or nothing :)) I believe that nature is best architecture, so you can put a document only in one File, and one file into anther. But you can label your document with multiple tags (e.g. colored stickers).

ixti commented Aug 14, 2011

@seanlin, I have implemented tags before, see pull request #90. So you can mark your post with several tags, but category is always one or nothing :)) I believe that nature is best architecture, so you can put a document only in one File, and one file into anther. But you can label your document with multiple tags (e.g. colored stickers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment