Custom Block Development and Outbound Feeds
Themes allows you to use the existing Arc XP Outbound Feeds (OBF) blocks in your repo by listing them in Blocks.json. Themes also makes it possible to modify the Arc OBF Blocks to change the way they work, or to create completely new custom feeds. Because OBF is based on themes which is based on fusion, a basic understanding of the Fusion Development Process is recommended. But don’t worry, even if you are not currently using themes, you can still use OBF.
Blocks
Outbound Feeds is based on blocks, which are just npm packages. A block can be any fusion component or content. OBF blocks are either features which generate the output and end with “-feature-block” or they are content sources which call API’s to get data and start with “feeds-source-”. There is a third type, a custom output-type, but it is not technically a block.
Features
All OBF feeds are features intended to be the only thing on a page or template. No layout or other components need to be added to the page. The feature blocks have the following structure.
CHANGELOG.mdREADME.mdfeatures/ │ └───rss │ __snapshots__ xml.js xml.test.jsindex.jspackage.json
In the features directory is a single directory holding the feature code and tests. The feature code will always be called xml.js
. The feature code returns an object that gets converted to xml by the output-type
.
Each feed block is organized using the same structure which is described in Feature Block. Feed blocks use several javascript Dependencies to make it easier to work with ANS and xml. To reduce the amount of duplicate code a set of Utilities has been created that can be used in any block.
Content Sources
All feeds are designed to work with globalContent returned as a “results set”, an object with a content_elements
array of content. Usually this content comes from Content-API. For this we have the feeds-source-content-api-block
Content Source Block
Output-Types
There is a npm package for the xml Output-Type.
called @wpmedia/feeds-xml-output
, but it must be used like a regular npm package by listing it as a dependency in the package.json.
If you want to modify a block you will first need to copy the code from the OBF Repo and add it into your repo. This is known as Ejecting a block. Once the code is in your local repo it will no longer receive updates from Arc. Now you can start changing the code to make your custom feed. Use This doc to get started setting up your local repo.