https://github.com/marksteve/lektor-github-repos
Fetches your GitHub repos for display in Lektor templates
https://github.com/marksteve/lektor-github-repos
Last synced: about 1 year ago
JSON representation
Fetches your GitHub repos for display in Lektor templates
- Host: GitHub
- URL: https://github.com/marksteve/lektor-github-repos
- Owner: marksteve
- Created: 2015-12-25T04:33:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-25T06:17:12.000Z (over 10 years ago)
- Last Synced: 2025-03-27T14:09:36.008Z (about 1 year ago)
- Language: Python
- Homepage: https://pypi.python.org/pypi/lektor-github-repos
- Size: 11.7 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lektor-github-pages
Fetches your GitHub repos for display in Lektor templates
[Demo](https://marksteve.com/lektor-github-repos)
## Enabling the plugin
To enable the plugin add this to your project file:
```
[packages]
lektor-github-repos = 0.1.1
```
## Generate a personal access token
If you're only accessing public repos, the GitHub API allows you
to only make 60 unauthenticated requests per hour. But that goes up
to 5,000 requests per hour with authentication and it's not that hard to do:
Go to https://github.com/settings/tokens/new and generate a token. You
can untick all scopes to get public access.
## Create the config file
Create `configs/github-repos.ini` with the following content:
```
[github-repos]
token =
```
## Use in your templates
The plugin adds `get_github_repos()` and `get_top_github_repos()` to the template
context. Both accept the same parameters as with the user repos API call
(https://developer.github.com/v3/repos/#list-your-repositories).
`get_top_github_repos` also sorts repos by stargazers and accepts an additional
param `count`.
### Get latest pushed repositories
```
-
{{ repo.name }}
{{ repo.description }}
{% for repo in get_github_repos(sort="pushed") %}
{% endfor %}
```
### Get 10 latest updated repositories sorted by stargazers
```
-
[{{ repo.stargazers_count }} stars]
{{ repo.name }}
{{ repo.description }}
{% for repo in get_top_github_repos(type="owner", sort="updated", count=10) %}
{% endfor %}
```
## In action
* [My homepage](https://marksteve.com)