Reference for templates in built-in portal

Hello,

As far as I could search online, I couldn’t encounter any reference documentation which I can use for portal template customizations.

What I think I know is the following;

  • Go’s html/template package is used in the templates (the ones that reside at /opt/tyk-dashboard/portal/templates that comes with on-premise installation)
  • There are some functions available, like “markDown”, “b64”
  • There is some data exposed to portal templates as well. I believe some of it but not all is listed on https://tyk.io/docs/tyk-developer-portal/customise/.

Besides what’s listed above, I am also aware of the content that resides on https://tyk.io/docs/tyk-developer-portal/customise/.

What I’m seeking;

  • A reference list of functions that’s available on templates
  • Reference documentation of the data that’s exposed to templates. I am especially looking for this as I experienced there are changes from pages to pages. For example, while a page that’s created on the dashboard has a “slug” property, a page such as the ones that reside on paths like /apis, /apis/:api_id/documentation/ do not have such property even though they have it hardcoded.
  • Which Go package is exactly used for templates? I am questioning this as I think its documentation may be beneficial if it’s open source.

Additional info;

I am using the following to see what’s exposed to the template;

{{ range $key, $item := .}}
{{ $key }} - {{ $item }}
<hr>
{{ end }}

If there is a better way to inspect the data, I’d like to hear you out as this one does not help much with the nested data.

Thanks,
Ali

Hey Ali,

I don’t have all the details you seek, but can tell you that in terms of functions available to the templates, you have markdown, b64 and safeCSS.

In terms of the data available, as per the docs page //tyk.io/docs/tyk-developer-portal/tyk-portal-classic/tyk-portal-classic/customise/customise-with-templates/ you’ve basically got access to the Developer object and any subscriptions (APIs), key details and policy data. Might be worth looking at the catalogue.html and member_home.html templates.

cheers,
Andy