-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Description
It's always hard to spec a refactoring issue, as it's always more art than science ;)
This refactor is one of the key parts of the work we need to do to refactor the entire frontend of Ghost (that is the blog rendering part) so that we can make Channels a reality.
The frontend controller is currently made up of 3 functions that are almost identical for each of the index, tag and author routes.
This hardcoded, duplicated logic makes it hard to extend Ghost or make these routes behave more dynamically. We need to abstract this logic out a bit to make it easier to work with.
The aim of this issue is to refactor these three functions into a single rendering function and a set of configuration properties for each route/channel. It can all continue to live in the same file, but we should end up with a more abstracted controller, ready to move this into a separate system.
The document on channels explains the kind of configuration properties we expect to have for each route/channel. It will all remain hardcoded at the moment - it won't yet become configurable or extensible - that's another step.
There is one goal for this issue, of deduplicating logic and determining exactly what bits of information, like the url, or the number of postsPerPage, we need to customise for each one to make it work exactly as it does now.