I'm attempting to add a custom page, that will not be associated with a particular type of piece or other set of data. It will be used to run actions for reporting and processing/showing data, so it needs to be fairly stand-alone. I want it to be a page type, so it will be handled in navigation the same way that any other page is. I mostly have it working, but am running into an issue - no matter how I set it up, when I try to navigate to an instance of the page that gets created, it always looks for the template in lib/modules/apostrophe-pages/views/pages instead of the module folder.
In this case, I'm currently calling the module test-item (will rename once I figure out what the issue is). So, I have a folder called lib/modules/test-item, with index.js and views/index.html. I also attempted to rename the template in the views folder to show.html and test-item.html just to be sure it wasn't a naming issue. Here's how the module is configured in index.js:
module.exports = {
name: 'test-item',
extend: 'apostrophe-custom-pages',
construct: function(self, options) {
//more logic stuff
}
}
Also, if I add a field to the module, it does show up when I try to make a new page with the type test-item, so I know the module itself is being loaded.
In app.js, I have the module loaded with this:
'test-item': {},
The page type does not get added to the list of types in the new page dialog unless I add it to the apostrophe-pages module, so I added it like so:
types: [
{
name: 'test-item',
label: 'Test Page'
}
]
Do I need to do something different to get the module to load the template from lib/modules/test-item/views/index.html instead of throwing an error when it cannot find the template in lib/modules/apostrophe-pages/views/pages/test-item.html?
Thanks!