[Epic] Frontend Refactor (Channels)
See original GitHub issueThis is a WIP epic - I’m still working out the steps needed to get from A-B and I’ll break it down into sub tasks/sub issues as and when, in the meantime, the goal is clear and documented here.
The frontend of Ghost - that is the server side code which renders a blog using the active theme - has been somewhat unloved for a little while now. It essentially consists of some hard coded routes in /routes/frontend.js
, which in turn call the monolithic functions in /controllers/frontend.js
. It’s time for this part of Ghost to be refactored into something more elegant, and importantly, something more extensible.
On the wiki you’ll find a new document, titled Channels 101, which introduces and explains the concept of Channels for the frontend. In short channels are the abstracted concept of a list of posts, i.e. the homepage, the tag archive, the author archive or any other group of posts you could conceive of.
And the very end of the document it talks about working to slowly remove hardcoded bits of the fontend and refactor it into configuration & generation code, before finally moving towards making channels a model & API endpoint just like Posts, Tags and Users.
This issue is the ‘epic’ where we’ll keep track of our progress towards achieving this New World Order.
- Refactor out the hardcoded slug keywords #4519
- Convert sitemaps & rpc pings to use events #5069
- Move RSS from frontend controller & refactor to use events
- Move post-processing of author data out of the frontend controller #5159
- Refactor frontend controller #5192
Need to solve:
- Dynamic routing for channels
- Pagination when in channel
- meta data for channels
- sitemap for channels
- Improve the channels API
Maybe later:
-
add a channel registration mechanism that works whilst Ghost is running -
Support offset, rather than page, in the API #2896 - RSS feeds for each channel linked in that channel
- Post urls & next/prev post when in channel
Updates: Aug 2017
The current state of channels is that it the functionality is largely refactored and in place, but can only be accessed by modifying the core file channels-config.js
. This is because, although the basics are working, advanced behaviour of Ghost isn’t yet properly linked to channels.
Examples of missing pieces (some listed above) are:
- Sitemaps
- Meta data
- RSS feed (URLs only)
- Next/prev post when in a channel
- Deep customisation, e.g. disabling RSS feeds
There is also some pure-refactoring that needs to be done: E.g.
- moving channels to a proper home
- moving non-channel pieces from controllers/frontend.js to a proper home
- strengthening the implementation to make channels more of a first class object
- better/clearer default configuration
- proper use of express
- exposing channels without core modification
Basically, we need to iron out a few more of the major pieces, and then expose this config. Short term, we’re going to start publishing blog posts on how to use the functionality that is there by hacking core.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:10
- Comments:6 (3 by maintainers)
Top GitHub Comments
How far off completion is this? I’d love to contribute but I’m no Node developer lol
Closing in favour of #9601