mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
[#73511] Fix robots meta tag rendered as text instead of HTML element
`content_tag(:meta, name:, content:)` treated the keyword arguments as text content rather than HTML attributes, producing visible JSON-like output on the page. Replace with `tag(:meta, ...)` which correctly renders a self-closing element with the proper attributes. Adds a view spec assertion to cover the rendered output.
This commit is contained in:
committed by
Oliver Günther
parent
7a3632a51e
commit
200072ecc4
@@ -443,7 +443,7 @@ module ApplicationHelper
|
||||
# @param [optional, String] content the content of the ROBOTS tag.
|
||||
# defaults to no index, follow, and no archive
|
||||
def robot_exclusion_tag(content = "NOINDEX,FOLLOW,NOARCHIVE")
|
||||
content_tag(:meta, name: "ROBOTS", content:)
|
||||
tag(:meta, name: "ROBOTS", content:)
|
||||
end
|
||||
|
||||
def permitted_params
|
||||
|
||||
@@ -72,4 +72,9 @@ RSpec.describe "wiki/new" do
|
||||
render
|
||||
assert_select "input", name: "page[parent_id]", value: "123", type: "hidden"
|
||||
end
|
||||
|
||||
it "renders a robots exclusion meta tag in the header tags" do
|
||||
render
|
||||
expect(view.content_for(:header_tags)).to include('name="ROBOTS"', 'content="NOINDEX,FOLLOW,NOARCHIVE"')
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user