Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to breadcrumb segment titles #4356

Merged
merged 12 commits into from
Aug 30, 2022
144 changes: 72 additions & 72 deletions app/_data/docs_nav_gateway_3.0.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ items:
- text: Deployment Topologies
items:
- text: Overview
url: /production-deployment/deployment-topologies/
url: /production/deployment-topologies/
- text: Hybrid Mode
items:
- text: Overview
url: /production-deployment/deployment-topologies/hybrid-mode/
url: /production/deployment-topologies/hybrid-mode/
- text: Deploy Kong Gateway in Hybrid mode
url: /production-deployment/deployment-topologies/hybrid-mode/setup
url: /production/deployment-topologies/hybrid-mode/setup
- text: DB-less Deployment
url: /production-deployment/deployment-topologies/db-less-and-declarative-config
url: /production/deployment-topologies/db-less-and-declarative-config
- text: Traditional
url: /production-deployment/deployment-topologies/traditional
url: /production/deployment-topologies/traditional
- text: Installation Options
mheap marked this conversation as resolved.
Show resolved Hide resolved
items:
- text: Overview
Expand Down Expand Up @@ -114,19 +114,19 @@ items:
- text: Running Kong
items:
- text: Running Kong as a non-root user
url: /production-deployment/running-kong/kong-user
url: /production/running-kong/kong-user
- text: Securing the Admin API
url: /production-deployment/running-kong/secure-admin-api
url: /production/running-kong/secure-admin-api
- text: Using systemd
url: /production-deployment/running-kong/systemd
url: /production/running-kong/systemd
- text: Access Control
items:
- text: Start Kong Gateway Securely
url: /production-deployment/access-control/start-securely
url: /production/access-control/start-securely
- text: Programatically Creating Admins
url: /production-deployment/access-control/register-admin-api
url: /production/access-control/register-admin-api
- text: Enabling RBAC
url: /production-deployment/access-control/enable-rbac
url: /production/access-control/enable-rbac
- text: Licenses
mheap marked this conversation as resolved.
Show resolved Hide resolved
items:
- text: Overview
Expand All @@ -142,49 +142,49 @@ items:
- text: Networking
items:
- text: Default Ports
url: /production-deployment/networking/default-ports
url: /production/networking/default-ports
- text: DNS Considerations
url: /production-deployment/networking/dns-considerations
url: /production/networking/dns-considerations
- text: Network and Firewall
url: /production-deployment/networking/firewall
url: /production/networking/firewall
- text: Kong Configuration File
url: /production-deployment/kong-conf
url: /production/kong-conf
- text: Environment Variables
url: /production-deployment/environment-variables
url: /production/environment-variables
- text: Embedding Kong in Open Resty
url: /production-deployment/kong-openresty
url: /production/kong-openresty
- text: Serving a Website and APIs from Kong
url: /production-deployment/website-api-serving
url: /production/website-api-serving
- text: Monitoring
items:
- text: Overview
url: /production-deployment/monitoring/
url: /production/monitoring/
- text: Prometheus
url: /production-deployment/monitoring/prometheus
url: /production/monitoring/prometheus
- text: StatsD
url: /production-deployment/monitoring/statsd
url: /production/monitoring/statsd
- text: Datadog
url: /production-deployment/monitoring/datadog
url: /production/monitoring/datadog
- text: Tracing
items:
- text: Overview
url: /production-deployment/tracing/
url: /production/tracing/
- text: Writing a Custom Trace Exporter
url: /production-deployment/tracing/write-custom-trace-exporter
url: /production/tracing/write-custom-trace-exporter
- text: Tracing API Reference
url: /production-deployment/tracing/api
url: /production/tracing/api
- text: Resource Sizing Guidelines
url: /production-deployment/sizing-guidelines
url: /production/sizing-guidelines
- text: Security Update Process
url: /production-deployment/security-update-process
url: /production/security-update-process
- text: Blue-Green Deployments
url: /production-deployment/blue-green
url: /production/blue-green
- text: Canary Deployments
url: /production-deployment/canary
url: /production/canary
- text: Clustering Reference
url: /production-deployment/clustering
url: /production/clustering
- text: Logging Reference
url: /production-deployment/logging
url: /production/logging
- text: Upgrade Kong Gateway
items:
- text: Upgrade Kong Enterprise
Expand All @@ -201,17 +201,17 @@ items:
- text: Kong Vitals
items:
- text: Overview
url: /kong-enterprise/vitals/
url: /kong-enterprise/analytics/
- text: Metrics
url: /kong-enterprise/vitals/metrics
url: /kong-enterprise/analytics/metrics
- text: Reports
url: /kong-enterprise/vitals/reports
- text: Vitals with InfluxDB
url: /kong-enterprise/vitals/influx-strategy
- text: Vitals with Prometheus
url: /kong-enterprise/vitals/prometheus-strategy
- text: Estimate Vitals Storage in PostgreSQL
url: /kong-enterprise/vitals/estimates
url: /kong-enterprise/analytics/reports
- text: Analytics with InfluxDB
url: /kong-enterprise/analytics/influx-strategy
- text: Analytics with Prometheus
url: /kong-enterprise/analytics/prometheus-strategy
- text: Estimate Analytics Storage in PostgreSQL
url: /kong-enterprise/analytics/estimates
- text: Secrets Management
items:
- text: Overview
Expand Down Expand Up @@ -247,77 +247,77 @@ items:
- text: Dev Portal
items:
- text: Overview
url: /kong-enterprise/developer-portal/
url: /kong-enterprise/dev-portal/
- text: Enable the Dev Portal
url: /kong-enterprise/developer-portal/enable
url: /kong-enterprise/dev-portal/enable
- text: Publish an OpenAPI Spec
url: /kong-enterprise/developer-portal/publish-spec
url: /kong-enterprise/dev-portal/publish-spec
- text: Structure and File Types
url: /kong-enterprise/developer-portal/structure-and-file-types
url: /kong-enterprise/dev-portal/structure-and-file-types
- text: Themes Files
url: /kong-enterprise/developer-portal/themes
url: /kong-enterprise/dev-portal/themes
- text: Working with Templates
url: /kong-enterprise/developer-portal/working-with-templates
url: /kong-enterprise/dev-portal/working-with-templates
- text: Using the Editor
url: /kong-enterprise/developer-portal/using-the-editor
url: /kong-enterprise/dev-portal/using-the-editor
- text: Authentication and Authorization
items:
- text: Basic Auth
url: /kong-enterprise/developer-portal/authentication/basic-auth
url: /kong-enterprise/dev-portal/authentication/basic-auth
- text: Key Auth
url: /kong-enterprise/developer-portal/authentication/key-auth
url: /kong-enterprise/dev-portal/authentication/key-auth
- text: OIDC
url: /kong-enterprise/developer-portal/authentication/oidc
url: /kong-enterprise/dev-portal/authentication/oidc
- text: Sessions
url: /kong-enterprise/developer-portal/authentication/sessions
url: /kong-enterprise/dev-portal/authentication/sessions
- text: Adding Custom Registration Fields
url: /kong-enterprise/developer-portal/authentication/adding-registration-fields
url: /kong-enterprise/dev-portal/authentication/adding-registration-fields
- text: Manage Developers
url: /kong-enterprise/developer-portal/authentication/managing-developers
url: /kong-enterprise/dev-portal/authentication/managing-developers
- text: Developer Roles and Content Permissions
url: /kong-enterprise/developer-portal/authentication/developer-permissions
url: /kong-enterprise/dev-portal/authentication/developer-permissions
- text: Application Registration
items:
- text: Authorization Provider Strategy
url: /kong-enterprise/developer-portal/applications/auth-provider-strategy
url: /kong-enterprise/dev-portal/applications/auth-provider-strategy
- text: Enable Application Registration
url: /kong-enterprise/developer-portal/applications/enable-application-registration
url: /kong-enterprise/dev-portal/applications/enable-application-registration
- text: Enable Key Authentication for Application Registration
url: /kong-enterprise/developer-portal/applications/enable-key-auth-plugin
url: /kong-enterprise/dev-portal/applications/enable-key-auth-plugin
- text: Enable External Authentication
items:
- text: External OAuth2 Support
url: /kong-enterprise/developer-portal/authentication/3rd-party-oauth
url: /kong-enterprise/dev-portal/authentication/3rd-party-oauth
- text: Set up Okta and Kong for External Oauth
url: /kong-enterprise/developer-portal/authentication/okta-config
url: /kong-enterprise/dev-portal/authentication/okta-config
- text: Set up Azure AD and Kong for External Authentication
url: /kong-enterprise/developer-portal/authentication/azure-oidc-config
url: /kong-enterprise/dev-portal/authentication/azure-oidc-config
- text: Manage Applications
url: /kong-enterprise/developer-portal/applications/managing-applications
url: /kong-enterprise/dev-portal/applications/managing-applications
- text: Customize Dev Portal
items:
- text: Theme Editing
url: /kong-enterprise/developer-portal/customize/theme-editing
url: /kong-enterprise/dev-portal/customize/theme-editing
- text: Migrating Templates Between Workspaces
url: /kong-enterprise/developer-portal/customize/migrating-templates
url: /kong-enterprise/dev-portal/customize/migrating-templates
- text: Markdown Rendering Module
url: /kong-enterprise/developer-portal/customize/markdown-extended
url: /kong-enterprise/dev-portal/customize/markdown-extended
- text: Customizing Portal Emails
url: /kong-enterprise/developer-portal/customize/emails
url: /kong-enterprise/dev-portal/customize/emails
- text: Adding and Using JavaScript Assets
url: /kong-enterprise/developer-portal/customize/adding-javascript-assets
url: /kong-enterprise/dev-portal/customize/adding-javascript-assets
- text: Single Page App in Dev Portal
url: /kong-enterprise/developer-portal/customize/single-page-app
url: /kong-enterprise/dev-portal/customize/single-page-app
- text: Alternate OpenAPI Renderer
url: /kong-enterprise/developer-portal/customize/alternate-openapi-renderer
url: /kong-enterprise/dev-portal/customize/alternate-openapi-renderer
- text: SMTP
url: /kong-enterprise/developer-portal/smtp
url: /kong-enterprise/dev-portal/smtp
- text: Workspaces
url: /kong-enterprise/developer-portal/workspaces
url: /kong-enterprise/dev-portal/workspaces
- text: Helpers CLI
url: /kong-enterprise/developer-portal/cli
url: /kong-enterprise/dev-portal/cli
- text: Portal API
url: /kong-enterprise/developer-portal/portal-api
url: /kong-enterprise/dev-portal/portal-api
- text: Audit Logging
url: /kong-enterprise/audit-log
- text: Keyring and Data Encryption
Expand Down
2 changes: 1 addition & 1 deletion app/_data/tables/features/gateway.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
columns:
- name: Open Source
cta: Get Started
cta_link: /gateway/latest/kong-production/install-options/
cta_link: /gateway/latest/install/
key: oss
- name: Kong Enterprise
cta: Contact Sales
Expand Down
15 changes: 12 additions & 3 deletions app/_includes/breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,31 @@

{% if title == "Servicehub" %}{% assign title = "Service Hub" %}{% endif %}

{% unless forloop.last %}
{% capture breadcrumb_url %}{{ breadcrumb_url }}{{ crumb }}/{% endcapture %}
{% capture breadcrumb_exists %}{% page_exists {{breadcrumb_url}} %}{% endcapture %}

{% assign bc_title = breadcrumb_url | breadcrumb_title %}
{% if bc_title %}
{% assign title = bc_title %}
{% endif %}

{% if breadcrumb_url != page.url or page.is_dir_index %}
<li class="breadcrumb-item">
{% if breadcrumb_exists == 'true' %}
<a href="{{ breadcrumb_url }}">{{ title }}</a>
{% else %}
{{ title }}
{% endif %}
</li>
{% endunless %}
{% endif %}
{% endfor %}

{% assign page_title = page.title %}
{% if page.breadcrumb %}
{% assign page_title = page.breadcrumb %}
{% endif %}
<li class="breadcrumb-item">
<a href="{{ page.url }}">{{ page.title }}</a>
<a href="{{ page.url }}">{{ page_title }}</a>
</li>
</ul>
</div>
20 changes: 20 additions & 0 deletions app/_plugins/filters/breadcrumb_title_filter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

require 'yaml'
module Jekyll
module BreadcrumbTitleFilter
def initialize(ctx)
super(ctx)
@mapping = YAML.load_file("#{__dir__}/../../breadcrumb_titles.yml")
end

def breadcrumb_title(input)
parts = input.split('/')
parts[2] = 'VERSION'
input = "#{parts.join('/')}/"
@mapping[input]
end
end
end

Liquid::Template.register_filter(Jekyll::BreadcrumbTitleFilter)
2 changes: 2 additions & 0 deletions app/_plugins/filters/titleize_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
inflect.acronym 'OpenShift'
inflect.acronym 'systemd'
inflect.acronym 'StatsD'
inflect.acronym 'GraphQL'
inflect.acronym 'DB'
end

module Jekyll
Expand Down
13 changes: 11 additions & 2 deletions app/_plugins/generators/single_source_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def create_pages(data, site, product, release, version, assume_generated, nav) #
end

class SingleSourcePage < Jekyll::Page
def initialize(site, src, dest, product, release, version, nav) # rubocop:disable Lint/MissingSuper, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize, Metrics/ParameterLists
def initialize(site, src, dest, product, release, version, nav) # rubocop:disable Lint/MissingSuper, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
# Configure variables that Jekyll depends on
@site = site

Expand Down Expand Up @@ -94,7 +94,15 @@ def initialize(site, src, dest, product, release, version, nav) # rubocop:disabl

# Read the source file, either `<src>.md or <src>/index.md`
file = "src/#{src}.md"
file = "src/#{src}/index.md" unless File.exist?(file)
if File.exist?(file)
is_dir_index = false
else
file = "src/#{src}/index.md"
raise "Could not find a source file at 'src/#{src}.md' or #{file}" unless File.exist?(file)

is_dir_index = true
end

content = File.read(file)

# Load content + frontmatter from the file
Expand All @@ -108,6 +116,7 @@ def initialize(site, src, dest, product, release, version, nav) # rubocop:disabl

# Make it clear that this content comes from a generated file
@data['path'] = "GENERATED:nav=#{nav}:src=#{src}:#{@dir}"
@data['is_dir_index'] = is_dir_index

# Set the current release and concrete version
@data['release'] = release
Expand Down
5 changes: 5 additions & 0 deletions app/breadcrumb_titles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/gateway/VERSION/production/: Production Deployment
/gateway/VERSION/kong-manager/auth/: Authentication and Authorization
/gateway/VERSION/kong-manager/auth/oidc/: OpenID Connect
/gateway/VERSION/kong-plugins/authentication/oidc/: OpenID Connect
/gateway/VERSION/kong-enterprise/analytics/: Vitals
Loading