mkdocs-git-authors-plugin icon indicating copy to clipboard operation
mkdocs-git-authors-plugin copied to clipboard

Plain text output for HTML meta tag

Open AlphaJack opened this issue 3 years ago • 1 comments

I was wondering if there was a way to get a plain text list of authors, i.e.

Turbato Thomas, Elodeon Nick

instead of

<span class="git-page-authors git-authors"><a href="mailto:[email protected]">Turbato Thomas</a> (98.0%), <a href="mailto:[email protected]">Elodeon Nick</a> (2.0%)</span>

In this way one could set the page "author" meta tag without the need to specify authors manually in the markdown file, as MkDocs Material does here:

{% if page and page.meta and page.meta.author %}
  <meta name="author" content="{{ page.meta.author }}">
{% elif config.site_author %}
  <meta name="author" content="{{ config.site_author }}">
{% endif %}

Setting the tag would also make the website appear like this in Firefox reader view: authors

AlphaJack avatar Mar 04 '21 21:03 AlphaJack

I was wondering if there was a way to get a plain text list of authors, i.e.

Yes, you could use the {{ git_info }} object to achieve this when overriding a template block. See the docs for an example: https://timvink.github.io/mkdocs-git-authors-plugin/usage.html#in-theme-templates

In this way one could set the page "author" meta tag without the need to specify authors manually in the markdown file, as MkDocs Material does here:

I am not sure I understand your use case.

That said, adding an option to set plain_text: true shouldn't be too much work, and I'd gladly accept a PR for this.

timvink avatar Mar 07 '21 14:03 timvink

Note that you can now either:

  • Set the option show_email_address to false (https://timvink.github.io/mkdocs-git-authors-plugin/options.html#show_email_address)
  • Use theme customization and the git_info variable to customize your site

timvink avatar Nov 02 '22 20:11 timvink