Coder Social home page Coder Social logo

shyamlohar / gatsby-wordpress-inline-images Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tylerbarnes/gatsby-wordpress-inline-images

0.0 0.0 0.0 97 KB

Fluid images for gatsby-source-wordpress inline images in post_content

JavaScript 100.00%

gatsby-wordpress-inline-images's Introduction

NOTE: I've joined the Gatsby core team to work on the future of gatsby-source-wordpress with WPGraphQL. For that reason I will be deprioritizing working on this package and will soon deprecate it. If you need this package and are interested in maintaining it please ask me about it!

Gatsby WordPress inline images

gatsby-source-wordpress doesn't process images in blocks of text which means your admin site has to serve the images. This plugin solves that.

Require gatsby-source-wordpress and gatsby-image to be preinstalled

This is a WIP and little testing has been done. I modified this code from my alternative WP source plugin wordsby which was originally modified from gatsby-remark-images. Currently this plugin isn't doing any caching of images. This plugin is also currently hardcoded to only work on pages and posts and only on the post content field. Other post types and fields will be supported later. There is a bunch of commented out code that needs to be sorted through. If you need this plugin please help out by sending PR's!

installation

yarn add gatsby-wordpress-inline-images

Add this plugin as a plugin of gatsby-source-wordpress. Be sure to specify your baseurl and protocol a second time in the gatsby-wordpress-inline-images options, not just in the gatsby-source-wordpress options.

  {
    resolve: `gatsby-source-wordpress`,
    options: {
      baseUrl: `your-site.com`
      protocol: `https`,
      plugins: [
          {
            resolve: `gatsby-wordpress-inline-images`,
            options: {
              baseUrl: `your-site.com`,
              protocol: `https`
            }
          }
        ]
      }
  }

Options

{
	resolve: `gatsby-source-wordpress`,
	options: {
		// required
		baseUrl: `your-site.com`,
		protocol: `https`,
		// defaults
		maxWidth: 650,
		wrapperStyle: ``,
		postTypes: ["post", "page"],
		backgroundColor: `white`,
		withWebp: false, // enable WebP files generation
		useACF: false, // process <img> tags in ACF fields too
		// add any image sharp fluid options here
		// ...
	}
}

gatsby-wordpress-inline-images's People

Contributors

8ctopotamus avatar dependabot[bot] avatar ericmarcos avatar mathijsjh avatar nicksrandall avatar stukh avatar tylerbarnes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.