Gentics Mesh Cookbook

Introduction

This document aims to provide you with suggestions and hints on how to deal with typical web development tasks. Each chapter will provide you with examples and show you how Gentics Mesh can help you tackle these tasks.

Content

Handling contents is fairly easy. You can either identify and load content using the UUIDs or a regular web path.

You can either place the path or uuid to your content in a fragment /demo#category/079ae5d5467447b99ae5d5467447b934 or in the regular web path /demo/category/079ae5d5467447b99ae5d5467447b934. Most modern single page application frameworks like angular or react support both variations.

If you choose to use a server side webframework like Laravel or Express you can setup routes to handle the inbound request. The request path can be used to build the webroot path for Gentics Mesh. Using that path you can query Gentics Mesh and check whether content for the given path can be found.

Binaries

Binary requests should be directly passed along to the CMS API. This way no additional overhead is involved when dealing with binary data transmission.

Make sure to also support Range requests. This way your frontend will be able to support seeking in video players. On some platforms (Mac OS, iOS) videos might not even be started when the server does not support range requests.

Adding a search feature often starts as a simple requirement which specifies that the content should be searchable. There are however various aspects of the search that need to be highlighted in order to implement the search.

Autocompletion

Do you want to suggest completions while the user enters the query in the search bar?

Did You Mean

Do you want to auto correct the search query and provide the user with an alternative search query?

Autosuggest

Do you want to suggest full query phrases to the user?

Result Highlighting

Should the result page contain excerpts of the found content?

Filtering

Can the user of your site specify additional filters? (e.g.: author, category)

Search Index Tuning

Search in Uploads

Do you want to be able to search within contents of uploaded documents? (e.g.: PDF, DOC, DOCX)

Any uploaded file will automatically be processed if the ingest-attachment plugin has been installed in elasticsearch. You can use this Dockerfile to prepare your Elasticsearch server.

FROM elasticsearch:6.4.1

RUN bin/elasticsearch-plugin install -b ingest-attachment
EXPOSE 9200
EXPOSE 9300

Like & Comment

Storing Data

Login

Authentication Providers

Central authentication providers like keycloak can be used in combination with Gentics Mesh.

User data

Content Staging

In some projects it may be desired to use content staging.

The simplest form of content staging can be done by using draft and published versions. The content is first edited as a draft, reviewed and finally published.

A more complex form of content staging may be needed when faced with the task of reworking the content for a new frontend. A typical example would be the content staging that is needed to rework the content for a seasonal change (e.g. Spring Design vs. Summer Design).

In frontend development a new branch of the needed code is created and the frontend will be reworked. A similar workflow applies to Gentics Mesh. The branch API can be used to create a new branch from the existing content. Once the new branch has been created new contents can be added, existing contents can be updated or restructured. The original branch is untouched from this operation and continues to function as before.

It may be useful for your project to already plan for branches and add a configuration setting which can be used to switch between branches.

Sitemap

Caching

User permissions

Sometimes it might not be important which roles a user has exactly, but only that they did not change since the last time they were checked. For this purpose the user response contains the rolesHash, which is a CRC32 hash of all the users roles.