Blogprint Errors

I recently installed the blogprint plugin, and while it’s really cool, I’m getting the following errors:

  • Nav-pagination snippet won’t show/load
  • The url inks the the article pages show up as /2016/10/02/article-title-here instead of blog/article-title-here
  • nav-page snippet isn’t working.

How do I fix these issues?

This is by design, you can remove the corresponding route from this config.php file.

What necessary changes do I need ot make in the config file?

Try to remove this route:

array(
    'pattern' => '(:num)/(:num)/(:num)/(:any)',
    'action'  => function($year, $month, $day, $uid) {
      $page = page('posts/' . $uid);
      if(!$page){
        $page = site()->errorPage();
      } else {
        if(($page->date('Y') != $year)
            || ($page->date('m') != $month)
            || ($page->date('d') != $day)) {
          $page = site()->errorPage();
        }
      }
      return site()->visit($page);
    }
  ),

I don’t know if and how this might affect other parts of the site, though.

Edit: I think the links will not work anymore if you remove the route, and you need to adapt the templates.

1 Like

How would I go about adapting the templates?

I have never used blogprint, so I’m not familiar with it. In the template, the links are constructed to use the year/month/day format, so you would have to change these links back to “normal” in the first place if you remove the route. But maybe the whole archive stuff depends on that as well.

Maybe it is easier to create a blog yourself, if you don’t want those features from blogprint. There is a tutorial on how to build a blog in the cookbook.

1 Like

I found this plugin that is in blog priint

    /**
     * getPostUrl()
     *
     * Returns the full URL of a given post in wordpress-style.
     *
     * @param  mixed $post
     * @return string
     */
    function getPostUrl($post) {
      $site = site();

      $uri  = $site->url();
      $uri .=   '/' . $post->date('Y')
              . '/' . $post->date('m')
              . '/' . $post->date('d')
              . '/' . $post->slug();

      return $uri;
    }

Maybe if I removed/modified this?

I would no modify, but remove it. But remember to replace all occurrences of the function with a standard $page->url() method.

1 Like

Sweet. Solved it, all links are working now :slight_smile: