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

Supports custom robots tags #224

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dlackty
Copy link
Contributor

@dlackty dlackty commented Dec 14, 2020

As titled, this PR make meta-tags support things like:

<meta name="robots" content="max-snippet:-1, max-video-preview:-1">

@dlackty dlackty force-pushed the custom-robots branch 2 times, most recently from 89c0bf9 to 8e9ab54 Compare September 28, 2021 17:47
@dlackty
Copy link
Contributor Author

dlackty commented Sep 28, 2021

@kpumuk Hi, I've rebased the branch and fixed CI failures.
Could you please have a look on this and let me know what you think? I believe this would be a nice addition for the gem.
Thank you for all the great work of meta-tags!

robots = extract(:robots).presence
if robots
result['robots'].concat(robots.map { |k, v| "#{k}:#{v}" })
end
Copy link
Owner

Choose a reason for hiding this comment

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

Wonder what would be the expected behavior for cases when a specific bot is configured, like

set_meta_tags(nofollow: 'googlebot', robots: 'nosnippet')

Or, for example, how to configure nosnippet for one bot, but no the others...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting question that I didn't think about.
For that case, how about just set_meta_tags(googlebot: 'nosnippet')?

To implement this, I would tweak extract_robots and check for hash keys /[google|bing]bot/, the only two that I found support nosnippet and other snippet-related configs.

@dlackty dlackty force-pushed the custom-robots branch 3 times, most recently from 8fd9506 to e1d44ac Compare January 27, 2023 19:50
@dlackty
Copy link
Contributor Author

dlackty commented Jan 27, 2023

@kpumuk Hi Dmytro, I just updated this PR and tried to fix addressed issues. Could you please have a look again? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants