0

I am having trouble getting individual blog article pages to show with the apostrophe blog module. I must be missing something or forgetting something?

Here´s what to do to replicate the issue (with the code in the following repo: https://github.com/newdesignideas/sample-veebidisainer)

  • created a sample article or blog post with the url "test" and title "test"
  • the sample blog post "test" title is shown in the main blog page at localhost:3000/blog
  • the sample blog post gives an 404 error when visiting the url "localhost:3000/test"

My app.js is the following:

var apos = require('apostrophe')({
  shortName: 'veebidisainer',
  title: 'veebidisainer',

  // declaring the blog bundle
  bundles: [ 'apostrophe-blog' ],
  // These are the modules we want to bring into the project.
  modules: {
    // This configures the apostrophe-users module to add an admin-level
    // group by default
    'apostrophe-users': {
      groups: [
        {
          title: 'guest',
          permissions: [ ]
        },
        {
          title: 'admin',
          permissions: [ 'admin' ]
        }
      ]
    },
    // This configures the apostrophe-assets module to push a 'site.less'
    // stylesheet by default
    'apostrophe-assets': {
      stylesheets: [
        {
          name: 'site'          
        }
      ],
      scripts: [
        {
          name: 'mo',
        }
      ]
    },
    // Add your modules and their respective configuration here!

    'apostrophe-blog': {
      widget: true
    },
    'apostrophe-blog-pages': {},
    'apostrophe-blog-widgets': {},
    'apostrophe-pages': {
      // We must list 'apostrophe-blog-pages'
      types: [

        { name: 'apostrophe-blog-pages',
          label: 'Blog' 
        },
        {
          name: 'default',
          label: 'Default'
        },
        {
          name: 'home',
          label: 'Home'
        }
      ]
    },
    'b2b-main-menu': {},
    'b2b-main-menu-widgets': {
      extend: 'apostrophe-pieces-widgets'
    },
  }

});

I checked the MongoDB database and the sample test article was published correctly. Perhaps I am missing a view file? Since there is little to no documentation - I have tried creating the view files wherever appropriate. This screenshot shows the current file structure:

Click here to view the sceenshot showing the lib/module file structure

1 Answers1

0

The URLs for the blog posts themselves are relative to the blog page URL. So if you have a blog page at /blog, and a test post with a slug of test, then you should be able to see it at /blog/test.

Alex Gilbert
  • 143
  • 5
  • Just a heads up - I discovered that I had to create and configure a module called **"apostrophe-blog-pages-widgets"** rather than **"apostrophe-blog-widgets"** - otherwise the console displayed a warning. – robert-jakobson Mar 01 '17 at 10:07
  • Thanks, I copied the apostrophe sandbox project and got the blog working by basing my site on that. – robert-jakobson Mar 01 '17 at 11:56