Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend controller refactor #5192

Closed
ErisDS opened this issue Apr 25, 2015 · 4 comments · Fixed by #5219
Closed

Frontend controller refactor #5192

ErisDS opened this issue Apr 25, 2015 · 4 comments · Fixed by #5219
Labels
server / core Issues relating to the server or core of Ghost

Comments

@ErisDS
Copy link
Member

ErisDS commented Apr 25, 2015

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.

@ErisDS ErisDS added the server / core Issues relating to the server or core of Ghost label Apr 25, 2015
@acburdine
Copy link
Member

@ErisDS I'll take a crack at this this weekend and see what I can come up with :)

@acburdine
Copy link
Member

@ErisDS before I rewrite this, I have a question about channels. I read through the documentation on the wiki, and I saw that the author and tag behavior is/should be identical with regards to templating. However, the current controller allows specific tag templates, but not specific author templates.

My question is, which one is correct? Personally, I would vote for both tags and authors being able to have specific templates.

@ErisDS
Copy link
Member Author

ErisDS commented May 3, 2015

Definitely both, I thought that was already implemented!!!

@acburdine
Copy link
Member

@ErisDS I created a bit of test documentation for the channel options being passed in here:
https://gist.github.com/acburdine/69ac2a281dcccfc66318

Can you take a look at it and let me know if I'm on the right track?

acburdine added a commit to acburdine/Ghost that referenced this issue May 5, 2015
closes TryGhost#5192
- combines homepage, author, tag routes into one function (with different hash params)
- provides some abstraction for channels
acburdine added a commit to acburdine/Ghost that referenced this issue May 5, 2015
closes TryGhost#5192
- combines homepage, author, tag routes into one function (with different hash params)
- provides some abstraction for channels
acburdine added a commit to acburdine/Ghost that referenced this issue May 5, 2015
closes TryGhost#5192
- combines homepage, author, tag routes into one function (with different hash params)
- provides some abstraction for channels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server / core Issues relating to the server or core of Ghost
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants