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

Fix warning with ogp_image_alt default #29

Merged
merged 1 commit into from
Jan 26, 2021

Conversation

tcmetzger
Copy link
Contributor

The way I had originally implemented support for ogp_image_alt led to a warning issued by sphinx make ("WARNING: The config value 'ogp_image_alt' has type 'str', defaults to 'bool'.") This pull request fixes the problem by making None the default value for this tag.

@TheTripleV
Copy link
Member

I don't like that setting a variable to None enables functionality. Could we redo this logic so None means no alt, and "" means fallthrough?

@tcmetzger
Copy link
Contributor Author

tcmetzger commented Jan 2, 2021

I'm happy to modify this in any way you want. However, there is one thing to consider:

In case an ogp_image is defined, but no ogp_image_alt is supplied (i.e. ogp_image_alt equals None) , the extension currently generates an og:image:alt tag based on site_name or title. The reason for this is that the official Open Graph Protocol says "If the page specifies an og:image it should specify og:image:alt." (https://ogp.me/#structured). Automatically generating an og:image:alt tag if an og:image is present is a direct implementation of the Open Graph Protocol.

If we change this behavior to only generate an og:image:alt tag if ogp_image_alt is set to a string or empty string, there will be cases where we end up with an og:image but no og:image:alt (and therefore deviate from what the Open Graph Protocol says).

Again, I'd be happy to adapt the code in any way you prefer, the decision is up to you as maintainers.

@Daltz333
Copy link
Member

Daltz333 commented Jan 22, 2021

I think that is reasonable, was there a different implementation that you wanted @ TheTripleV?

@Daltz333 Daltz333 merged commit cdeb4ed into wpilibsuite:master Jan 26, 2021
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.

3 participants