Skip to content

Commit

Permalink
Titleize breadcrumbs (#4321)
Browse files Browse the repository at this point in the history
Add titleize gem + filter
  • Loading branch information
mheap authored Aug 24, 2022
1 parent 58ebd8f commit 31cfab9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem 'jekyll-redirect-from'
gem 'kramdown-parser-gfm'
gem 'liquid-c'
gem 'rouge', '3.30.0'
gem 'activesupport'

group :development do
gem 'pry'
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
Expand Down Expand Up @@ -52,6 +57,7 @@ GEM
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
method_source (1.0.0)
minitest (5.16.3)
nio4r (2.5.8)
parallel (1.22.1)
parser (3.1.2.0)
Expand Down Expand Up @@ -92,12 +98,15 @@ GEM
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unicode-display_width (1.8.0)

PLATFORMS
ruby

DEPENDENCIES
activesupport
jekyll (= 4.2.0)
jekyll-include-cache
jekyll-redirect-from
Expand Down
2 changes: 1 addition & 1 deletion app/_includes/breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

{% assign breadcrumb_url = product_url %}
{% for crumb in crumbs offset: offset %}
{% assign title = crumb | replace:'-',' ' | remove:'.md' | capitalize | strip %}
{% assign title = crumb | strip | remove:'.md' | titleize %}

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

Expand Down
18 changes: 18 additions & 0 deletions app/_plugins/filters/titleize_filter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

require 'active_support/core_ext/string/inflections' # If not using Rails

ActiveSupport::Inflector.inflections do |inflect|
inflect.acronym 'API'
inflect.acronym 'mTLS'
end

module Jekyll
module TitleizeFilter
def titleize(input)
input.titleize
end
end
end

Liquid::Template.register_filter(Jekyll::TitleizeFilter)

0 comments on commit 31cfab9

Please sign in to comment.