feeds-promo-items 0.0.0-canary-20240712175749
Install from the command line:
Learn more about npm packages
$ npm install @wpmedia/feeds-promo-items@0.0.0-canary-20240712175749
Install via package.json:
"@wpmedia/feeds-promo-items": "0.0.0-canary-20240712175749"
About this version
A constructor to process promo_items
for sitemaps and RSS feeds. It supports sitemap image tag, rss media:content and enclosure tags. It handles images, galleries and videos objects and tries to handle them in a consistent way.
- BuildPromoItems.imageTag - generate image tag
- BuildPromoItems.mediaTag - generate content:media tag
- BuildPromoItems.enclosureTag - generate enclosure tag
BuildPromoItems() - The constructor, needs a new instance created first
this.parse(ANS, jmespathString, resizerKey, resizerURL, width, height, imageTitle, imageCaption, imageCredits, videoSelect) - pass in ANS and jmespath statement. If the jmespath search returns something it's type is used to call the correct object parser. this.gallery - process content_elements, calling this.image on each one this.image - process image, returning url, type, title, caption, credits, height, width this.video - process video, returning url, type, title, caption, credits, duration, filesize, height, width (of video), thumbnail
import { BuildPromoItems } from './promoItems'
const MyPromoItems = new BuildPromoItems()
const promo = MyBuildPromoItems.mediaTag(ans, promoItemsJmespath, resizerKey, resizerURL, resizeWidth, resizeHeight, imageTitle, imageCaption, imageCredits, videoSelect)
Using a constructor allows use of prototype inheritance to override functions
import { BuildPromoItems } from './promoItems'
const MyPromoItems() {
BuildPromoItems.call(this)
this.image(options) {
// custom image logic here to override existing functionality
}
}
const NewPromoItems = new MyPromoItems()
const promo = NewPromoItems.imageTag(ans, promoItemsJmespath, resizerKey, resizerURL, resizeWidth, resizeHeight, imageTitle, imageCaption, imageCredits, videoSelect)
Details
- feeds-promo-items
- WPMedia
- 7 months ago
- CC-BY-NC-ND-4.0
- 4 dependencies
Assets
- feeds-promo-items-0.0.0-canary-20240712175749.tgz
Download activity
- Total downloads 3
- Last 30 days 0
- Last week 0
- Today 0