Publication workflow "workaround" in Strapi

Introduction

In this article, I will be explaining what Strapi is, what publication workflow is, and the workaround in Strapi. I will also be talking about the importance of the publication workflow “workaround” in Strapi, with a brief explanation and features with installation when required.

Overview of Strapi

Strapi is an open-source headless CMS for creating quick and readily manageable JavaScript APIs. It allows developers to create flexible API structures with a beautiful user interface easily.

Strapi can be used with a variety of databases, including MongoDB, PostgreSQL, and many others.

Strapi enables users to consume APIs from a content type via GET, POST, DELETE, and PUT requests, mostly performed manually.

What is a Publication Workflow?

The term " workflow" refers to all of the actions and procedures that must be completed to obtain the desired result. The successful dissemination of high-quality content is the final step in publishing. As a result, a publishing workflow encompasses everything that must occur for a publication to take place.

Publication Workflow "Workaround" In Strapi

Importance of Publication workflow

  • RBAC

  • Dynamic Zones

  • Providers

  • Draft and Publish.

  • Internationalization in Strapi.

RBAC:

This refers to Role Based Access Control, which is a group of operations and permissions that you can grant to users. Assigning permissions to users or user groups is more complicated than using roles to add, delete, or modify permissions. Roles become especially helpful as the size and complexity of your user base grows.

The three roles in Strapi Community Edition are:

  • Super Admins: The Super Admins have access to and control over all features and settings.

  • Editor: The Editor can edit, publish, and manage user-generated content.

  • Authors: The authors are limited to managing and publishing the information they have produced.

Settings for roles and permissions

You may configure all of your users in the Permissions settings' User section, where you can find them all. You will have access to a created URL link upon user creation that you can provide to your new user to complete their registration.

Dynamic zones

Teams may design reusable content models with the least number of changes feasible with Dynamic Zones, a brand-new native Strapi feature.

Dynamic zones are areas of your application where you let content editors choose dynamically what component to include, so when you design the application, you define which components can be included in a dynamic zone when creating each content instance(e.g. the homepage), editors decide which component to select for that zone.

A dynamic zone includes one or more components.

Providers

Providers extend the plugin's essential capabilities, such as uploading media files to Rackspace instead of the local server or using Amazon SES for emails instead of Sendmail.

Certain plugins can be enhanced by installing and configuring additional providers.

NOTE:

Currently, only the Upload and Email plugins are designed to operate with providers.

  • Installing Providers in Strapi

The following format can be used to install new providers with npm or yarn @strapi/provider-<plugin>-<provider> --save.

For example to install providers using the Aws S3

# Install the AWS S3 provider for the Upload plugin

npm install @strapi/provider-upload-aws-s3 --save

# Install the Sendgrid provider for the Email plugin

npm install @strapi/provider-email-sendgrid --save

  • Configuring providers

In the. /config/plugins.js file, newly installed providers are enabled and configured. If this file does not already exist, it must be created.

Each provider will have a unique set of configuration options. To learn more, go to the corresponding entry for that provider in the Marketplace or npm (opens a new window).

// path: ./config/plugins.js
module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: 'aws-s3', // For community providers, pass the full package name (e.g. provider: 'strapi-provider-upload-google-cloud-storage')
      providerOptions: {
        accessKeyId: env('AWS_ACCESS_KEY_ID'),
        secretAccessKey: env('AWS_ACCESS_SECRET'),
        region: env('AWS_REGION'),
        params: {
          Bucket: env('AWS_BUCKET'),
        },
      },
    },
  },
  // ...
});

You can check here for the configuration of the email plugins and how to create providers after installation.

Strapi's default security middleware includes a very stringent content security policy that limits loading images and media to "self" only; for more information, see the example setup on the provider page (opens in a new window) or the middleware documentation.

Draft and Publish

This Draft and Publish feature allows you to leave your content as a draft and publish it at a later time using the draft and publish tool.

The draft and publish feature is by default turned on for all newly generated collections and single types. However, the feature can be turned off at the content-type level (i.e., it can be enabled for one content-type but disabled for another).

To use the Draft and Publish feature in Strapi, you need to have your content-type already created. You can create a collection type using the collection type builder plugin.

Once you are done with that, from the sidebar, navigate through Content Manager > Select Collection Type and click on Create a New Entry. Fill in the input you want to display and click on the Save button. Now we are done with the draft.

The next step is to publish your article, and you do so by just clicking on the publish button beside the save button. Yes, you are done publishing your article. That is how to use the draft and publish a feature in Strapi.

image by David Fagbuyiro

To deactivate the draft and publish features for a content-type:

  • Select Content-type Builder under Plugins, from the sidebar.

  • Choose the collection or individual type for which you wish to disable the draft and publish function.

  • To access the content-configurations, type's click the Edit button.

  • Select "Advanced Settings" from the tab.

  • Select the FALSE option in the DRAFT/PUBLISH area.

  • To confirm the feature's removal, click the Finish button.

image by David Fagbuyiro

NOTE

Some roles and permissions may be necessary for publishing content. For instance, the default roles in the Community version only permit authors to generate and edit drafts, whereas editors are allowed to publish content.

Unpublishing content

The published content may be taken down and reverted to draft status.

Click on the Unpublish button in the content editor's top right corner to remove content from publication.

Internationalization in Strapi

Strapi users can develop, manage, and distribute localized content in several languages, or "locales," using the Internationalization (i18n) plugin. Refer to the W3C definition for more details on the idea of internationalization.

The i18n plugin: allows admin panel users to generate several localized versions of their content (see user guide); permits developers to create localized projects by collecting and consuming the appropriate content based on the user's country/language.

All Strapi applications running version 3.6.0 or higher include the Internationalization plugin by default. Lower versions require a migration (see Update Strapi version) as well as manual installation of the plugin.

The plugin can be installed using the Terminal by running one of the following commands:

npm run strapi install i18n

Features of Internationalization (I18n)

  • Flexibility

It uses various components and modifies the structure of each locale as well as dynamic zones.

  • Clear Navigation

When reviewing the list of contents or updating an entry, you can easily switch between locales.

  • Smooth Editing

With a single click, you can copy and paste text from one locale to another. keeping some content consistent across all locales.

How to add a new language to Locales:

Now let's add “Spanish” to our language locales.

  • Click on “Settings” under the “General” section

  • Click on “internationalization” right under “Global Settings”.

  • Click on “Add new Locale”

  • Select “Spanish (es)” in the Locales section and then save.

Conclusion

I hope after going through this article you now understand and know what publication workflow “workaround” in Strapi entails, the importance of publication workflow “workaround” in Strapi, some features of importance, and the main roles of the users in the Strapi community edition according to RBAC and installation of the internationalization plugin, and also add a new language to our locales. For more information on the importance of the publication workflow “workaround” in Strapi, please visit the Strapi V4 documentation.