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

Github repo stars and forks component counters doesn't shows up #421

Closed
elvismdev opened this issue Aug 1, 2017 · 17 comments
Closed

Github repo stars and forks component counters doesn't shows up #421

elvismdev opened this issue Aug 1, 2017 · 17 comments
Assignees
Labels
bug Issue reports a bug

Comments

@elvismdev
Copy link

Description

The Github repo stars and forks counters doesn't shows up.

Expected behavior

I expect them to show up like in the demo and documentation page http://squidfunk.github.io/mkdocs-material/

image

Actual behavior

Instead it comes up with the "vendor/package" slug name only, without nothing under it. Also no JS errors in the console or in the mkdocs serve log in my console once I run it to develop from http://127.0.0.1:8000/

image

If I "inspect elements" and compare with the markup from the demo, I see this part is completely missing on my end.

<ul class="md-source__facts"
    <li class="md-source__fact">621 Stars</li>
    <li class="md-source__fact">170 Forks</li>
</ul>

Steps to reproduce the bug

  1. Install the latest version of Material with pip: pip install mkdocs-material
  2. Add the following line to mkdocs.yml: theme: 'material'
  3. Run the built-in dev-server: mkdocs serve
  4. Open up http://127.0.0.1:8000/ in the browser

Package versions

  • Python: Python 2.7.10
  • MkDocs: mkdocs, version 0.16.3
  • Material: Version: 1.7.5

Project configuration

site_name: Starter WordPress Theme
repo_url: https://github.com/vendorname/starter-wp-theme
repo_name: vendorname/starter-wp-theme
edit_uri: edit/master/docs
site_author: Elvis Morales
site_description: A WordPress starter theme.
theme: material
pages:
  - About: index.md
  - Getting Started: getting-started.md
  - Helper Functions: helper-functions.md


# Copyright
copyright: 'Copyright &copy; 2016 - 2017 Elvis Morales'


# Options
extra:
  feature:
    tabs: false
  palette:
    primary: red
    accent: red
  social:
    - type: globe
      link: https://companyname.com
    - type: github-alt
      link: https://github.com/companyname
    - type: twitter
      link: https://twitter.com/companyname
    - type: linkedin
      link: https://linkedin.com/companyname

markdown_extensions:
  - toc:
      permalink: true```

### System information

* OS: macOS Sierra 10.12.5
* Browser: Google Chrome Version 59.0.3071.115
@squidfunk
Copy link
Owner

Is there some error to see in the network inspector? It seems that the request failed.

@squidfunk
Copy link
Owner

Also try to delete the cooke which caches results and is called: ${HASH}.cache-sources

@elvismdev
Copy link
Author

@squidfunk I tried deleting the cookie ${HASH}.cache-source but same result. Also any error comes up in the network inspector, all requests are 200 OK.

image

This is the repo I'm putting this documentation together: https://github.com/forumone/gesso-wp

Any other thoughts why stars and forks numbers are failing to show up?

@squidfunk
Copy link
Owner

Nope, I cannot reproduce this, it's perfectly working.

@squidfunk
Copy link
Owner

I managed to reproduce it. There a reonly 30 repos returned from the GitHub API, so we need to paginate if the repo is not found and there are more than 30.

@squidfunk squidfunk self-assigned this Aug 3, 2017
@squidfunk squidfunk added the bug Issue reports a bug label Aug 3, 2017
@elvismdev
Copy link
Author

Yes that should be it, seems like for user accounts/organizations that has more than 30 repos, if not found the repository on the first response to api.github.com/users/orgname, then it should paginate for more until it find's it.

Glad you were able to reproduce it!

@squidfunk
Copy link
Owner

squidfunk commented Aug 7, 2017

Rather tricky figuring out how to do an endless Promise chain, but managed to implement it in #429. Will release 1.8.1 shortly.

@squidfunk
Copy link
Owner

Just released 1.8.1, please re-open in case of problems.

@yks0000
Copy link

yks0000 commented May 9, 2018

I am seeing this issue again in version 2.7.3.

@squidfunk
Copy link
Owner

Please re-open the issue and provide more information when you're seeing this. Ideally a reproducible scenario. Thanks!

@dgomesbr
Copy link

This is something that just happened to my repo, you can get rate limited by GH

@squidfunk
Copy link
Owner

squidfunk commented May 11, 2020

GitHub requests were refactored in v5, so running into the rate limit should be rather unlikely.

@dgomesbr
Copy link

Thank you!

@dgomesbr
Copy link

Just to leave it here, my issue was that in a VPN most of my team was using the same IP address, so we reached the limit quickly. Loading the portal without VPN was working fine.

@rod2ik
Copy link

rod2ik commented Jun 11, 2022

Hi,
I'm trying to integrate PyScript with material-mkdocs.
It works fine, but it makes the stars and forks block disapear (in the upper right corner, aside the GitHub/GitLab repo name)
Here are my configs :

In mkdocs.yml:

theme:
  name: material
  custom_dir: overrides

extra_css:
    - https://pyscript.net/alpha/pyscript.css

in overrides/main.html:

{% extends "base.html" %}

{% block scripts %}
    <script defer src="https://pyscript.net/alpha/pyscript.js"></script>
{% endblock %}

In an .md file:

<div>
<py-script>
    print("Hello World")
</py-script>
<br/>
<p><strong>Today is <label id='date'></label></strong></p>
<py-script>
import time
pyscript.write('date', time.strftime('%d/%m/%Y %H:%M:%S'))
</py-script>
<br/>

<py-script>  
    print("Let's evaluate π :")
    def eval_pi(n):
        pi = 2
        for i in range(1,n):
            pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
        return pi
    pi = eval_pi(100000)
    s = "&nbsp;" * 10 + f"π is approximately {pi:.5f}"
    print(s)
</py-script>
<br/>

<div id="hey"></div>
<py-script>
pyscript.write('hey', f'Hey Mate !')
</py-script>
</div>

Can you reproduce the problem?
Is there anything we could do to solve this ?

@squidfunk
Copy link
Owner

squidfunk commented Jun 12, 2022

If you override scripts, you're effectively removing the entire application logic of Material for MkDocs, so there's no wonder nothing works anymore (including search, code annotations, etc.). Try extending the block:

{% extends "main.html" %}

{% block scripts %}
  {{ super() }}

  <!-- Your overrides -->
{% endblock% }

@rod2ik
Copy link

rod2ik commented Jun 12, 2022

Perfect answer (of course..). Works like a charm. Thankxx
For reference, just in case it helps :
Configs Page : eskool.gitlab.io/mkhack3rs/pyscript/
Example of Script : eskool.gitlab.io/mkhack3rs/pyscript/examples/

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

No branches or pull requests

5 participants