Getting started with Grav
Installation
If you decide to use this CMS, you must first check the PHP version. For a successful installation, you need PHP version 7.3.6+. Then you can start the installation. There are three options:
From the ZIP package. You need to download the latest Grav version and extract the ZIP file in the web root of the web server.
With Composer.
composer create-project getgrav/grav ~/webroot/grav
To try out the latest version, you must add 1.x-dev as an additional parameter.
composer create-project getgrav/grav ~/webroot/grav 1.x-dev
From GitHub. You need to clone the Grav repository from GitHub into the web server's webroot folder ~/webroot/grav. Run a terminal and change to the root directory of the web server.
cd ~/webroot
git clone -b master https://github.com/getgrav/grav.git
You should install provider dependencies with Composer.
cd ~/webroot/grav
composer install --no-dev –o
You need to install plugins and design dependencies with the Grav CLI application bin/grav.
cd ~/webroot/grav
bin/grav install
This allows you to clone the required dependencies from GitHub directly into the Grav installation.
Configuring the start page
This file, user/config/system.yaml, specifies the location of the start page, http://yoursite.com.
When examining this configuration file in the installation, the alias for /home is already displayed.
Editing web pages
Thanks to the support of Markdown syntax, the computer can easily analyze the texts and convert them to HTML. To edit the content, you must open the start page in a text editor. The file that controls the start page is located in the user/pages/01.home/ folder. It is called default.md. All content is created in the user/pages/ folder. When editing in a text editor, the content looks like this:
---
title: Home
body_classes: title-center title-h1h2
---
# Say Hello to Grav!
## installation successful...
Congratulations! You have installed the **Base Grav Package** that provides a **simple page** and the default **Quark** theme to get you started.
!! If you see a **404 Error** when you click `Typography` in the menu, please refer to the [troubleshooting guide](https://learn.getgrav.org/troubleshooting/page-not-found).
Between --- are the indicators for page headers. They are written in a simple format (YAML). The configuration block in the .md file is known as YAML front matter.
title: Home
body_classes: title-center title-h1h2
This block displays the HTML title tag for the page (the text you see in the browser tab). It can be accessed via the page.title attribute. With Standard Header, you can configure different variants for the page. Via menu: Something, you can overwrite the text that is displayed as the name of a web page in the menu. Grav normally uses the following title for the menu value.
# Say Hello to Grav!
## installation successful...
The title is displayed in Markdown using # or hash syntax.
# with a space and then text in <h1> header in HTML.
## or double hash are converted to <h2> tags. The maximum number of levels that can be specified is the HTML-valid <h6> tag (######).
Paragraphs are displayed with <p> tags. Bold text is indicated with ** or <strong>.
You can mark text with symbols (exclamation marks from ! to !!!!).
Adding a new website
Creating a new website is very easy with Grav.
- You need to create a new folder under user/pages/. The new folder can be named, for example, 03.mypage.
-
In the text editor, create a new file and add some code. Here is an example:
---
title: My New Page
---
# My New Page!
This is the body of **my new page** and I can easily use _Markdown_ syntax here.
-
Next, save the file in the user/pages/03.mypage/folder as default.md. It is necessary to render the default template in the current theme:
user/themes/quark/templates/default.html.twig.
- The newly created page will appear in the menu at the top when the browser is restarted.