Jump to content

Creating a blog.. from scratch... ?


Greg Lumley
 Share

Recommended Posts

Hi! I'm busy building a blog into my first test/learning/free/clients/project ?

I've had a look at all the blog examples and there seem to be different ways of doing it. (the point of Processwire, I know)

It seems this is generally how it's done:

  • Master Blog Page
      - Blog Post Child Page
      - Blog Post Child Page
      - Blog Post Child Page

What I'm particularly interested in is the Categories. What would you advise?
Repeater Field?
Tags?

I think I've even seen Categories set up as Children of a master Category page too. The pages were hidden containing no 

What would you recommend? 

Thank you! 

Greg. 

Bare with me, I'm bashing my way through while I learn. 

Link to comment
Share on other sites

I usually use regular pages for categories, and keep categories in a completely separate sub-section of the page tree. This requires two templates:

  • category-index: This is the "master" page, which holds all the categories. Set to allow only one page, and only allow children of type "category".
  • category: Each category page represents a category. Category pages are set to allow only the category-index as it's parent page – or allow other category pages, this way you can build hierarchical categories.

Then you only need a Page Reference field targeting the category pages. This field can either be a single-option select if you only want to allow one category per post, or a multivalue field for multiple categories.

The benefit of this approach is that editors can easily create new categories, and you can use normal page access controls to decide who can edit and add categories. You can easily change their sort setting to sort categories alphabetically or whatever you want. Pages are also way easier to access, search for and translate from the API side. For example, getting a list of categories is as easy as: $pages->get('template=category-index')->children()

  • Like 1
Link to comment
Share on other sites

I realise this is actually a bit of a stupid post. I'm busy re-inventing the wheel here when Kongondo has created the ProcessBlog module with docs and pretty much all the questions answered. 

I guess I'm so used to being fed rubbish in the WordPress environment. ?

I'd delete this if I could. 

Link to comment
Share on other sites

35 minutes ago, Greg Lumley said:

I realise this is actually a bit of a stupid post.

Not at all! I thought you wanted to get your hands dirty, build a simple(r) blog from scratch. Along the process, you will learn more about ProcessWire. 

This is not meant to discourage you from using the Blog module :-). By all means, go for it, if it suits your needs. 

I don't think we've been properly introduced yet. So, welcome to ProcessWire and the forums ?

 

Link to comment
Share on other sites

@Greg Lumley I'd actually recommend setting up your blog and categories on your own – you'll realize it's dead simple. Especially when coming from WordPress development, it's important to realize that often the best solution is not a pre-made module, but a custom data structure. This will leave you in full control, and also help you understand how to use pages and template to structure your content.

Link to comment
Share on other sites

1 hour ago, MoritzLost said:

I usually use regular pages for categories, and keep categories in a completely separate sub-section of the page tree. This requires two templates:

  • category-index: This is the "master" page, which holds all the categories. Set to allow only one page, and only allow children of type "category".
  • category: Each category page represents a category. Category pages are set to allow only the category-index as it's parent page – or allow other category pages, this way you can build hierarchical categories.

Then you only need a Page Reference field targeting the category pages. This field can either be a single-option select if you only want to allow one category per post, or a multivalue field for multiple categories.

The benefit of this approach is that editors can easily create new categories, and you can use normal page access controls to decide who can edit and add categories. You can easily change their sort setting to sort categories alphabetically or whatever you want. Pages are also way easier to access, search for and translate from the API side. For example, getting a list of categories is as easy as: $pages->get('template=category-index')->children()

Aha! I hadn't thought of the Roles part of it. That makes total sense.

 

Thank you for replying.

Link to comment
Share on other sites

1 hour ago, kongondo said:

Not at all! I thought you wanted to get your hands dirty, build a simple(r) blog from scratch. Along the process, you will learn more about ProcessWire. 

This is not meant to discourage you from using the Blog module :-). By all means, go for it, if it suits your needs. 

I don't think we've been properly introduced yet. So, welcome to ProcessWire and the forums ?

 

Okay then I'm booting the module ?? no really, I am. 

And for the exact reason of learning ProcessWire.

Thanks for the welcome! 


G

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...