listing posts on a static page

gerald
Jr. Bludit
Posts: 8
Joined: Wed Mar 24, 2021 5:29 pm

I also came across that issue and was reading that thread several times but didn`t found the solution for my scenario. For later reference and helping others having a similar setup:

what I wanted:
- posts on a static page with working pagination
- using a custom template
- different url than "blog"


How-to:
- It´s not required to create a static page. (I assume from WordPress experience that the system is then confused to either use the static page or the internal loop)
- admin > settings > advanced: setup a homepage like explained a few posts earlier. After refreshing that page you see the /blog/ URI filter. leave it as it is. It`s not working when you change the name here as the word "blog" is hardcoded and routed in bl-kernel\boot\rules\60.router.php and leads to confusions with the $where_am_I variable (as far as I got it)
- use htaccess to change the /blog to /posts/ url: (backslash at the end required!)

Code: Select all

RewriteRule blog posts/ [L,R=301]
- adjust the template's index.php for the custom template:

Code: Select all

      if ( $WHERE_AM_I == 'blog') {
          include(THEME_DIR_PHP.'yourtemplate.php');
      }
if there is a better way to do it, please let me know but that works fine for me. I`m always happy to start new projects with bludit and play around with it.
Post Reply