Did you ever wonder how to tell your 3scale Developer Portal visitors that it needs to be taken offline for updates, backups or maintenance? In a few simple steps and a working example, I will show you how it can be done easily!
Your website will still be live without disturbing your visitors with a partial working 3scale Developer Portal.
Partial detect-portal-status
I’ve created a partial, which can be included in any page where needed, that detects the portal status. Depending on the status value this partial will redirect the visitor to the appropriate page so you can do your work on the Developer Portal..
How to change the status
Possible statuses:
portal_status_normal
– normal daily situation (live)portal_status_tech_problem
– closed for technical problemportal_status_maintenance
– closed for maintenance
Update the portal status by changing this line {% assign portal_status = portal_status_normal %}
and choose one of the statuses from the list. The status portal_status_normal
is the live status.
How to exclude visitors from being detected
If you are doing some maintenance on the Developer Portal it’s important that you can still login to see and check your changed pages before you set the portal status back to portal_status_normal!
Add the account names separated by a comma by changing this line {% assign except_usernames = 'userA,userB' | split: ',' %}
.
Redirect when status = portal_status_tech_problem
When this status is set, the visitor will be redirected to the /status-technical-difficulties
page.
Redirect when status = portal_status_maintenance
When this status is set, the visitor will be redirected to the /status-maintenance
page.
Liquid partial detect-portal-status
Partials are the reusable parts of code, which repeat in many places on different pages – for example, the footer is the same on every layout, and the sidebar is the same on a few pages with different layouts. To include a partial in a layout, partial, or email template or portlet, type: {% include "partial_name" %}
. For full reference of liquid tags, check here.
Include Detection Partial
On every page, where necessary, you can include the partial detect-portal-status
at the beginning of the page.
References
Check out these external links to gain more info related to this post.
- Red Hat 3scale Developer Portal – Product documentation
- Red Hat 3scale Developer Portal – Liquid reference
Senior Integration Specialist with over 30 years of experience in IT. Professional focus on API Management, Container-based software development / management (Redhat OpenShift) and Message-oriented middleware (Redhat JBoss Fuse / Apache Camel.
Leave a Reply
Want to join the discussion?Feel free to contribute!