Embed ckbk Recipes On Your Site

You can now embed “recipe cards” from ckbk on any website.

The examples below show how to embed single recipe, a list of recipes, or top recipes from a specific book or author. Recipe embedding is fully mobile responsive and supports both carousel and grid layouts. If you are signed up with ckbk’s affiliate program, you can incorporate your affiliate code when embedding recipes.

The examples given show how to embed using Javascript.
However certain systems such as the Firefly platform widely used in education do not support Javascript embedding. In that case <iframe> embedding can be used instead (more info)

  1. Single Recipe

Find the recipe(s) you want to embed and take a look at the URL to find the recipe-id:

 
embed.png
 

To embed a recipe card on your website or blog just use the code below, replacing [recipe-id] with the appropriate value.

<script async src="https://app.ckbk.com/embed.js?id=[recipe-id]"></script>

Example:

<script async src="https://app.ckbk.com/embed.js?id=vege91504c05s001r007"></script>
 

2. Multiple recipes (Carousel format)

You can embed multiple recipes on a web page with separate embeds, but an even easier way is to supply a list of recipe-ids. If there are more recipes that will fit across the screen, the recipes will automatically be shown as a scrollable carousel.

<script async src="https://app.ckbk.com/embed.js?id=recipe-id1,recipe-id2,recipe-id3"</script>

For example:

<script async src="https://app.ckbk.com/embed.js?id=chin66734c02s001r007,jack34322c02s001r011,pier59043c03s001r004,fore26035c05s001r019,toda06144c02s001r009,well43429c06s001r023"></script>
 

3. Multiple recipes (Grid format)

Add format=grid parameter to change the layour to a grid. You can also specify the maximum number of columns to use in the grid. The grid is “responsive” — on small screens such as phones it appears as a list.

<script async src="https://app.ckbk.com/embed.js?format=grid&columns=4&id=[recipe-id1],[recipe-id2],[recipe-id3]"></script>

Example

<script async src="https://app.ckbk.com/embed.js?format=grid&columns=4&id=mrho60026c01s001r001,prue91481c01s001r020,welc74463c02s001r035,root08476c25s001r007,bist61009c06s001r004,worl10873c07s001r009,sepi63522c02s001r001,froz18665c07s001ss010r016,chef02208c13s001ss006r001,chin66734c04s001r013,quay64875c02s001r035,sepi63522c08s001r021,sepi63522c04s001r017"></script>
 

4. Top recipes for a specific author

Use the following format to embed the most popular recipes for a specific author. The author-id can be found in the ckbk author URL. Use limit to specify how many recipes should be included. Both carousel and grid formats are supported.

<script async src="https://app.ckbk.com/embed.js?personId=[person-id]&limit=10"></script>

Example:

<script async src="https://app.ckbk.com/embed.js?personId=ken-hom&limit=10"></script>
 

5. Top recipes for a specific book

Use the following format to embed the most popular recipes for a specific book (the book-id can be found in the ckbk book URL). Use limit to specify how many recipes should be displayed. Both carousel and grid formats are supported.

<script async src="https://app.ckbk.com/embed.js?bookId=[book-id]&limit=10"></script>

Example:

<script async src="https://app.ckbk.com/embed.js?bookId=1916316514&limit=10"></script>
 

5. All recipes in a specific collection

Use the following format to embed the recipes from a specific collection. Both carousel and grid formats are supported. If you wish to embed one of your personal collections, you should first make it publicly accessible (using the Edit collection option).

<script async src="https://app.ckbk.com/embed.js?collectionId=[collection-id]"></script>

Example:

<script async src="https://app.ckbk.com/embed.js?collectionId=73807"></script>
 

Affiliate codes

ckbk runs an affiliate program, providing a referral fee for users who become Premium Members. If you are a ckbk affiliate, simply include your affiliate code as a parameter in the embed URL.

Example:

<script async src="https://app.ckbk.com/embed.js?aff=1234&bookId=1844839974&limit=10"></script>
 

Embedding using an iframe (fallback option)

We recommend using the JavaScript code above as the optimal way to embed ckbk recipes, but if your CMS only supports “iframe” embeds, don’t despair, we stillhave you covered. Just use the appropriate the following format to create an iframe embed - the same parameters are supported, with the exception that expandable grids are not possible using iframes.
Please note that the URL in this case is /embed rather than /embed.js

<iframe src="https://app.ckbk.com/embed?aff=1234&bookId=[book-id]&limit=10" width="100%" height="360" frameborder="0" scrolling="no"></iframe>

Example:

<iframe src="https://app.ckbk.com/embed?aff=1234&bookId=1844839974&limit=10" width="100%" height="360" frameborder="0" scrolling="no"></iframe>
 

ckbk Embed API Reference

Recipes can be embedded either via a script or an iframe. Script embeds are preferred and allow grids to be automatically resized, but iframes are also supported for maximum compatibility.

Insert the relevant tag where you would like the embed to appear (you can add multiple embeds per page):

Script embed:

<script async src="https://app.ckbk.com/embed.js?parameters"></script>

iframe embed:

<iframe src="https://app.ckbk.com/embed?parameters" width="100%" height="380" frameborder="0" scrolling="no"></iframe>

Note that the URL in the script tag uses /embed.js, whereas the iframe uses /embed.

Supported parameters are listed below:

Parameter

Description

Default

format

Possible values:

  • carousel - a single row of cards, which can be scrolled horizontally
  • grid - one or more rows of tiles, which user may expand to show more. On small screens, this is displayed as a list.

carousel

recipeId

Recipe id, or comma separated list of ids of recipes

e.g. 

anat60491c06s001r018,boun90488c02s001r011,clas52782c04s001r027

Recipes will be shown in the order they are listed, unless another ordering is explicitly specified (see below)

 

bookId

ID of book from which to display the top recipes. 

e.g.

1419732773

 

personId

ID of author from whom to display the most popular recipes.

e.g. 

ken-hom

 

collectionId

ID of recipe collection.

e.g. 

75366

 

orderBy

Possible values: 

  • relevance - takes into account popularity, recency and whether an image is present
  • popularity  - purely based on access and favourite counts

relevance

orderByDirection

Possible values:

  • asc
  • desc

desc

 

When format = carousel or grid the following additional parameters can be used

Parameter

Description

Default

columns

Maximum number of columns to display (fewer will be displayed on narrow screens)

4

limit

The maximum number of items to display. Can be any value up to 100.

10

 

When format = grid the following additional parameters can be used:

Parameter

Description

Default

gridRows

How many rows to display initially.

If you are using the <iframe> embed, you will need to adjust the height of the frame if you wish to show more than one row (allow 380 px per row).

1

mobileView

For mobile screens (480px or less), this parameter displays how the grid will be displayed.

Possible values

  • list : display compact list-style tiles (recommended)
  • grid : displays the standard grid

list

canShowMore

Whether to display the ‘Show more’ button.

Possible values:

  • true : show
  • false : hide

If using <iframe> embedding, we recommend this is set to false.

true