Skip to main content
# Lektor Gitlab

Query the Gitlab API right from your [Lektor][1] templates.

## Configuration

To use the plugin you must first acquire an [private access token][2].
The token must at least have the `api` scope.

Depending on your preference you can either create a Lektor config file
called `configs/gitlab.ini` where the token is stored under the
`private_token` key.

Eg:
```ini
private_token = <Your access token>
```

Alternatively the token can also be set using an environment variable.

__Note__: the config file is checked before the environment variable

Eg:
```bash
export GITLAB_PRIVATE_TOKEN=<Your access token>
```

## Usage

After you have set up the access token, the [Python-Gitlab][3] `Gitlab`
object is available in your templates. This means you can do anything
your heart desires with it.

### Examples

List your public repos

```jinja2
<ul>
{% for project in gitlab.projects.list(owned=True, visibility='public') %}
<li>{{ project.name }} [{{ project.star_count }}]</li>
{% endfor %}
</ul>
```

Display the your name and avatar

```jinja2
<h2>{{ gitlab.user.name }}</h2>
<img src="{{ gitlab.user.avatar_url }}">
```

[1]: https://www.getlektor.com
[2]: https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
[3]: http://python-gitlab.readthedocs.io/en/stable/index.html

Release files for lektor-gitlab 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lektor-gitlab 0.1.0
File Size Uploaded
lektor-gitlab-0.1.0.tar.gz 1.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lektor-gitlab 0.1.0
File Interpreter ABI Platform
lektor_gitlab-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.1 kB

Release files / lektor-gitlab-0.1.0.tar.gz

Download URL lektor-gitlab-0.1.0.tar.gz
Size 1.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7e3fd6b8571acf1837054d2159234644a4987fbae07ffeb3a8dbe47ae0773175
BLAKE2b-256 checksum
How to use checksums
9951565b03f483ff36542ffc8fcde1f3dee262ff9cdbbbca3b3b285d037d08e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / lektor_gitlab-0.1.0-py3-none-any.whl

Download URL lektor_gitlab-0.1.0-py3-none-any.whl
Size 2.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f230cefe8d2c177225e00f7aad1c8e657407a48522141d53668d5a75b7d5dc68
BLAKE2b-256 checksum
How to use checksums
0b7f6348b167b7987aedf4b1d437d9b97e024897f321b78fd975b4367d304d8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page