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

docs: use generated og image #17601

Merged
merged 5 commits into from Oct 1, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions docs/src/_includes/layouts/base.html
Expand Up @@ -13,11 +13,19 @@
{% set page_title = site[hook].title %}
{% endif %}

{% set rule_meta = rules_meta[title] %}
{% set page_title = site.shared.title_format | replace("PAGE_TITLE", page_title) %}
{% set cover_image = ["https://", site.hostname, "/icon-512.png" ] | join %}
{% set cover_image_alt = site.shared.eslint_logo_alt %}
{% set page_desc = site.shared.description %}
{% set relative_page_url = page.url | url | prettyURL %}
{% set cover_image = [
"https://", site.hostname, "/og",
"?title=", title, "&summary=", page_desc,
Copy link
Member

Choose a reason for hiding this comment

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

I think we should url-encode these two. For example, this wouldn't work as intended for a title that contains a & character, like Configure Plugins & Parsers (we actually had this title a few versions ago). Page descriptions are currently the same for all pages but we could change it to include rule descriptions which might also contain characters that would break the intended URL.

"&is_rule=", rule_meta !== undefined,
"&recommended=", rule_meta.docs.recommended,
"&fixable=", rule_meta.fixable,
"&suggestions=", rule_meta.hasSuggestions
] | join %}
{% set cover_image_alt = site.shared.eslint_logo_alt %}
{% set page_url = ["https://", site.hostname, relative_page_url ] | join %}

<!-- SEO -->
Expand Down