We’re here to help

Custom URL Schemes for article-based apps

Follow

A number of custom URL schemes can be used from within your article content, to link to a particular collection or article.

URL schemes for collections

From within your article content, you can use special URL schemes to link to a collection or article.

You can use the following scheme:

tp-collection://[target_collection_name]/[target_article_name]

The syntax is as follows:

tp-collection://[collection-name]
Will link to the first article in a different collection.
tp-collection://[collection-name]?mode=browse
Will open the collection in browse mode.
tp-collection://[collection-name]?mode=detail
Will open the collection in detail mode.
tp-collection://[collection-name]/[article-name]
Will link to a specific article in a different collection.
tp-collection://parent
Will link to the parent collection your current article belongs to.
tp-collection://root
Will link to the root collection of your app.

Article and page links

If you want to add a link to a particular article within a collection, you can do so by using the URL scheme below:

tp-pagelink://[article_name]

If you want to add a link to a particular page in an article from within a browse page or article, you can do as follows:

tp-pagelink://[article_name]/[page_number]

A number of other URL schemes for relative article and page navigation are also available:

tp-next-article://show
Go to the next article.
tp-previous-article://show
Go to the previous article.
tp-first-article://show
Go to the first article of the publication.
tp-last-article://show
Go to the last article of the publication.
tp-next-page://show
Go to the next page (if at the last page of an article, go to the next page in the following article).
tp-previous-page://show
Go to the previous page (if at the first page of an article, go to the last page of the previous article).
tp-first-page://show
Go to the first page of an article.
tp-last-page://show
Go to the last page of an article.
tp-article-top://show
Go to the top of a long-page article.
tp-article-bottom://show
Go to the end of a long-page article.

Paywall

tp-paywall://show

in an article-based app, there is no separate subscriptions dialog, as everything is part of the paywall which is shown as a layer top of a collection. You can manually trigger the paywall by using this special URL.

Entitlements

Show the Entitlements sign-in form

(Available in the kiosk info cell - infoCell.html - and the Entitlements dialog)

tp-entitlements-signin://self

Triggers the entitlements sign-in form.

Show the Entitlements register form

(Available in the kiosk info cell - infoCell.html)

tp-entitlements-register://self

Triggers the entitlements register form. This only works if the entitlements server provides a "register" action.

Get entitlement token

tp-entitlements-get-token://<callback_function>

Get the current entitlement token, passing it as the argument to the callback_function. If no callback function is specified, it will default to "twixlKioskOnGetEntitlementToken".

Clear entitlement token

(Available in the kiosk info cell - infoCell.html)

tp-entitlements-clear-token://self

Clears the entitlements token (can be used for testing purposes).

Phone call

callto:[number]

Allows you to trigger a phone call. Note that this will work on phones only.

Example:

callto:+32493252577

Launching an app

It is possible to trigger launching an app from within a Twixl publication using the following scheme:

Please note that the implementation is slightly different on iOS vs Android.

  • iOS: the URL scheme is the same as the application identifier:

e.g. if the app identifier is "com.twixlmedia.myapp" -> then the URL to launch the app would be: com.twixlmedia.myapp://

  • Android: the URL scheme is the same as the app identifier without the dots, dashes, underscores and all lowercase:

e.g. if the app identifier is com.twixlmedia.myapp -> the the URL to launch the app would be: comtwixlmediamyapp://

IMPORTANT NOTE:

This will only work if the app is already installed on the device.

Opening a hyperlink in the device browser

Although in most cases, you want to keep readers in the embedded browser, sometimes you may want to open a link directly in Safari on iPad or in the default browser on Android. A good use case for this is if you want to link to a PDF that you want readers to be able to download.

You can do this by adding an extra parameter to your URL:

tp-open-in-device-browser=1

The URLs below will open in the embedded app browser:

http://www.website.com/file.pdf?id=1

http://www.website.com/file2.pdf

And these will open in the device browser:

http://www.website.com/file.pdf?id=1&tp-open-in-device-browser=1

http://www.website.com/file2.pdf?tp-open-in-device-browser=1

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.