Files
nairobi/app/components/layout/footer_component.rb
Javi Martín 5aa56c054f Mark external links using the "rel" attribute
This will help search engines know these links point to external sites
and it'll make it possible to style these links using the
`[rel~=external]` selector. AFAIK, assistive techonologies don't use
this attribute to notify people about external links, though.
2023-10-24 16:41:03 +02:00

26 lines
618 B
Ruby

class Layout::FooterComponent < ApplicationComponent
delegate :content_block, to: :helpers
def footer_legal_content_block
content_block("footer_legal")
end
private
def open_source_link
external_link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"))
end
def repository_link
external_link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"))
end
def external_link_to(text, url)
link_to(text, url, rel: "nofollow external")
end
def allowed_link_attributes
self.class.sanitized_allowed_attributes + ["rel"]
end
end