bolt-cms

using bolt cms for single page app


I want to use bolt as a headless cms. My plan is to create a template based on vue.js and load the content utilizing the bolt plugin jsonAPI. But I'm struggling with the theme and config settings. I want to disable all routing in the CMS and return only a static html with css and js files.


Solution

  • I think your problem could be solved by the following alternative solution :

    Use different domain

    Put your vue SPA app in yourdomain.com and put your bolt as RESTAPI provider in subdomain.yourdomain.com. Since it's a subdomain, you would not face any CORST problem, and you can follow common tutorial how to setup bolt cms and how to build vuejs SPA.


    Use vuejs SPA in bolt cms template

    Assume you develop vuejs SPA using webpack, you have to setup asset public path as bolt template location, the configuration file is in your-vue-directory/config/index.js

    module.exports = {
      build: {
        assetsPublicPath: '/theme/your-theme/',
        ......
      },
    }
    

    Then after finish build the app, you can copy your build files from your-vue-directory/dist into your-bolt-directory/public/theme/your-theme

    But using this solution, if you're using vue-router, i think you cannot use 'history'mode since all of the routing will be handled by bolt cms. The only possible router-mode is 'hash'.