Closed atomicbird closed 11 years ago
One possible fix is to change blog.php
, replacing this:
<a class="category" href="<?php echo url() ?>blog/category:<?php echo $article->categories(); ?>"><?php echo $article->categories(); ?></a>
With this:
<?php
foreach(explode(",", $article->categories()) as $category) {
echo '<a class="category" href="' . url() . 'blog/category:' . $category . '">' . $category . '</a> ';
}
?>
This has the effect of creating multiple links that each link to a single category, instead of a single category link that includes all categories in the article-- which seems like the result I'd want. It's probably obvious that PHP is not my strongest language though, so I'd appreciate any improvements anyone could suggest.
The current version of the theme isn't able to list and link multiple categories. That's right. (And no: The home page is set to blog
as you can see in the config.)
In my opinion it's not really necessary to choose more than one category for a blog post (in the very most cases). Of course this depends on the general organisation of a blog and its categories. For multiple specification of posts I'd recommend tags. To implement these check out the tagcloud plugin.
The theme was made just to give users a clean start when creating a blog with Kirby und let them customize it for their own needs. So if you wanna add the ability to use multiple categories, feel free to fork the theme and extend it by building some fancy stuff!
I can see that the home page is set to blog
there, but I wasn't sure if it was the same on the demo site at http://baseblog.sashtown.de/. Anyway, if multiple categories aren't supported then I suggest that "categories" should be changed to "category" in the sample content, the docs, and wherever else it needs to change. When the sample content contains lines like
Categories: Tools
...the plural "Categories" suggests pretty strongly that more than one can be used.
You're absolutely right, Tom. Using the plural was my way to stick to the code example which has been described in the tagcloud article over a year ago (even if I didn't want to implement tags). BTW: I'm not that PHP nerd, too... :)
After your last comments I reconsidered that whole category stuff and I decided to bring up the possibility to use multiple categories as well! It really is the way better approach for a good start especially for folks who aren't that familiar with Kirby yet.
My latest commit comes up with an update which includes multiple categories and no categories as well. Hope you like it.
If the "Categories" item in an article contains a single category, clicking on it lists articles with that category-- the link is something like
http://localhost/blog/category:News
and clicking finds anything with theNews
category.But if multiple categories are listed, for example:
Then the link is
http://localhost/blog/category:Tools,Stuff
, and clicking on it finds no articles at all.[This assumes you've changed the home page to something like
docs
, as described in issue #3 so that category links work.]