![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@forestryio/gatsby-remark-normalize-paths
Advanced tools
Normalize paths in frontmatter and body of markdown files to be gatsby compliant
gatsby-remark-normalize-paths
normalize your paths to be gatsby compliant.
It find absolute paths deeply in the frontmatter and the body of your markdown files and transform them to relative paths. If you have empty fields, it delete them (optional).
gatsby-transformer-sharp
and your images fields should not be empty to avoid the error GraphQL Error Field must not have a selection since type "String" has no subfields
when you build,Let's imagine your gatsby data structure is the following:
/
↳ content
↳ posts
↳ post-1.md
↳ images
↳ image-1.jpeg
↳ image-2.jpeg
↳ image-3.jpeg
↳ image-4.jpeg
↳ image-5.jpeg
↳ src
↳ public
↳ static
And your markdown files containing absolute paths:
---
title: "Post 1"
cover: "/content/images/image-1.jpg"
images:
- "/content/images/image-2.jpg"
- "/content/images/image-3.jpg"
- "/content/images/image-4.jpg"
---
Lorem ipsum ![](/content/images/image-5.jpg) Lorem ipsum
In your markdown frontmatter or body, you can use absolute paths (/content/images/image-1.jpg
) and it will be convert to relative paths (../images/image-1.jpg
)
You can download gatsby-remark-normalize-paths
from the NPM registry via the
npm
or yarn
commands
yarn add gatsby-remark-normalize-paths
npm install gatsby-remark-normalize-paths --save
Add the plugin in your gatsby-config.js
file:
module.exports = {
plugins: [
{
resolve: "gatsby-transformer-remark",
options: {
plugins: [
// without options
"gatsby-remark-normalize-paths"
// or
// with options
{
resolve: "gatsby-remark-normalize-paths",
options: {
pathFields: ["image", "cover"],
},
},
],
},
},
],
}
Note: If you don't want this plugin delete empty frontmatter of some fields, you need to specify pathFields
See CONTRIBUTING.md guidelines
See CHANGELOG.md
This project is licensed under the MIT License - see the LICENCE.md file for details
1.0.0 (2018-08-26)
FAQs
Normalize paths in frontmatter and body of markdown files to be gatsby compliant
The npm package @forestryio/gatsby-remark-normalize-paths receives a total of 2 weekly downloads. As such, @forestryio/gatsby-remark-normalize-paths popularity was classified as not popular.
We found that @forestryio/gatsby-remark-normalize-paths demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.