/opt/tyk-dashboard/portal folder of your Tyk installation.
All templates are based on Twitter Bootstrap and are standard HTML with some Golang Template snippets to handle dynamic content rendering.
The Portal process (
tyk-analytics) must be restarted for template changes to take effect. This is because the application caches templates on startup.Adding new templates
The Tyk content editor enables you to specify a template name to use when rendering templates. two are provided by default:- Default Home Page Template
- Default Page Template
portal folder and ensure it starts and ends with the templates directive:
customPage template, this can then be used as the template name in the CMS form when generating for the page type.
Content fields
You’ll notice that in existing templates, certain fields are mapped out as content:
MyContent field by requesting it from the page data in the template like so:
Dynamic Customization
Portal templates now have access to the Developer object, its subscriptions and issued keys meta-data, providing the ability to conditionally show or hide content inside the Portal, based on the attributes described below. The current logged in Developer can be accessed using.UserData variable with the following fields:
- Id - Internal developer ID
- Email - Developer email
- OrgID - Tyk Organization ID
- Subscriptions - Map containing subscriptions where key is a policy ID and value is an API key
- Fields - Map containing custom developer fields
- OauthClients - Map containing list of registered oAuth clients, where Key is the policy ID.
.APIS variable, containing map, where the key is PolicyID and value of the following format:
- APIDescription - API definition
- ID - Internal API id
- Name - API name
- More fields: https://github.com/TykTechnologies/tyk/blob/master/apidef/api_definitions.go#L320
- APIKey - API key
- PolicyData - Policy object
- ID - Internal Policy ID
- Name - Policy Name
- More fields: https://github.com/TykTechnologies/tyk/blob/master/user/policy.go#L5
- KeyMetaData - Key metadata of map type
Example
You have different teams of developers, and for each team we want to show them a different list of APIs. In this case, for each developer, we need to set a customteam field, and assert it in a template like this:
Add Files for Downloading
If you want to have files available for download from your portal you can add them to your/tyk-dashboard/portal/portal-assets directory.
You can then refer to them by using a /opt/tyk-dashboard/... link.