Git Product home page Git Product logo

casper-cms-template's Introduction

Victor Hugo CMS Template

Deploy to Netlify

casper theme image

A Hugo boilerplate for creating truly epic websites

This is a boilerplate for using Hugo as a static site generator and Gulp + Weback as your asset pipeline.

It's setup to use post-css and babel for CSS and JavaScript.

Usage

Be sure that you have the latest node, npm and Hugo installed. If you need to install hugo, run:

Clone this repository and run:

npm install
npm start

Then visit http://localhost:3000/ - BrowserSync will automatically reload CSS or refresh the page when stylesheets or content changes.

To build your static output to the /dist folder, use:

npm run build

Structure

|--site                // Everything in here will be built with hugo
|  |--content          // Pages and collections - ask if you need extra pages
|  |--data             // YAML data files with any data for use in examples
|  |--layouts          // This is where all templates go
|  |  |--partials      // This is where includes live
|  |  |--index.html    // The index page
|  |--static           // Files in here ends up in the public folder
|--src                 // Files that will pass through the asset pipeline
|  |--css              // CSS files in the root of this folder will end up in /css/...
|  |--js               // app.js will be compiled to /js/app.js with babel

CMS

How it works

Netlify CMS is a single-page app that you pull into the /admin part of your site.

It presents a clean UI for editing content stored in a Git repository.

You setup a YAML config to describe the content model of your site, and typically tweak the main layout of the CMS a bit to fit your own site.

Setup GitHub as a Backend

In the config.yml file change the GitHub owner and repo to reflect your repo:

backend:
  name: github
  repo: owner/repo # Path to your Github repository
  branch: master # Branch to update (master by default)
  
  ...

When a user navigates to /admin she'll be prompted to login, and once authenticated she'll be able to create new content or edit existing content. The default Github-based authenticator integrates with Netlify's Authentication Provider feature and the repository backend integrates directly with Github's API.

To get everything hooked up, setup continuous deployment from Github to Netlify and then follow the documentation to setup Github as an authentication provider.

That's it, now you should be able to go to the /admin section of your site and log in.

Find out more and contribute

Visit the Netlify CMS to find out more and contribute.

Basic Concepts

You can read more about Hugo's template language in their documentation here:

https://gohugo.io/templates/overview/

The most useful page there is the one about the available functions:

https://gohugo.io/templates/functions/

For assets that are completely static and don't need to go through the asset pipeline, use the site/static folder. Images, font-files, etc, all go there.

Files in the static folder ends up in the web root. So a file called site/static/favicon.ico will end up being available as /favicon.ico and so on...

The src/js/app.js file is the entrypoint for webpack and will be built to /dist/app.js.

You can use ES6 and use both relative imports or import libraries from npm.

Any CSS file directly under the src/css/ folder will get compiled with PostCSS Next to /dist/css/{filename}.css. Import statements will be resolved as part of the build

Deploying to netlify

Now netlify will build and deploy your site whenever you push to git.

Enjoy!!

License

MIT

casper-cms-template's People

Contributors

bdougie avatar covingtondoan avatar eduplessis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

casper-cms-template's Issues

Invitation to create account

Hi, when I use this template I receive an email to create an account but the link doesn't work.

How do I enable the default invitation/password user creation for the CMS?

I don't want to use Github OAuth solution, just the default one

README - Project Set Up issues

Hello!

I think I followed the set-up instruction closely, but I'm having a problem when I try to either view the current posts in the blog or create a new post.

After I visit the admin page of the new site I created (alexjrolfe.netlify.com/admin) and login, clicking on the 'Blog' section on the side panel leads to an endless load. When I try to create a sample entry I get the error alert 'Failed to persist entry'.

I have continuous deployment setup with netlify and github is setup as the authentication provider as well.

I altered the config.yml to the following:

backend:
  name: github
  repo: rolfea/casper-cms-template # Path to your Github repository
  branch: master # Branch to update (master by default)

I'm guessing I missed something in the setup. If I can get some help figuring this out, I'd be happy to submit a PR to make the documentation a little more clear.

error "Failed to load external module @babel/register"

I have this error when I launch npm start from the command line.

[18:32:28] Failed to load external module @babel/register
[18:32:28] Requiring external module babel-register
fs.js:27
const { Math, Object } = primordials;
                         ^

ReferenceError: primordials is not defined
    at fs.js:27:26
    at req_ (E:\projects\casper-cms-template\node_modules\natives\index.js:143:24)
    at Object.req [as require] (E:\projects\casper-cms-template\node_modules\natives\index.js:55:10)
    at Object.<anonymous> (E:\projects\casper-cms-template\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Object.require.extensions.<computed> [as .js] (E:\projects\casper-cms-template\node_modules\babel-register\lib\node.js:152:7)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `gulp server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\optim\AppData\Roaming\npm-cache\_logs\2020-02-02T17_32_28_448Z-debug.log

I'm on windows 10, the npm version is 6.13.7 and the gulp version is 3.9.1 and the gulp cli is 2.2.0.

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.