{"id":24015397,"url":"https://github.com/travis-r6s/gridsome-source-wordpress","last_synced_at":"2025-02-25T18:42:22.124Z","repository":{"id":57167559,"uuid":"341964683","full_name":"travis-r6s/gridsome-source-wordpress","owner":"travis-r6s","description":"Forked version, with updated dependencies.","archived":false,"fork":false,"pushed_at":"2021-10-19T16:04:20.000Z","size":207,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-08T07:55:35.083Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/travis-r6s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-24T16:35:26.000Z","updated_at":"2023-11-11T23:52:50.000Z","dependencies_parsed_at":"2022-08-30T13:20:23.864Z","dependency_job_id":null,"html_url":"https://github.com/travis-r6s/gridsome-source-wordpress","commit_stats":null,"previous_names":["travis-r6s/gridsome-source-wordpress","thetre97/gridsome-source-wordpress"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/travis-r6s%2Fgridsome-source-wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/travis-r6s%2Fgridsome-source-wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/travis-r6s%2Fgridsome-source-wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/travis-r6s%2Fgridsome-source-wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/travis-r6s","download_url":"https://codeload.github.com/travis-r6s/gridsome-source-wordpress/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240727544,"owners_count":19848021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-08T07:55:27.147Z","updated_at":"2025-02-25T18:42:22.090Z","avatar_url":"https://github.com/travis-r6s.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @travisreynolds/gridsome-source-wordpress\n\n\u003e WordPress source for Gridsome. This package is under development and\nAPI might change before v1 is released.\n\n## Install\n- `yarn add @travisreynolds/gridsome-source-wordpress`\n- `npm install @travisreynolds/gridsome-source-wordpress`\n\n## Usage\n\n```js\nmodule.exports = {\n  plugins: [\n    {\n      use: '@travisreynolds/gridsome-source-wordpress',\n      options: {\n        baseUrl: '\u003cWEBSITE_URL\u003e', // required\n        apiBase: 'wp-json',\n        typeName: 'WordPress',\n        images: true\n      }\n    }\n  ],\n  templates: {\n    WordPressPost: '/:year/:month/:day/:slug'\n  }\n}\n```\n\n## Options\n\n| Option | Explanation | Default |\n|-|-|-|\n| `baseUrl` | The base URL of your WordPress instance. This is required, and must include the protocol used. |  |\n| `apiBase` | The API base for your WordPress instance - this may change if you are using wordpress.com for example. | `wp-json` |\n| `typeName` | The base name used to prefix all created types. | `WordPress` |\n| `hostingWPCOM` | Change this to `true` if your site is hosted on wordpress.com, and set `baseUrl` to your site name (e.g. `staticsitegeneration.wordpress.com`) | `false` |\n| `perPage` | The amount of items that will be fetched per API call - minimum of 1, and maximum of 100. | `100` |\n| `concurrent` | The amount of API calls that will run at once. | `8` |\n| `images` | Whether to download images locally to be used with `g-image`. This can also be an object, with options to keep the original file path/name, cache images, and change the download folder. | `{ original: true, folder: '.images/wordpress', cache: true }` |\n| `content` | Whether to transform content fields of posts, to update any internal links, and download any images in the post content. It can also be an object, with the option to set the fields to transform, or disable one of the two operations. | `{ links: ['content'], images: true }` |\n\n## Use with Advanced Custom Fields\n\nInstall the [ACF to REST API](https://github.com/airesvsg/acf-to-rest-api) plugin to make ACF fields available in the GraphQL schema.\n\n### Tips\n\n**Exclude unnecessary data from ACF fields**\n\nGridsome needs the `Return format` set to `Post Object` for `Post Object` relations in order to resolve references automatically. But Gridsome only need the `post_type` and `id` to set up a working GraphQL reference. Use the filter below to exclude all other fields.\n\n```php\nadd_filter( 'acf/format_value', function ( $value ) {\n  if ( $value instanceof WP_Post ) {\n    return [\n      'post_type' =\u003e $value-\u003epost_type,\n      'id'        =\u003e $value-\u003eID,\n    ];\n  }\n\n  return $value;\n}, 100 );\n```\n\n## Use Custom REST Endpoints\n\nTo use REST endpoints from plugins or defined in your theme add a `customEndpoints` array to source-wordpress options.\n\n\n```js\n  use: '@gridsome/source-wordpress',\n  options: {\n    ... // other source-wordpress options\n    customEndpoints: [\n      {\n        typeName: \"Menu\",\n        route: 'myApi/v1/menus',\n      }\n    ]\n  }\n```\n\nIf you are trying to query posts, you will need to add the `normalize: true` option to make sure the data is properly added:\n\n```js\n  customEndpoints: [\n    {\n      typeName: \"Posts\",\n      route: \"/wp/v2/posts\",\n      normalize: true\n    }\n  ]\n```\n\n## Create Collections based on REST Endpoints\n\n`customEndpoints` allow you to neatly create separate [Collections](https://gridsome.org/docs/collections/#collections) by querying different REST endpoints.\n\n```js\n  customEndpoints: [\n    {\n      typeName: \"Collection1\",\n      route: \"/wp/v2/posts?categories=\u003ccategory_id\u003e\",\n      normalize: true\n    },\n    {\n      typeName: \"Collection2\",\n      route: \"/wp/v2/posts?tags=\u003ctag_id\u003e\",\n      normalize: true\n    }\n  ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftravis-r6s%2Fgridsome-source-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftravis-r6s%2Fgridsome-source-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftravis-r6s%2Fgridsome-source-wordpress/lists"}