Continuing the story about CMS Grav. If you set up the same skeleton as I did, it will be quite easy to follow along since I will be doing everything right before your eyes. If not, you’ll have to figure it out on your own, and this article will only serve to show the logic (or lack thereof). So, let’s get started.

Simplicity was not included…

Although this CMS is positioned as an extremely simple solution, using it, in my opinion, is somewhat more difficult than WordPress.

Step one. This header is clearly unnecessary; I think we should change it. Go to the admin panel → Settings → Site. Just change the header to the desired one. Hmm, something went wrong. Why is that?

CMS Grav Headline
Grav headline

Using the developer tools in the browser, we find the problem.

Chrome Developer Tool

So, we need to change the font size to 1em, for example. We go to the good old main.css. In the previous article, I mentioned where it is located. We just need to change the value:

font-size: 2em;

to:

font-size: 1em;

Great, now everything looks fine. Let’s move on, I recommend looking at the date. As you can see, the month is displayed in English. If it suits you, don’t touch it; if not, we work on the problem. I decided to replace it with a number. Of course, it’s not entirely clear, but for now, I don’t know how to replace the month names with Russian ones.

Website on CMS Grav

Let’s keep it simple:

  1. Go to themes/striped/templates/partials.
  2. Find the file blog.item.html.twig and replace the capital letter “M” with a lowercase one. Done.
Date format in CMS Grav

The result will look like this:

Result

In the same file, we find the line:

<li><a href="https://twitter.com/share"  data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon fa-twitter"><i class="fa fa-circle-o-notch fa-spin"></i></a></li>

When sharing on Twitter, a new tab should open, so let’s do this:

<li><a href="https://twitter.com/share" target="_blank"  data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon fa-twitter"><i class="fa fa-circle-o-notch fa-spin"></i></a></li>

Essentially, we just added the parameter target=_blank to the link.

Now we need to do something with the navigation buttons for the posts and opening articles.

Previous post

Go back to the file blog.item.html.twig. As you can see in the screenshot, I have already changed the text on the read more button.

CMS Grav navigation buttons

But below there is the text Next Post. Relentlessly change it to “Next Post” in Russian. And similarly, replace Previous Post with “Previous Post” in Russian. Done. Moving on.

Now let’s take a piercing look at the sidebar, where complete chaos reigns. Here we’ll have to tinker a bit.

In the partials folder, open the file sidebar.html.twig and start making relentless edits. The essence is the same. Replace the names with Russian ones, remove something, add something. At the end of the page are the copyrights. They can be completely removed.

Grav sidebar

As you can see, it’s quite simple. But we’re not done yet.

We change the date archives output. The month names in English are unnecessary. Open the file archives.html.twig and make some changes.

CMS Grav Date Archive

The line marked in the screenshot should look like this:

<span class="archive_date">{{ month|date("m_Y") }}</span>

Now the dates will be displayed numerically, for example, 06.2019.

That’s all for now. But I hope you approximately understood the principle of editing templates. Next, I’ll tell you how to create and edit pages.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

If the materials from this website have been helpful, and you wish to support the blog, you can use the form at the following link: Donate to support the blog