How to Setup Grav Flat-File Based CMS in a Hosting Server

December 10, 2014 | By
| Reply More

Grav is a Fast, Simple, powerfull, and Flexible file-based Modern CMS which means it doesn't use databases to store informations, it uses files to store its configurations and contents.

grav

It requires no installation, you just extract the ZIP archive, and you are already up and running your site. It follows similar principles to other flat-file CMS platforms, but has a different design philosophy than most. Moreover, it is Free and Open Source Product which source codes are available in Github.

The underlying architecture of Grav has been designed to use well established and best-in-class technologies, where applicable, to ensure that Grav is simple to use and easy to extend.

For technology, Grav uses several of the external technology:

  • Twig for templating
  • Markdown for content creation
  • YAML for configuration
  • Doctrine Cache for performance

So, Here are some easy steps below to setup and configure your Grav Modern CMS:-

1. Get your Grav Package

You can download Grav's zip package from their official download site:

http://getgrav.org/downloads

 

getgrav

And Then extract it to your Webroot. (Note: webroot is the location where your sites are hosted)

Note: If you downloaded the ZIP file and then plan to move it to your webroot, please move the ENTIRE FOLDER because it contains several hidden files (such as .htaccess) that will not be selected by default. The omission of these hidden files can cause problems when running Grav.

2. Configure your Web Server (Apache/Nginx)

Using Grav with a web server such as Apache or Nginx is as simple as extracting Grav into a folder under the webroot. All it requires to function is PHP 5.4 or higher, so you should make sure that your server instance meets that requirement. More information about Grav requirements can be found in the requirements page of Grav.

Note: If your web root is, for example, ~/public_html then you could extract it into this folder and reach it via http://localhost. If you extracted it into ~/public_html/grav you would reach it via http://localhost/grav.

PHP's built-in Web Server

Grav is incredibly easy to set up and get running. You can do this without even installing or configuring a web server! Be sure you have at least PHP version 5.4 by going to the terminal and typing:

$ php -v

This should report the version and build information. For example:

To try Grav, simply navigate to the folder where you extracted your Grav Base package file in your terminal and type:

$ php -S localhost:8000

This runs the built-in PHP web server. Then, point your browser to http://localhost:8000 and you should see your Grav site.

installed-grav3. Add Contents

To add contents to the pages, you will need a text editor. Path for the hompage can be configured from user/config/system.yaml

To create content, go to the /user/pages/ folder. The homepage is inside the /01.home/ folder.

grav-pages

To create a new page, you duplicate that home folder. In my case, I duplicated the folder to /02.services/.

grav-pages

Now, you need to edit the default.md so that you can make changes to the page "services", the file which looks like this:

The contents are created in easy Markdown Languages.

If your theme allowed it, you can have a blog.md or a portfolio.md and use different layouts depending on the file name you chose.

4. Skeletons and Themes

You can get "Skeletons" available on their site which  are like Drupal distributions: pre-packaged versions for particular purposes

There are two part for the themes, they are :

  • blueprints.yaml: This is the main configuration file for the theme.
  • /templates/: This folder contains all the layout files for the theme.

Inside the /templates/ folder, the Grav themes are stored there. It is powered by Twig, which is also the theme engine used in Drupal 8.

Note: For plugins: There are about 20 plugins in the Grav's site.

Filed Under : LINUX HOWTO, OPEN SOURCE TOOLS, WEB SERVERS

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.