Skip to content

New URL helper - URL consistency fixes#1817

Merged
ErisDS merged 1 commit intoTryGhost:masterfrom
ErisDS:url-helper
Jan 6, 2014
Merged

New URL helper - URL consistency fixes#1817
ErisDS merged 1 commit intoTryGhost:masterfrom
ErisDS:url-helper

Conversation

@ErisDS
Copy link
Member

@ErisDS ErisDS commented Jan 3, 2014

fixes #1765
fixes #1811
issue #1833

New UrlFor functions

  • moved body of url helper to config.path.urlFor, which can generate a URL for various scenarios
  • urlFor can take a string (name) or object (relativeUrl: '/') as the first
    argument - this is the first step towards issue Improve URL generation across the app #1833
  • also added config.path.urlForPost which is async and handles getting
    permalink setting
  • frontend controller, ghost_head helper, cache invalidation all now use
    urlFor or urlForPost all urls should be correct and consistent

URL Consistency Improvements

  • refactored invalidateCache into cacheInvalidationHeader which returns a
    promise so that url can be generated properly by urlForPost
  • moved isPost from models to schema, and refactored schema to have a tables object
  • deleted posts now return the whole object, not just id and slug,
    ensuring cache invalidation header can be set on delete
  • frontend controller rss and archive page redirects work properly with subdirectory
  • removes {{url}} helper from admin and client, and replaced with adminUrl
    helper which also uses urlFor
  • in res.url ghostRoot becomes relativeUrl, and path is removed

This comment was marked as abuse.

@ErisDS
Copy link
Member Author

ErisDS commented Jan 4, 2014

Yeah, I'm not happy with the urlFor function.

Currently it is what the {{url}} helper did before, ripped out into a function, with the addition of returning relativeUrl if it is available.

We need something more like what is described in #1833, but there are challenges.

Right now urlFor is focused on generating urls for posts... but maybe that should be more explicit

This comment was marked as abuse.

This comment was marked as abuse.

fixes TryGhost#1765
fixes TryGhost#1811
issue TryGhost#1833

New UrlFor functions

- moved body of url helper to config.path.urlFor, which can generate a URL for various scenarios
- urlFor can take a string (name) or object (relativeUrl: '/') as the first
  argument - this is the first step towards issue TryGhost#1833
- also added config.path.urlForPost which is async and handles getting
  permalink setting
- frontend controller, ghost_head helper, cache invalidation all now use
  urlFor or urlForPost all urls should be correct and consistent

URL Consistency Improvements

- refactored invalidateCache into cacheInvalidationHeader which returns a
  promise so that url can be generated properly by urlForPost
- moved isPost from models to schema, and refactored schema to have a tables object
- deleted posts now return the whole object, not just id and slug,
  ensuring cache invalidation header can be set on delete
- frontend controller rss and archive page redirects work properly with subdirectory
- removes {{url}} helper from admin and client, and replaced with adminUrl
  helper which also uses urlFor
- in res.locals ghostRoot becomes relativeUrl, and path is removed
ErisDS added a commit that referenced this pull request Jan 6, 2014
New URL helper - URL consistency fixes
@ErisDS ErisDS merged commit 68524ac into TryGhost:master Jan 6, 2014
@ErisDS ErisDS deleted the url-helper branch January 13, 2014 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache invalidation headers are not set properly for date permalinks URL inconsistencies in helpers & res.locals

2 participants