Jump to content
Greg Lumley

Creating a blog.. from scratch... 🙂

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. 

Share this post


Link to post
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

Share this post


Link to post
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. 

Share this post


Link to post
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 😄

 

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By prestoav
      Hi everyone,
      PW version 3.0.123
      I've recently tried to upgrade the Blog module in an installation from 2.4.0 to 2.4.5 and now get the following errors when trying to visit Blog > Posts in admin:
      Fatal Error: Uncaught Error: Call to a member function count() on null in /MYSITE/site/modules/ProcessBlog/ProcessBlog.module:1299 Stack trace: #0 /MYSITE/site/modules/ProcessBlog/ProcessBlog.module(1421): ProcessWire\ProcessBlog->renderItemsSummaries(Object(ProcessWire\PageArray)) #1 /MYSITE/site/modules/ProcessBlog/ProcessBlog.module(1989): ProcessWire\ProcessBlog->renderItemsList(Object(ProcessWire\PageArray)) #2 /MYSITE/wire/core/Wire.php(380): ProcessWire\ProcessBlog->___executePosts() #3 /MYSITE/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___executePosts', Array) #4 /MYSITE/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessBlog), 'executePosts', Array) #5 /MYSITE/wire/core/ProcessController.php(333): ProcessWire\Wire->__call('executePosts', Array) #6 /MYSITE/wire/core/Wire.php(380): ProcessWire (line 1299 of /MYSITE/site/modules/ProcessBlog/ProcessBlog.module) This error message was shown because: you are logged in as a Superuser. Error has been logged. I can see posts in Blog > Dashboard and all seems to work still on the front end.

      Anyone else seen this or know of a fix?
    • By Greg Lumley
      Hi! In busy learning to know PW better I'm looking at existing code.
      I have Bitpoets Editorial Responsive Blog as example. While looking through the code I've just found this line in the blog-head.php 
      <link rel="stylesheet" href="<?= $config->urls->templates ?>assets/css/main.css?ts=<?= time() ?>" /> I hope it's not a stupid question but I've never seen this before...
      main.css?ts=<?= time() ?> I notice the main template is empty but of course renders on the front end.
      Using a timestamp really has me totally confused. Can someone explain it to me please. 
      Thank you! 
      Greg
    • By louisstephens
      Just wanted to put it on everyone's radar that VueMastery is having a free weekend starting today at (12 ET). All videos in every course are free to watch until Sunday at midnight.
      Cheers!
    • By MateThemes
      Hello everyone!
      I use ryans blog site profile to build my template around it. I use my mamp pro setup with php 7, mysql 5 and apache server. On my local setup the following code works fine:
      <?php foreach(page()->children as $category): ?> <a class='uk-link-reset' href='<?=$category->url?>'> <div class='uk-card uk-card-default uk-card-hover uk-card-body'> <h3 class='uk-card-title uk-margin-remove'><?=$category->title?></h3> <span class='uk-text-muted'><?=$category->numPosts(true)?></span> </div> </a> <?php endforeach; ?> It is the same code as ryan used it, only my css classes. On my live server with the same setup as mamp pro i got following error:

      Does anyone have the same error in this context?
      Thank you very much for your help!
    • By Violet
      Here I'm introducing FlipFall Magazine, our multi-topic blog. It used to run on Wordpress but we recently switched it to ProcessWire. This was done the usual way we do it when converting our sites: install ProcessWire in a subfolder of the original Wordpress site under a hard-to-guess name, set up the new site there, then move content over manually, inspecting and updating each article as needed. After the ProcessWire site was ready, when we un-installed the Wordpress one and moved the ProcessWire site up one level to the document root, and... done.
      We used the W3CSS framework because it handles the responsive breakpoints so well (no extra work for us 😉), and it tends to default to a clean modern look.
      We wanted full control over the back end of the site and do customized things without having to hire a developer.  As FlipFall has grown, the ability to have in-house back-end control has become even more important.
      Case example: Ad partners - we now can quite easily, if we wish, place different ads on different topics on this blog at a moment's notice - no need to hire a developer. Changes like this can be implemented in-house right away. The fact that we can easily incorporate this sort of thing is really nice when we're talking with potential ad partners.
      Helpful features of ProcessWire during this experience:
      The ability to export and import fields in PW was key here. We had a few other article-style sites I had done in PW recently, so having the same types of templates was very helpful. We were able to export fields and templates from our existing sites and import into FlipFall as a starting base point. No need to re-invent the wheel here! Another helpful ability of PW was when we were dealing with the categories. We built the site without category templates (but with the category page field), then added the templates in later as needed - no disruption. In other words, a template-less page field worked perfectly for the categories until we needed the template, then we just created the template. Not every feature of the site needs to be thought out in absolute full beforehand, some can be added in later as needed. Very extensible and convenient. Internal links within blog posts worked well using the page select option in the link button on the editor. When moving out of staging folder and into document root, the links auto-updated, which was nice. Creating new articles is a breeze, because under PW our fields are now customized for our needs: we created all of the fields we need and none of the ones we don't. Again, this is unlike most blogging CMS's, where they try to guess what you want (and usually get it wrong). Even for people who are solely doing blogs/article sites, I feel that ProcessWire is a much better option than most blog-specific platforms, because of PW's flexibility.  The only thing I miss about Wordpress is the ability to auto-schedule post publication, which for the serious blogger is important. For example, there were some occasions on some of our other blogs where we needed to schedule posts to auto-publish at 3:01am Eastern Time to allow a time-sensitive post to come out as early in time of day as possible on publication date (3:01 am US Eastern time ensures it's that same day 12:01 am on Pacific time). We were delighted to see that ProcessWire is much, much lighter on resources of the hosting environment than the same site on Wordpress - we could see this empirically on our web hosting stats before and after the switch.
×
×
  • Create New...