medusa-plugin-static-pages
If you are not familiar with Medusa, you can learn more on the project web site.
Note: This plugin is under development and should be considered experimental. Breaking changes are very likely to occur.
What is it?
A plugin that provides implementation of static pages for your Medusa store. You can use this plugin for creating static pages like FAQ, Policy etc. quite easily for your store.
How to install?
- Install the package with
yarn add medusa-plugin-static-pages
ornpm i medusa-plugin-static-pages
- In
medusa-config.js
, add the plugin to theplugins
array and setenableUI
- Run migrations, e.g.
npx medusa migrations run
(see: https://docs.medusajs.com/development/entities/migrations/overview) as the plugin uses new tables. - Start project
- After installation of the plugin, you will see a new option on the sidebar named Static Pages.
- You can check existing static pages
- You can add/edit/delete static pages
const plugins = [
// ... other plugins
{
resolve: `medusa-plugin-static-pages`,
options: {
enableUI: true
}
}
]
API Endpoints
Store API Endpoints
GET /store/pages
- Description: Returns a JSON object containing an array of all page objects.
GET /store/page/:handle
- Description: Returns a JSON object containing a single page object with the given handle.
GET /store/page/:id
- Description: Returns a JSON object containing a single page object with the given ID.
Admin API Endpoints
POST /admin/page
- Description: Creates a new page object.
- Request Body:
handle
: (Required) The handle for the page.title
: (Required) The title of the page.metadata
: (Optional) Additional metadata for the page.body
: (Optional) The content of the page.
POST /admin/page/:id
- Description: Updates an existing page object with the given ID.
- Request Body:
handle
: (Required) The updated handle for the page.title
: (Required) The updated title of the page.metadata
: (Optional) Updated metadata for the page.body
: (Optional) The updated content of the page.
DELETE /admin/page/:id
- Description: Deletes an existing page object by ID.
Objects
page: {
"id": "string",
"handle": "string",
"title": "string",
"metadata": "string",
"body": "string",
"created_at": "DateTime",
"updated_at": "DateTime"
}
Proposals, Bugs, Improvements
If you have an idea for what could be the next highest priority functionality, do not hesitate to raise an issue here: Github issues.
License
MIT
© 2024 abdullah-afzal