Blogprint - a blueprint for blogs with kirby

I already posted this in the old forum, but I thought it might be interesting for some people which are new here and new to kirby:

blogprint is a theme for the awesome kirby CMS, to kickstart a blog. It provides all basic features you need for a fully functional blog, but without any styling - only semantic markup is provided.

Features:

  • General
    • Pagination
    • Search (whole site or just the pages)
  • Posts:
    • Title
    • Date
    • Tags
    • Categories
    • Covereimage
    • Author
    • Avatar
    • next/prev links
  • Archive (each with count):
    • Years
    • Years and Month
    • Tags
    • Catgeories
    • Authors

If the archive is opened without any arguments, it will list all articles seperated by year without the text.

There is also a main menu which will show all visible first-level-pages and their visible children (except children for ‘posts’ - which is not visible on default) to add additional pages to the blog.

Configuration:

You can control some stuff in site/config/config.php:

c::set('pagination-posts', 10): number of posts per page

c::set('pagination-archive', 30);: number of posts per archive page

c::set('pagination-search', 30): number of posts per search page

Special snippets:

post-footer.php

Description:

This snippet can list all metadata like date, author, tags and categories for a given post.

Options:

  • post => $post
  • date => true/false (default: true)
  • author => true/false (default: false)
  • avatar => true/false (default: false)
  • tags => true/false (default: false)
  • category => true/false (default: false)
  • class => string/false (default: false)

Usage:

<?php snippet('post-footer', array('post'       => $post,
                                   'author'     => true,
                                   'avatar'     => true,
                                   'tags'       => true,
                                   'category'   => true,
                                   'class'      => 'my-class')) ?>

archives.php

Description:

This snippet can list archives for dates, authors, tags and categories for all posts.

Options:

  • dates => true/false (default: false)
  • authors => true/false (default: false)
  • tags => true/false (default: false)
  • categories => true/false (default: false)
  • class => string/false (default: false)

Usage:

<?php snippet('archives', array('dates'      => true,
                                'authors'    => true,
                                'tags'       => true,
                                'categories' => true,
                                'class'      => 'my-class')) ?>

helpful functions:

getPostUrl( $post )

Returns the wordpress-style-url for a given post.

getAuthorName( $username )

Returns the first- and lastname for a given username.
If no firstname is available, then the username will be returned.
The lastname will only be used, if a firstname is available.

getCoverImage( $post )

Returns the coverimage-img-tag for a given post, if a coverimage is available.
If no coverimage is available, it will return false.

Routing:

All posts are located under /posts, but this folder will be ommited in all urls.

Post URLs:

All links are in Wordpress-style: /year/month/day/post-title (for example: http://blog.dev/2014/12/24/lorem-ipsum ) and will be automaticaly routed to /posts/post-title internaly.

Archive URLs:

Archive for:

  • year: /$year/
  • month: /$year/$month/
  • day: /$year/$month/$day/
  • tags: /tag/$tag/
  • categories: /category/$category/
  • authors: /author/$author/

TODO:

DEMO:

You can see it in my personal (not so well maintained :wink: ) Blog: http://janhofmann.name/blog

DOWNLOAD:

Github: GitHub - ausminternet/blogprint: a blueprint for blogs with kirby

11 Likes

Super awesome! I wish I wasn’t already 75% done building the template for my own blog, I would have started with yours. Next time!

@Jan:
Thanks for your work. It is very nice.

But I have a problem, if I e.g. look at a page Archive for tag "green", if this tag is used at many posts, so that this page uses the pagination.
If I click on one of the pagination links (e.g. “>” or “>>”), then the next page will show a pagination of all posts (and not only the pagination of the posts with the tag “green”).

I have tested this with Apache/2.4.16 (Win32) PHP/5.6.12 on Win7 64-bit locally, installing your plugin with Kirby 2.1.1 directly in the path \xampp_5.6.12\htdocs\.

But this is the same, if I run Apache/2.4.9 (Win32) PHP/5.4.27.

Something is wrong.

I have found a solution (kirby is installed in a subdirectory of the webserver):

In file site\controllers\archive.php change row 74 from

  $posts = $posts->paginate(c::get('pagination-archive'));

to

  $posts = $posts->paginate(c::get('pagination-archive'), array('url' => $page->url)); 

And in file site\plugins\helpers.php change the rows 104, 117 and 130 from

                                       'baseurl' => ''));

to

                                       'baseurl' => site()->url()));

In file snippets\archive-dates.php change row 13 from

      <a href="/<?= $year ?>">

to

      <a href="<?= $site->url() . '/' . $year ?>">

Good luck!

Just what I was looking for! How do I install it?

@AdamRasheed One way of doing that would be to download a starterkit and then exchange the content and site folders with the content and site folders from the “plugin”.

1 Like

I’m curious why you are choosing those 2 frameworks for a blog. For me a blog should be very fast (on mobile) and lightweight. Both frameworks are neither imo. I don’t think a blog would use more then 10% of those frameworks.

You might wanna consider a more lightweight css framework solution. Maybe one of those:

to just name some.

Or no framework at all …:slight_smile:

1 Like

Well I do think that a css frameworks is a necessary evil just because it saves you lots of time and allows you the opportunity to scale. If you start writing your css from scratch and then notice, that you need a more complex and robust grid system that is well tested across the browsers… then have fun migrating your websites css :scream:

@AdamRasheed:
Hint:
You need the directory “site/accounts”, which is missing in blogprint on Github. Don’t delete it on your webserver.

Cool. Also, why are the blueprints in php instead of YML?

The YML/YAML format was introduced later, both formats are still valid. But as you can see, the repo has not been updated for 9 month, so maybe it has been abandoned.

1 Like

Unfortunately it is abandoned atm, yes… I was working on it for personal needs and those needs are no longer needs :wink:

I have it on my todo list for updating it to the latest version of kirby but with very low priority and my spare time is quite rare at he moment. So any help or pull-requests are welcome!

Cheers, Jan

1 Like

So I can just take out the php tag inside it and convert it to yml files?

@AdamRasheed: Yes, exactly.

1 Like