Giter VIP home page Giter VIP logo

website-preview's Introduction

Getting Started

The plugin can be used in strapi version above 4.4 (versions that support custom fields).

To Install

  1. Go into your strapi project.

  2. Run the npm command npm i strapi-plugin-website-preview or yarn add strapi-plugin-website-preview

  3. The plugin will be added to your strapi project.

Inorder to achieve the url of the website developing it must be specified in the .env file as STRAPI_ADMIN_FRONT_END_URL. This url need to be the base url of the website.

Adding & Accessing URL

  1. Add this to the STRAPI_ADMIN_FRONT_END_URL="YOUR_BASE_URL_HERE" .env file of your project.

  2. Run the command npm build or yarn build

How To Use

  1. Create a new field form a content type.

  2. Select custom fields.

  3. Page Preview field will appear there.

  4. Select this field and name it accordingly ("page_preview" is used commonly for more understanding) and save.

  5. Select the content type from the content manager.

  6. Add end point of the page in the page_preview field and save.

  7. Click on the preview button then the page will be pop up.

How To Add URL

To Add an external url you will need to alter the middleware.js file as follows.

Add this code into config/middlewares.js

module.exports  = [
    'strapi::errors',
    {
        name:  "strapi::security",
        config:  {
           contentSecurityPolicy:  {
           useDefaults:  true,
           directives:  {
             'frame-src':["'self'","https://www.wikipedia.org/"],
             'frame-ancestors':  null,
             upgradeInsecureRequests:  null,
                                   },
                          },
       frameguard:  false,
                 },
    },
    'strapi::cors',
    'strapi::poweredBy',
    'strapi::logger',
    'strapi::query',
    'strapi::body',
    'strapi::session',
    'strapi::favicon',
    'strapi::public',
];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.