Enonic XP Application that imports articles from NTB Kommunikasjon and creates Content
in XP.
Important
You need to have a subscription from NTB Kommunikasjon to use this library.
Install this application from Enonic Market.
When you add the NTB Import application to your site, you have to configure two fields, and three fields are optional.
- Folder where articles are stored
- Publisher id (8 digit number from NTB)
- Channels (optional 8 digit number from NTB)
- Disable import (optional to disable the cron job that syncs every hour, but if you call the service it will sync even if this is checked)
- Fetch all articles ever created in this NTB-instance (optional to fetch all articles when a job is run - every hour if you have not disabled import with the option above)
You can manually run an import by running the ntb-import
service, which can be found on the following url-path:
/_/service/no.item.ntb/ntb-import
The application has a cron job that runs an import job every hour on the hour. If there are new articles on your NTB Channel, they will be imported into XP as NTB Article content. The su user is set as the owner of the new content. If you have more than 20 new articles (NTB delivers only 20 articles per request), you need to use the "Fetch all articles ever created in this NTB-instance" option in the config to get all the articles.
You have to write the code generate the HTML based on the NTB Article
in your own application.
If you are using TypeScript, you can use this interface to interact with the objects created by this library.
export interface NtbArticle {
title: string;
leadtext: string;
body: string;
imageId?: string;
images?: Array<string> | string;
links?: Array<{
url: string;
description: string;
}>;
keywords?: Array<string> | string;
ntbId: number;
published: string;
url: string;
type: string;
publisherId: number;
channelId?: number;
language: string;
}
To build he project run the following code
enonic project build
Deploy locally for testing purposes:
./gradlew publishToMavenLocal
./gradlew publish -P com.enonic.xp.app.production=true