An open API service indexing awesome lists of open source software.

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

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

```


    {% for repo in get_github_repos(sort="pushed") %}

  • {{ repo.name }}
    {{ repo.description }}

  • {% endfor %}

```

### Get 10 latest updated repositories sorted by stargazers

```


    {% for repo in get_top_github_repos(type="owner", sort="updated", count=10) %}

  • [{{ repo.stargazers_count }} stars]
    {{ repo.name }}
    {{ repo.description }}

  • {% endfor %}

```

## In action

* [My homepage](https://marksteve.com)