Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
gatsby-rehype-ghost-links
Advanced tools
Readme
Rewrites absolute links to relative links coming from a Ghost CMS.
yarn add gatsby-transformer-rehype gatsby-rehype-ghost-links
// In your gatsby-config.js
plugins: [
{
resolve: `gatsby-transformer-rehype`,
options: {
plugins: [
{
resolve: `gatsby-rehype-ghost-links`,
},
],
},
},
]
Due to current limitations of the Ghost Content API, links within posts and pages are always returned as absolute URLs rather than relative ones. For example, if you have a link in one of your pages that refers to an internal post (e.g. /welcome-post/
) the Ghost Content API will always return an absolute URL such as
https://your-ghost-cms.org/welcome-post/
.
Those links won't work on your Gatsby site as you host them on a different siteUrl
. gatsby-rehype-ghost-links
is part of the rehype collection and rewrites https://your-ghost-cms.org/welcome-post/
into /welcome-post/
so internal links work as expected.
Currently the detection mechanism for the CMS site URL is limited to content coming from a headless Ghost CMS, but it should be easy to add some options, so this plugin becomes useful in other contexts.
PRs are welcome! Consider contributing to this project if you are missing feature that is also useful for others. Explore this guide, to get some more ideas.
Copyright (c) 2020 styxlab - Released under the MIT license.
FAQs
Gatsby rehype plugin that rewrites absolute links to relative links coming from a Ghost CMS.
The npm package gatsby-rehype-ghost-links receives a total of 32 weekly downloads. As such, gatsby-rehype-ghost-links popularity was classified as not popular.
We found that gatsby-rehype-ghost-links demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.