{"id":16346556,"url":"https://github.com/madeleineostoja/wordprismic","last_synced_at":"2025-03-20T23:32:47.288Z","repository":{"id":40746869,"uuid":"189973125","full_name":"madeleineostoja/wordprismic","owner":"madeleineostoja","description":"Utility to import existing Wordpress blogs into the Prismic.io content platform","archived":false,"fork":false,"pushed_at":"2022-06-25T00:44:26.000Z","size":36,"stargazers_count":31,"open_issues_count":6,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T00:35:45.667Z","etag":null,"topics":["importer","migration-tool","prismicio","wordpress","wordpress-api"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/madeleineostoja.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":"2019-06-03T09:16:08.000Z","updated_at":"2023-08-14T10:03:07.000Z","dependencies_parsed_at":"2022-08-19T20:20:40.954Z","dependency_job_id":null,"html_url":"https://github.com/madeleineostoja/wordprismic","commit_stats":null,"previous_names":["tomorrowstudio/wordprismic"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeleineostoja%2Fwordprismic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeleineostoja%2Fwordprismic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeleineostoja%2Fwordprismic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeleineostoja%2Fwordprismic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madeleineostoja","download_url":"https://codeload.github.com/madeleineostoja/wordprismic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221810224,"owners_count":16884070,"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":["importer","migration-tool","prismicio","wordpress","wordpress-api"],"created_at":"2024-10-11T00:35:38.241Z","updated_at":"2024-10-28T08:53:47.539Z","avatar_url":"https://github.com/madeleineostoja.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wordprismic\n\n[![npm](https://img.shields.io/npm/v/wordprismic.svg)](https://npmjs.com/package/wordprismic)\n\nWordprismic is a small and fully configurable Node utility for importing existing Wordpress blogs into the [Prismic.io](https://prismic.io) content platform.\n\n\n## Requirements\n\nMake sure you meet the following requirements before using the importer:\n\n- Wordpress's REST API enabled (included and auto-enabled in core from WP 4.4+)\n- Both Node 7.6+ and Ruby installed\n- Any Wordpress plugins that add or change content models (eg: Advanced Custom Fields, YOAST, etc) hooked up to the REST API, via plugins or otherwise\n\n## Configuration\n\nCreate a JavaScript configuration file with the following properties\n\nProperty                            | Description\n------------------------------------|----------------------------------------------------------------------------------------------------------------------------------\n`wordpress.url`                     | The full URL of your wordpress blog\n`prismic.repo`                      | The name of your Prismic repository\n`prismic.locale`                    | The locale of language locale of your imported documents in Prismic (see Settings -\u003e Translations \u0026 locales)\n`prismic.categoriesType` (optional) | The content type of post categories in prismic, if available\n`optimizeMediaRequests` (optional)  | Whether to attempt to only fetch required media assets. Shortens import time, but can cause 503 errors on some Wordpress servers.\n`schema`                            | A function to transform Wordpress data to your Prismic content model, see documentation below\n\n```js\nmodule.exports = {\n  wordpress: {\n    url: 'https://myblog.com'\n  },\n  prismic: {\n    repo: 'myNewBlog',\n    locale: 'en-au',\n    categoriesType: 'category'\n  },\n  optimizeMediaRequests: false,\n  schema: async function(post, html) {\n    return {\n      type: 'post',\n      uid: post.slug,\n      category: {\n        id: post.categories[0].prismic.id,\n        mask: 'category'\n      },\n      author: post.author.name,\n      title: html.decode(post.title.rendered),\n      featured_image: {\n        origin: {\n          url: post.featured_media.guid.rendered\n        },\n        alt: post.featured_media.alt_text\n      },\n      excerpt: await html.parse(post.excerpt.rendered),\n      content: await html.parse(post.content.rendered)\n    };\n  }\n};\n```\n\n### Defining your schema\n\nThe config schema describes how your Wordpress posts map to your Prismic content model. It's written as a function that is given two paramaters:\n  1. The imported post from Wordpress\n  2. Helper functions `html.parse()`, which creates Prismic RichText objects out of HTML strings, and `html.decode()`, which decodes HTML strings with entities\n\nSee the Wordpress [Posts API Reference](https://developer.wordpress.org/rest-api/reference/posts/#schema) for all properties available on the `post` object provided. However, the following properties on `post` have been **changed by Wordprismic**:\n- `author` is the full [user object](https://developer.wordpress.org/rest-api/reference/users/#schema), rather than just the ID\n- `featured_media` is the [media object](https://developer.wordpress.org/rest-api/reference/media/#schema) object of the asset, rather than just the ID\n- Each item in `categories` has been populated with a matching Prismic category if it's available (from `prismicCategories` type in config) as follows: `{ wordpress: [category], prismic: [document] }`\n\nThe `html.parse()` function is **asynchronous**, so make sure you `await` it and flag your schema as `async`.\n\n## Importing\n\nYou can now run the importer directly from NPM, with the following arguments\n\nArgument          | Description\n------------------|-------------------------------------------------------------------------\n`--config` (`-c`) | Path to your config file\n`--dest` (`-d`)   | Location to save zip archive for imorting, defaults to current directory\n\n```sh\nnpx wordprismic -c ./path/to/config.js\n```\n\nOr if you'd prefer, install the module globally first\n\n```sh\nnpm i -g wordprismic\n\nwordprismic -c ./path/to/config.js\n```\n\nYour new Prismic posts will be saved to in a folder called `wordprismic-import`. Compress the **contents** (not the folder itself) to a `.zip` archive, then import it to Prismic.\n\n---\n\n© MIT [Tomorrow](https://www.tomorrowstudio.co)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeleineostoja%2Fwordprismic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadeleineostoja%2Fwordprismic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeleineostoja%2Fwordprismic/lists"}