【问题标题】:Apostrophe Blog Module: Individual Blog Posts 404撇号博客模块:个人博客文章 404
【发布时间】:2017-02-28 21:11:15
【问题描述】:

我无法使用撇号博客模块显示单个博客文章页面。我一定是错过了什么或忘记了什么?

这是复制问题的方法(使用以下 repo 中的代码:https://github.com/newdesignideas/sample-veebidisainer

  • 使用网址“test”和标题“test”创建了一篇示例文章或博客文章
  • 示例博客文章“test”标题显示在 localhost:3000/blog 的主博客页面中
  • 示例博客文章在访问 url “localhost:3000/test”时出现 404 错误

我的 app.js 如下:

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'
    },
  }

});

我检查了 MongoDB 数据库,示例测试文章已正确发布。也许我错过了一个视图文件?由于几乎没有文档 - 我尝试在适当的地方创建视图文件。此屏幕截图显示了当前的文件结构:

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

【问题讨论】:

    标签: apostrophe-cms


    【解决方案1】:

    博客文章本身的 URL 与博客页面 URL 相关。所以如果你有一个/blog 的博客页面,以及一个带有test slug 的测试帖子,那么你应该可以在/blog/test 看到它。

    【讨论】:

    • 提醒一下 - 我发现我必须创建和配置一个名为 "apostrophe-blog-pages-widgets" 而不是 "apostrophe-blog -widgets" - 否则控制台会显示警告。
    • 谢谢,我复制了撇号沙箱项目,并以此为基础建立了我的博客。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-14
    • 1970-01-01
    • 1970-01-01
    • 2011-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多