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

✨New helper: content_api_url #21331

Merged
merged 12 commits into from
Oct 25, 2024
Merged

Conversation

cathysarisky
Copy link
Contributor

@cathysarisky cathysarisky commented Oct 16, 2024

This adds a content_api_url helper, returning the url for Ghost's content api. Takes a false argument if a relative URL is wanted.

Why? Because I just realized I don't have access to the content API's url in handlebars. :) This addition will facilitate 3rd party integrations built into themes.

Companion PR for gscan: TryGhost/gscan#558

@cathysarisky cathysarisky changed the title first commit, tests to follow [WIP tests] New helper: content_api_path Oct 16, 2024
@cathysarisky cathysarisky marked this pull request as ready for review October 18, 2024 19:58
@cathysarisky cathysarisky changed the title [WIP tests] New helper: content_api_path ✨New helper: content_api_path Oct 18, 2024
Copy link
Contributor

@allouis allouis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor comments but otherwise it looks good!

}
}

module.exports.async = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be an async helper! It will be much more performant without it!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're also missing a newline at the bottom of this file - I would recommend installing an EditorConfig plugin for your editor

@cathysarisky cathysarisky marked this pull request as draft October 23, 2024 11:40
@cathysarisky cathysarisky changed the title ✨New helper: content_api_path ✨New helper: content_api_url Oct 23, 2024
@cathysarisky cathysarisky marked this pull request as ready for review October 23, 2024 14:20
allouis pushed a commit to TryGhost/gscan that referenced this pull request Oct 25, 2024
refs TryGhost/Ghost#21331

We need to make sure that theme developers are able to use
the new helpers without gscan errors!
@allouis allouis merged commit 21da7f6 into TryGhost:main Oct 25, 2024
21 checks passed
@cathysarisky cathysarisky deleted the content-api-path branch November 10, 2024 15:41
tilak999 pushed a commit to tilak999/ghost that referenced this pull request Nov 20, 2024
This adds a `content_api_url` helper, returning the url for Ghost's
Content API. By default it will return an absolute URL but can be 
passed `absolute=false` if a relative URL is wanted.

This works in tandem with the `content_api_key` helper to
facilitate third party integrations with the Content API, for
example - custom Portal or Search implementations.
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.

2 participants