Skip to content

DOC: put the gallery keywords in the meta tag #22405

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

Merged
merged 2 commits into from
May 19, 2022

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Feb 5, 2022

PR Summary

Closes #22391

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@jklymak jklymak added this to the v3.6.0 milestone Feb 5, 2022
doc/conf.py Outdated
.. only:: html

.. rst-class:: sphx-glr-signature
.. meta::
:keywords: matplotlib code example, codex, python plot, pyplot
Copy link
Member Author

Choose a reason for hiding this comment

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

I guess the exact keywords are up for discussion.

@jklymak
Copy link
Member Author

jklymak commented Feb 5, 2022

With this PR the gallery, tutorials etc now have <meta content="matplotlib code example, codex, python plot, pyplot" name="keywords" />

doc/conf.py Outdated
.. only:: html

.. rst-class:: sphx-glr-signature
.. meta::
:keywords: matplotlib code example, codex, python plot, pyplot
Copy link
Member

Choose a reason for hiding this comment

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

Ah, so the keywords come from a template and are the same for all gallery pages. That makes them relatively unhelpful. I think we can remove everything but 'codex'

Suggested change
:keywords: matplotlib code example, codex, python plot, pyplot
:keywords: codex

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe? "Codex matplotlib ellipse" and "code example matplotlib ellipse" seem identical in search. Not sure if "code example matplotlib" would work as well? "Gallery matplotlib ellipse" also works. "Matplotlib ellipse" returns the method, so there is some benefit to adding "example" in the kwargs I think.

Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused what are keywords and what are example search strings in your answer.

Also, can somebody who understands the topic please clarify what the effect of these keywords is. Is that just some strings we put intro the site so that search can find these strings somewhere? Is this only for the internal search or is this targeted at external search engines as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was just talking about google search terms. OTOH it seems that google ignores the keyword tag, so maybe this is not worth doing, or maybe we should explicitly include as we were before.

I have no idea how the internal search works.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, google does not use the keywords meta tag. If we want to add it, that should be for our internal purposes. And the only internal keyword purpose I see is the "codex" flag. Therefore my suggestion to delete everything else, we don't need to communicate to our internal search that we're matplotlib or about python plotting. The only thing I know about the internal search is that it's javascript that somehow parses the html sources. Empirically, this PR shows that "codex" is still found in the keywords meta tag. That's why I suggested to only keep "codex".

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Should we add a test that checks the header of Sphinx gallery against a copy of the unmodified version? That way we will be notified if sphinx gallery changes the content and we can adapt our modified version.

@story645
Copy link
Member

is there anything holding this PR up or did it just fall off the radar?

@jklymak
Copy link
Member Author

jklymak commented May 19, 2022

I don't think there is any harm in this going it. May not particularly help though if google actually ignores keyword.

@story645 story645 merged commit fbcfea4 into matplotlib:main May 19, 2022
timhoffm added a commit to timhoffm/matplotlib that referenced this pull request May 21, 2022
We have copied the EXAMPLE_HEADER and patched it (matplotlib#22405). This ensures
we are notified if sphinx-gallery changes the EXAMPLE_HEADER. See the
test docstring for more details.
timhoffm added a commit to timhoffm/matplotlib that referenced this pull request May 22, 2022
We have copied the EXAMPLE_HEADER and patched it (matplotlib#22405). This ensures
we are notified if sphinx-gallery changes the EXAMPLE_HEADER. See the
test docstring for more details.
timhoffm added a commit that referenced this pull request May 22, 2022
We have copied the EXAMPLE_HEADER and patched it (#22405). This ensures
we are notified if sphinx-gallery changes the EXAMPLE_HEADER. See the
test docstring for more details.
andrew-fennell pushed a commit to andrew-fennell/matplotlib that referenced this pull request Jun 14, 2022
…lotlib#23092)

We have copied the EXAMPLE_HEADER and patched it (matplotlib#22405). This ensures
we are notified if sphinx-gallery changes the EXAMPLE_HEADER. See the
test docstring for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Doc]: Remove "keywords" line at the bottom of all examples
3 participants