plugins > medusa-plugin-static-pages

medusa-plugin-static-pages

Documentation

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?

  1. Install the package with yarn add medusa-plugin-static-pages or npm i medusa-plugin-static-pages
  2. In medusa-config.js, add the plugin to the plugins array and set enableUI
  3. const plugins = [
      // ... other plugins
      {
        resolve: `medusa-plugin-static-pages`,
        options: {
          enableUI: true
        }
      }
    ]
    
  4. Run migrations, e.g. npx medusa migrations run (see: https://docs.medusajs.com/development/entities/migrations/overview) as the plugin uses new tables.
  5. 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

API Endpoints

Store API Endpoints

  1. GET /store/pages
    • Description: Returns a JSON object containing an array of all page objects.
  2. GET /store/page/:handle
    • Description: Returns a JSON object containing a single page object with the given handle.
  3. GET /store/page/:id
    • Description: Returns a JSON object containing a single page object with the given ID.

Admin API Endpoints

  1. 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.
  2. 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.
  3. 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