@cafebazaar/jaldi
v1.4.3
Published
Create json-ld to used in Cafebazaar pages
Downloads
110
Readme
Jaldi
Jaldi (جَلدی, meaning Courage) is an INTERNAL library for Cafebazaar to create application/ld+json objects of Cafebazaar HTML pages.
Install
ESM, CommonJS
First install Jaldi from terminal:
npm i @cafebazaar/jaldi
# or
yarn add @cafebazaar/jaldi
And then, register it on your application:
script.js
// ESM
import jaldi from '@cafebazaar/jaldi';
// or
import { app, website } from '@cafebazaar/jaldi';
// CommonJS
const jaldi = require('@cafebazaar/jaldi');
// or
const { app, website } = require('@cafebazaar/jaldi');
IIFE
index.html
<script src="https://unpkg.com/[email protected]/dist/idate.min.js"></script>
<script src="https://unpkg.com/@cafebazaar/[email protected]/dist/jaldi.iife.min.js"></script>
<script>
// window.jaldi is available
</script>
Usage
After registring Jaldi, you can use these methods to get json-ld object:
jaldi.website Function()
const websiteLd = jaldi.website();
jaldi.corporation Function()
const corporationLd = jaldi.corporation();
jaldi.app Function(appDetailsObject)
const appDetailsObject = dilmaj('appDetailsV2Request', {
packageName: 'ir.divar',
});
const appLd = jaldi.app(appDetailsObject);
jaldi.movie Function(movieDetailsObject)
const movieDetailsObject = dilmaj('VideoDetailsRequest', {
videoId: 'ECM70kLh',
});
const movieLd = jaldi.movie(movieDetailsObject);
jaldi.episode Function(episodeDetailsObject)
const episodeDetailsObject = dilmaj('EpisodeDetailsRequest', {
episodeId: 'Captain_Tsubasa_2018_-_E05_25RpD_filimo_episode',
});
const episodeLd = jaldi.episode(episodeDetailsObject);
jaldi.series Function(seriesDetailsObject)
const seriesDetailsObject = dilmaj('SeriesDetailsRequest', {
seriesId: '5iWFN_filimo_series',
});
const seriesLd = jaldi.series(seriesDetailsObject);
jaldi.season Function(seasonDetailsObject)
const seasonDetailsObject = dilmaj('SeasonPageRequest', {
slug: 'Mpb3p8Za|1',
limit: 10000,
offset: 0,
});
const seasonLd = jaldi.season(seasonDetailsObject);
jaldi.vitrinList Function(pageObject)
const pageObject = dilmaj('GetPageV2Request', {
path: 'list~app~editorial~ml-best-updated-apps~DEFAULT',
});
const vitrinListLd = jaldi.vitrinList(pageObject);