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

Automatically generate un-hyphenated variants of permalinks #5099

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions _plugins/product-data-enricher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def enrich(page)
set_icon_url(page)
set_tags(page)
set_overridden_columns_label(page)
set_alternate_urls(page)

page.data["releases"].each { |release| enrich_release(page, release) }

Expand Down Expand Up @@ -95,6 +96,17 @@ def set_overridden_columns_label(page)
}
end

# Enrich the alternate_urls list with un-hyphenated variants of the permalink.
def set_alternate_urls(page)
permalink = page.data['permalink']
unhyphenated_permalink = permalink.delete('-')
alternate_urls = page.data['alternate_urls'] || []
unless alternate_urls.include?(unhyphenated_permalink)
alternate_urls << unhyphenated_permalink
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds permalink without hyphen to the alternate_urls list, which is not the expected behavior.

end
page.data['alternate_urls'] = alternate_urls.uniq
end

# Flag all cycles that can be hidden (see #50).
#
# The goal of this function is to hide only a single run of rows, at the very end, if they are
Expand Down