Adjust post URL handling for API v2's absolute URLs (#1055)

no issue
- API v2 outputs absolute URLs so we no longer need to construct full URLs ourselves
This commit is contained in:
Kevin Ansfield 2018-10-16 16:54:15 +01:00 committed by GitHub
parent 8a43351d8e
commit e04f3b6312
3 changed files with 2 additions and 8 deletions

View File

@ -759,7 +759,7 @@ export default Controller.extend({
if (status === 'published') {
type = this.get('post.page') ? 'Page' : 'Post';
path = this.get('post.absoluteUrl');
path = this.get('post.url');
} else {
type = 'Preview';
path = this.get('post.previewUrl');

View File

@ -147,12 +147,6 @@ export default Model.extend(Comparable, ValidationEngine, {
internalTags: filterBy('tags', 'isInternal', true),
isScheduled: equal('status', 'scheduled'),
absoluteUrl: computed('url', 'ghostPaths.url', 'config.blogUrl', function () {
let blogUrl = this.get('config.blogUrl');
let postUrl = this.get('url');
return this.get('ghostPaths.url').join(blogUrl, postUrl);
}),
previewUrl: computed('uuid', 'ghostPaths.url', 'config.blogUrl', function () {
let blogUrl = this.get('config.blogUrl');
let uuid = this.get('uuid');

View File

@ -21,7 +21,7 @@
{{!-- new posts don't have a preview link --}}
{{#unless post.isNew}}
{{#if post.isPublished}}
<a class="post-view-link" target="_blank" href="{{post.absoluteUrl}}">
<a class="post-view-link" target="_blank" href="{{post.url}}">
View post {{svg-jar "external"}}
</a>
{{else}}