-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Make the named frontend routes customisable #4519
Comments
Could it be an idea to include them in config.js or should them be made in the DB with a UI like tag management one? |
Eventually we'll move these properties out to the settings or perhaps somewhere else - but for now it doesn't matter - what this issue covers is refactoring the code so that these properties are set in one internal location :) |
So I'll give this issue a try. Thanks @ErisDS |
@mattiascibien @ErisDS I'm interested in taking a fresh look at this if there has been no recent developments. |
@katiefenn did not had time to work on this. :( you can have a look. |
issue TryGhost#4519 - Removal of hard-coded route paths from controller file - Creation of route config in example config file - New aliases for other rss paths - Substitution of hard-coded paths in response context creation - Added unit tests for new routes and aliases
Are hard-coded URLs in themes within the scope of this refactor? For example, take tag RSS subscription links in Casper: It seems a change to the template is, strictly speaking, outside of the scope of Ghost itself. But should I consider how best to expose a keyword setting to theme templates? |
For themes to be able to route to customized front-end urls, ghost is going to need to add a new |
@katiefenn agreed, that's definitely not in the scope of the refactor - also the Casper theme can be updated to use the |
@ErisDS @novaugust Thank you for the feedback. I'm getting ready to create another PR (compare), and wanted to first check that the refactor matches what was asked for:
There are things which I could use some feedback on:
|
That compare looks sensible to me. It'll probably be easier to get feedback on the PR if you just open it up :) |
In
core/server/routes/frontend.js
there are a number of named routes which use English words includingtag
,author
andpage
. These need to be abstracted out so that they can be customised for two reasons:/genre/
rather than/tag/
, and perhaps you'd rather the route be/by/
rather than/author/
.At the moment, these routes are hardcoded strings repeated multiple times through the codebase, and depended upon for creating logic elsewhere in Ghost.
This needs to be abstracted out into information that can be used to dynamically build the correct routes and assign the right context.
Notes on refactoring
At present there are effectively 3 main contexts which have a top-level route, and a set of subroutes.
/
/tag/:tag_slug/
/author/:author_slug/
All three of these have the following subroutes:
/
- the first page of results/page/:page_num/
- subsequent pages of results/rss/
- the first page of the RSS feed/rss/:page_num/
- the subsequent pages of the RSS feedAlso note that at present
/feed/
is an alias of the base/index/rss/
route only, when in factfeed
should probably be an alias anywhere whererss
is used, and should always 301. I can imagine Apps reasonably wanting to specify other aliases for this.Fundamentally, the main thing we need to achieve is making it possible to replace the words
tag
,author
andpage
with other words without things breaking, the other information here is intended to paint a bigger picture of what this refactor needs to move us towards.The text was updated successfully, but these errors were encountered: