在页面中嵌入公共GitHub项目的列表
pelican-github-projects的Python项目详细描述
在页面中嵌入公共GitHub项目的列表。
安装
要安装pelican github项目,只需从pypi安装即可:
$ pip install pelican-github-projects
配置
在pelicanconf.py中启用插件
PLUGINS=[# ...'pelican-github-projects',# ...]
使用github用户名添加设置。
GITHUB_USER='kyah'
可用数据
name: | The name of your project. |
---|---|
language: | The language your project is written in, information on how GitHub detects languages is available here. It is GitHub that detects the language, not this plugin. So please, no issues about that. |
description: | The description of your project (as set on GitHub.) |
homepage: | The homepage of your project (as set on GitHub.) |
github_url: | The web page URL of your project on GitHub (not the GIT or API URL.) |
用法
在您的模板中,您将能够迭代github_项目 变量,如下所示。
{% if GITHUB_USER %} {% for project in github_projects %} <h2>{{ project.name }} {% if project.language %}<sup>({{ project.language }})</sup>{% endif %}</h2><p>{{ project.description }}</p><p> {% if project.homepage %} <ahref="{{ project.homepage }}">Homepage</a> {% endif %} <ahref="{{ project.github_url }}">GitHub</a></p> {% endfor %} {% endif %}
许可证
GPLv2许可证。