-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Enhancement: Option to remove/customize repo counts #2307
Comments
Thanks for suggesting! Most users seem to love this feature, so I think it won't make sense to introduce an option to disable it. However, if many people need it, we can add a flag. Let's let the issue sit here for a while and see if a significant fraction of users want this feature. For the time being, you can use template overrides to achieve the same thing. Using Material 7 beta (#2290), you can patch the |
Thanks for specifying this! I found that GitHub: raw source.html <!-- theme/source.html -->
{% import "partials/language.html" as lang with context %}
<a
href="{{ config.repo_url }}"
title="{{ lang.t('source.link.title') }}"
style="display: block; font-size: .65rem; line-height: 1.2; white-space: nowrap; -webkit-backface-visibility: hidden; backface-visibility: hidden; transition: opacity 250ms;"
>
<div class="md-source__icon md-icon">
{% set icon = config.theme.icon.repo or "fontawesome/brands/git-alt" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</div>
<div class="md-source__repository">
{{ config.repo_name }}
</div>
</a> # For reference, this implementation requires custom_dir in mkdocs.yml
theme:
name: 'material'
custom_dir: 'theme' Regarding one of my original points:
Making a repo private isn't feasible for GitHub Free users, as it deletes their site 🙁
Source: GitHub Docs So the implementation outlined is the only current way to remove it |
@blakegearin when you're using 7.0.0 (i.e. the latest |
Ah, yes, I was able to upgrade from For anyone wanting to do the same thing here are the commands I had to run: # check version
python3 -m pip show mkdocs-material
# upgrade to latest commit
python3 -m pip install --upgrade git+https://github.com/squidfunk/mkdocs-material.git |
I decided not to go down this road for now. There doesn't seem to be a huge interest from other users and disabling this logic is as easy as overriding the partial and removing the |
As per the linked comment, removes the GitHub star counter, to avoid an unnecessary call to the GitHub API. squidfunk/mkdocs-material#2307 (comment)
* Add CSP Reduces the risk of accidentally leaking IP addresses to 3rd party services. * Also block api.github.com to avoid IP leak I found no obvious way to disable that in mkdocs-material. If anyone feels like digging: - https://github.com/squidfunk/mkdocs-material/blob/9655c3a92471f261533d48b8611a8d24dbfebb13/src/assets/javascripts/components/source/facts/github/index.ts#L62 - https://github.com/squidfunk/mkdocs-material/blob/9655c3a92471f261533d48b8611a8d24dbfebb13/src/assets/javascripts/components/source/facts/_/index.ts#L77 - https://github.com/squidfunk/mkdocs-material/blob/9655c3a92471f261533d48b8611a8d24dbfebb13/src/assets/javascripts/components/source/_/index.ts#L88 - https://github.com/squidfunk/mkdocs-material/blob/9655c3a92471f261533d48b8611a8d24dbfebb13/src/assets/javascripts/components/source/_/index.ts#L120 - https://github.com/squidfunk/mkdocs-material/blob/9655c3a92471f261533d48b8611a8d24dbfebb13/src/assets/javascripts/bundle.ts#L198 * Removes GitHub star counter As per the linked comment, removes the GitHub star counter, to avoid an unnecessary call to the GitHub API. squidfunk/mkdocs-material#2307 (comment) Co-authored-by: Lars Larsson <lars.larsson@elastisys.com>
Trying to follow along #2307 (comment) I seem to be having a little trouble setting this up |
I want to suggest an idea and checked that ...
Description
By default, star & fork counts are displayed on sites where
repo_url
is defined inmkdocs.yml
for GitHub and GitLab repositories that are open-source.I'd like to have the ability to turn off the counts.
Use Cases
It would prevent having to make a repository private (only way currently to remove counts)0 stars·0 forks
are sad (subjective) 🙁Screenshots / Mockups
Open to other flag names besides
repo_counts
🙂Looks like this section is now changed in Insiders. Perhaps it would be low effort while doing this enhancement to add more options besides on/off, such as specifying a subset of counts:
The text was updated successfully, but these errors were encountered: