The service reads config files to locate content.
export const ausConfig: PressReaderEditionConfig = {
sections: [{ '...': '...' }, { '...': '...' }, { '...': '...' }],
};
Top level array called “sections” contains the definitions necessary to create the index file that Pressreader consults.
Each section contains four keys:
{
displayName: 'Headlines',
maximumArticleCount: 12,
frontSources: [{'...':'...'}],
capiSources: [],
}
displayName
: the name of the section as seen by the readermaximumArticleCount
: the maximum number of articles we should include in the sectionfrontSources
: the necessary details to address fronts containers to look for content, you can have multiple fronts sources.capiSources
: the CAPI queries to use to look for content. You can have multiple CAPI sources.
Each ‘fronts’ source has three keys.
{
collectionIndexes: [0],
collectionNames: ['Headlines'],
sectionContentURL: 'http://api.nextgen.guardianapps.co.uk/au/lite.json',
}
sectionContentURL
: the URL of the API to consult for the collections informationcollectionIndexes
: A list of integers describing which container to fetch data fromcollectionNames
: A list of strings with the names of which containers to fetch data from
This is an array of strings each of which defines a CAPI search to use to locate content for the section.
{
...: '...',
capiSources: [
'search?tag=tone%2Feditorials&production-office=aus&order-by=newest',
'search?tag=tone%2Feditorials&order-by=newest',
],
}
Each section is processed in the order it is defined in the config file. Each section’s lists of articles is created by:
- Consulting any fronts containers referenced by index
- Consulting any fronts containers referenced by name
- Consulting CAPI queries in the order they are supplied in the configuration
Articles are also excluded if:
- They were published more than 24 hours ago
- They have a word count that's shorter than the
MIN_WORDCOUNT
that's set globally - If an article has already been included in a section
- If the content type is not an article
Once the maximum article count has been met, or the sources exhausted we move on to the next section.