Socket
Socket
Sign inDemoInstall

strapi-plugin-publisher

Package Overview
Dependencies
291
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    strapi-plugin-publisher

A plugin for Strapi Headless CMS that provides the ability to schedule publishing for any content type.


Version published
Weekly downloads
3K
increased by5.42%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

strapi-plugin-publisher

A plugin for Strapi that provides the ability to easily schedule publishing and unpublishing of any content type.

Downloads Install size Package version

Requirements

The installation requirements are the same as Strapi itself and can be found in the documentation on the Quick Start page in the Prerequisites info card.

Supported Strapi versions

  • v4.x.x

NOTE: While this plugin may work with the older Strapi versions, they are not supported, it is always recommended to use the latest version of Strapi.

Installation

npm install strapi-plugin-publisher

or

yarn add strapi-plugin-publisher

Configuration

Enable the plugin

The plugin configuration is stored in a config file located at ./config/plugins.js. If this file doesn't exists, you will need to create it.

A sample configuration

module.exports = ({ env }) => ({
  // ..
	'publisher': {
		enabled: true,
		config: {
			hooks: {
				beforePublish: async ({ strapi, uid, entity }) => {
					console.log('beforePublish');
				},
				afterPublish: async ({ strapi, uid, entity }) => {
					console.log('afterPublish');
				},
				beforeUnpublish: async ({ strapi, uid, entity }) => {
					console.log('beforeUnpublish');
				},
				afterUnpublish: async ({ strapi, uid, entity }) => {
					console.log('afterUnpublish');
				},
			},
		},
	},
	// ..
});

The Complete Plugin Configuration Object

PropertyDescriptionTypeDefaultRequired
actionsSettings associated with any actions.Object{}No
actions.syncFrequencyThe frequency to check for actions to run. It is a cron expressionString'*/1 * * * *'No
componentsSettings associated with any of the plugins componentsObject{}No
components.dateTimePickerSettings associated with the DateTimePicker component used to set action timesObject{}No
components.dateTimePicker.stepThe step between the numbers displayed for the time section of the DateTimePickerNumber1No
components.dateTimePicker.localeAllows to enforce another locale to change the date layoutStringbrowser localeNo
hooks.beforePublishAn async function that runs before a content type is publishedFunction() => {}No
hooks.afterPublishAn async function that runs after a content type is publishedFunction() => {}No
hooks.beforeUnpublishAn async function that runs before a content type is un-publishedFunction() => {}No
hooks.afterUnpublishAn async function that runs after a content type is un-publishedFunction() => {}No
contentTypesA list of content type uids where the publish actions should be displayedArrayAll content typesNo

Enable server cron

The cron.enabled configuration option needs to be set to true in Server Configuration for the plugin to work.

Usage

Once the plugin has been installed, configured and enabled a Publisher section will be added to the informations section of the edit view for all content types (single + collection) that have draftAndPublish enabled. The Publisher section will provide the ability to schedule publishing and unpublishing of the content type. The content type publication status is checked every minute.

If the Publisher section does not appear in the admin after the plugin is enabled then a clean rebuild of the admin is required. This can be done by deleting the generated .cache and build folders and then re-running the develop command.

Single Content Type

Sample single content type publisher section

Collection Content Type

Sample collection content type publisher section

Adding a (un)publish date

Navigate to the entity record that should be (un)published, under the informations section click the Add a (un)publish date button. Enter in the date and click save, the entity record will then be (un)published at the specified time.

default

Add a (un)publish date

Editing a (un)publish date

Navigate to the entity record that requires its date changed, under the informations section click the Edit (un)publish date button. Enter in the new date and click save.

Edit a (un)publish date

Deleting a (un)publish date

Navigate to the entity record that contains the date that should be removed, under the informations section click the Delete (un)publish date button.

Delete a (un)publish date

Bugs

If any bugs are found please report them as a Github Issue

Keywords

FAQs

Last updated on 17 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc