Grav - Interview Questions


Dear readers, these Grav Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of Grav. As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer −

Grav is a flat-file based content management system which doesn't use database to store the content instead it uses text file (.txt) or markdown (.md) file to store the content.

Grav is a new type of fastest flat-file content management system which is easier to publish and manage content. It allows developer to handle content very easily by storing content in files (such as text or markdown files) rather than in database. If you want to build simple, manageable and quick site, it's better to select the Grav flat-file CMS. It costs less than the database driven CMS and is useful with I/O for file handling, when you don't have enough resources to handle database.

The Features of Grav are −

  • It is fast, easy and powerful flat-file web platform.

  • It is used to build website with no extra tools or html knowledge.

  • It uses text file or markdown file to store the content.

  • It doesn't use database, so it eliminates the cause of bottlenecking.

  • It uses PHP based template provided by Twig which is parsed directly into PHP that makes it fast.

The advantages of Grav are −

  • It is not based on database CMS, so it's very easy to install and will be ready to use when you upload the files to the server.

  • It uses Markdown text files to make things easy. Using this, the content will be dynamically converted to HTML and displayed in the browser.

  • In case of security, Grav doesn't have admin area and database. So there is no chance of hacking into account or in the database to access the important data.

  • You can easily backup all the files to keep backup copy of your website, since there is no database to backup.

  • It is a piece of software which doesn't require more time to learn.

The disadvantages of Grav are −

  • Sometimes unauthorized users may access your content from the files directly as there is no database for the files.

  • It is difficult to build complex websites using Grav CMS.

PHP 5.4 or higher

Pages can be defined as building blocks of the site. Pages combine contents and navigations which makes easy even for inexperienced users.

# or hashes syntax in Markdown indicates a title which will be converted to <h1> header in HTML.

** markers indicates bold text or <b> in HTML.

Grav Pages supports 3 types of pages −

  • Standard Page.

  • Listing Page.

  • Modular Page.

Markdown syntax is defined as writing plain text in an easy to read and easy to write format, which is later converted into HTML code. Symbols like (*) or (') are used in markdown syntax. These symbols are used to bold, creating headers and organize your content.

The benefits of using Markdown syntax are −

  • It is easy to learn and has minimum characters.

  • When you use markdown there are very few chances of having errors.

  • Valid XHTML output.

  • Your content and visual display is kept separate so that it does not affect your website look.

  • You can use any text editor or markdown application.

Emphasis is the writing formats in markdown syntax that are used to bold, italicize or strikethrough.

  • Bold − Text can be made bold using two (**) signs at either side of the texts.

  • Italics − Use underscores( _ ) sign at either sides of the word to italicize the text.

  • Strikethrough − Use two tildes(~~) on either side of the word to strikethrough the word.

There are 4 types of links used in the content are −

  • Slug Relative

  • Directory Relative

  • Absolute

  • Remote

Remote links allows you to link directly to any file or document through its URL. There is no need to include your own site's content.

Following are the media file types that are supported by Grav −

  • Image − jpg, jpeg, png.

  • Animated Image − gif.

  • Vectorized Image − svg.

  • Video − mp4, mov, m4v, swf.

  • Data/information − txt, doc, pdf, html, zip, gz.

Sepia filter is added to give a vintage look on images.

Modular Pages enables to create a single page from its child pages. It is used to set as non-routable because they cannot be reached directly through an URL. They are identified by _ (underscore) before the folder name. It is a collection of pages that are displayed one above each to get a single page.

Filters are used to format the data the way you want and output. Functions are used to generate contents. Twig templates are text files that contain expressions and variables replaced by values.

Twig uses three types of tags i.e.

  • Output tags

  • Action Tags

  • Comment tags

There are few options to pass array of assets for CSS −

  • priority − It takes an integer value and default value will be 100.

  • pipeline − When an asset is not included in pipeline, it sets to false value. And the default value is set to true.

Grav allows you to register a collection of CSS and JS assets with a name, so that you can use add assets to Asset Manager by using the registered name. This can be accomplished in Grav by using a feature called named assets. These custom collections are defined in system.yaml, so that it can be used by any theme or plugin.

Grouped Assets allows you to pass options array consisting of optional group while adding Assets. This feature is very useful when you need some JS files or inline JS at specific part of the page.

scss --watch scss:css-compiled

Theme Inheritance is the best way of modifying or customizing a theme and can be accomplished with few setups. The basic idea is that a theme is defined as base-theme that you are inheriting from, and only some bits are allowed to modify and rest of the things is handled by base theme. The advantage of using theme inheritance is, the customized inherited theme will not be directly impacted whenever the base theme is updated.

The important points of random plugin are −

  • You can use this plugin to display the random page by using URI as /random.

  • Create the filter to make use of taxonomy specified in the pages. You can create as category : blog.

  • You can display the random page by using filter option and it informs Grav to use the same content for displaying in random page.

The event hooks have a direct relationship with Grav from beginning to end. You must be aware of the order in which the hooks are called and what is usable at the time of these calls.

The Problem plugin uses this to manage displaying a list of full explanation, for why the grav delivers the fatal error.

In this process, you will see the full site template in order wise by Twig methods. Further, you can add any variable to Twig during this process.

The features of Grav Administration Panel plugin are −

  • Enable or disable the plugins present in the plugin manager list.

  • It consist of functionality of the forget password.

  • Media files can be uploaded by drag-n-drop method.

  • Allows editing via yaml or forms in normal and expert modes.

  • Automatic password encryption feature is provided during user login.

Blueprints are metadata information about the resource(source of information). It serves two purposes −

  • First is the resource identity itself.

  • Second is regarding the forms.

There are 5 types of caching −

  • YAML configuration caching into PHP.

  • Core Grav caching for page objects.

  • Twig caching of template files as PHP classes.

  • Image caching for media resources.

  • Asset caching of CSS and jQuery with pipelining.

The CLI stands for command line interface stored in bin/grav. It performs some tasks such as clearing cache, creating backup copy etc.

$ bin/grav composer

The GPM stands for Grav Package Manager which is used to install, update, uninstall and list the available plugins on the Grav repository. GPM executes the commands using command line interface such as terminal or cmd.

$ bin/gpm self-upgrade

The Grav skeleton describes a sample site which contains Grav Core, plugins, pages, theme all together. The initial idea behind Grav was to build site very easily. The things need for developing a site, that all are placed in a user folder. The skeleton of Grav comes with various dependencies such as plugins, theme etc and stored them in a package which can be unzipped to run the simple example.

The main four steps of Grav lifecycle are −

  • PHP Version

  • Loader class is initialized

  • Obtain Grav Instance

  • Call Grav Process

The YAML stands for YAML Ain't Markup Language which includes human readable content and often used in configuration files, blueprints (metadata information about resource) and page settings.

YAML supports some basic data types which can be used with programming languages such as −

  • Scalars − strings or numbers.

  • Sequences − arrays or lists.

  • Mappings − hashes or dictionaries.

Grav supports following hosting services −

  • Rochen Web Hosting

  • WireNine

  • Crucial Web Hosting

  • Arvixe

  • SiteGround

  • Dreamhost

Some of the reasons that may cause server error are −

  • Out-of-date configuration.

  • Incorrect file permission.

  • Invalid formatted configuration files.

  • Changes in file system not known to the Grav.

bin/grav clear-cache

The few types of responsive images are −

  • Higher density displays

  • Sizes with media queries

It add a suffix to the filename and you can add higher density image to the page.

The special form fields are −

  • Markdown

  • Frontmatter

  • Selectize

  • Taxonomy

  • Toggle

It is used to display the page in raw format.

It specifies the Url where issues or bugs can be reported.

This event helps in processing and managing forms.

It stretches the image as required irrespective of original ratio.