Located at DrEdition: "Settings" -> "Content Sources" -> "Add" or choose an existing Content Source.

A content source is used to give DrEdition access to the content of your CMS/article database. DrEdition expects the content source to return JSON data, but it has few requirements to how your data is structured, which is handled by the mapper function. Content Sources are based on a URL template, with optional default parameters, one or more content queries and a mapper function.

Content Sources and Content Queries, including a mapper function (which are all described below) are the only required setup to get started with DrEdition. It is quite comprehensively designed to make maintenance scalable, so careful consideration of all below steps is needed.

Import lists (far left on Illustration 1 below) are based on Content Queries made on Content Sources. A Content Source will typically be your article database. If you're using DrPublish from Aptoma, this will be your (or one of your) article database(s).

Illustration 1: DrEdition overview.

Defining a Content Source

A Content Source requires a URI Template, which can look like this if you're using DrPublish.

Each parameter can receive a default setting, or be defined as {INPUT}. Defining a parameter as {INPUT} automatically adds an advanced search option in DrEdition where editorial staff can enter values.

Illustration: Setting default params, or defining them as {INPUT}
Illustration: GUI when using {INPUT} for parameter 'id'.

Define Content Queries on the Content Source

Located at DrEdition: "Settings" -> "Content Sources" -> Choose a content source. -> "Add" on Content Query section.

Content queries are more refined queries against a Content Source. It could i.e. be "the 50 latest published articles", or only from a specific category, tag, etc. You can have multiple Content Queries towards a single Content Source.

When a Content Source has been defined, and default parameters has been defined, you will need to define a Content Query before it is ready for use by editorial staff. Content Queries can conveniently piggy-back on defaults, or override with specific settings. You can define many Content Queries based on one single Content Source.

A normal reason for having several different Content Queries on top of a Content Source is if you want to present editorial staff with separate feeds for "sports" and "business", even though they originate from the same content source.

Illustration: Adding Content Queries on a Content Source

The final step: Enabling a Content Query for a Product

Located at DrEdition: "Products" -> Press "Edit" on a Product.

Content Queries are now ready to run, but you'll have to decide on a per-product basis whether to expose any specific Content to editorial staff using this product. Head over to "Products" in the menu and click "Edit" on the product in question. While editing this product, you can add any Content Query editorial staff will need on this product.

Illustration: From "Edit product" page, while adding Content Queries.

Mapper Functions: Normalising data from Content Queries

Located at DrEdition: "Settings" -> "Content Sources" -> Choose a content source.

DrEdition assumes all Content Queries based on the same Content Source returns data of the same format, and DrEdition also requires a Content Source to return data in a JSON syntax.

You do not need to worry about data format of the Content Source, though, as DrEdition allows you to define mapper functions to normalise data for use in a DrEdition context.

Mapper functions are thus defined on the Content Source (Settings -> Content Sources). To give you a sense of how a mapper function can be setup, here's a partial example.

Please note that id and type are required for DrEdition GUI to create a list from the data.

'use strict';
return response.body.items.map((item) => {
const section = item.meta.categories.find((cat) => cat.isMain === '1').name;
const mainTag = item.meta.tags.find((tag) => tag.position === 1);
const splitTitle = item.meta.headline.split(':', 2);
return {
id: item.meta.id,
pretitle: splitTitle.length === 2 ? splitTitle.shift() + ':' : '',
title: splitTitle.shift(),
type: 'sphynx-article',
priority: item.meta.articleTypeMeta.priority || 'B',
features : { premium : item.meta.articleTypeMeta.premium || false },
tag: mainTag && mainTag.name || '',
image: getMainImage(item),
url: `/${section.toLowerCase()}/${item.meta.id}`
};
});

The mapping must adhere to Content Schemas that you are using for your Product Type in question.