Is it possible to ship a custom page with a theme such that no additional setup is needed to activate that page once the theme is activated (ie not needing to create a Page
or modify routes.yaml
).
There’s solution for that over here: Upload Files in Ghost - #6 by vikaspotluri123
Is there any way to do that with a Handlebars page (server side rendered) that does need to be processed prior to serving?
Not that I can think of, as Handlebars templates are designed to render pages and structure that have been put into Ghost . Can I ask what the use case is?
My use case is that I want a page that lists all of the posts (what might traditionally be on the index
page) and for my index
page I have something like featured posts, recent posts, recent posts by specific tags, etc. I want to deploy that posts
page with my theme (it is linked to from the index page under a “show all posts button”). Right now I have to create that page and make sure the slug is set up correctly, etc so that the link from the index page works.
In that case could you not supply the routes.yaml
as part of your theme bundle? Then the theme user can upload the routes file. I’ve seen this done with many themes, including the main themes from Ghost
Sure, and perhaps this is just my being a new user to Ghost, but why is that file not uploaded with /activated with the theme?
The site routes and the theme should be applied independently. If someone has put together a specific set of pages with their routes, creating a specific sitemap for their content, if they apply a new theme they won’t want that route structure being destroyed by the theme. Hope that makes sense
Right, I sort of figured that, which is why I was wondering if there is a way to add routes as part of the theme activation without needing to resort to the routes file or creating “pages”.