diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index d005a16e..9199925a 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -296,7 +296,7 @@ In order to add images to the gallery, use `img` tags for each image and add `cl | Parameter | Description | -| --------- | ----------------------------------------------------- | +|-----------|-------------------------------------------------------| | `repo` | [String] github repo in the format of `username/repo` | @@ -310,6 +310,30 @@ In order to add images to the gallery, use `img` tags for each image and add `cl


+## GitLab Card + +`gitlab` allows you to quickly link a GitLab Project (GitLab's jargon for repo). +It displays realtime stats about it, such as the number of stars and forks it has. +Unlike `github` it can't display the main programming language of a project. +Finaly custom GitLab instace URL can be provided, as long as the `api/v4/projects/` endpoint is available, making this shortcode compatible with most self-hosted / entreprise deployments. + + +| Parameter | Description | +|-------------|------------------------------------------------------------------------| +| `projectID` | [String] gitlab numeric ProjectID | +| `baseURL` | [String] optional gitlab instace URL, default is `https://gitlab.com/` | + + +**Example 1:** + +```md +{{}} +``` + +{{< gitlab projectID="278964" >}} + +


+ ## Icon `icon` outputs an SVG icon and takes the icon name as its only parameter. The icon is scaled to match the current text size. diff --git a/layouts/shortcodes/gitlab.html b/layouts/shortcodes/gitlab.html new file mode 100644 index 00000000..ce210dac --- /dev/null +++ b/layouts/shortcodes/gitlab.html @@ -0,0 +1,39 @@ +{{- $gitLabData := getJSON (print (default "https://gitlab.com/" (.Get "baseURL")) "api/v4/projects/" (.Get "projectID")) -}} +{{- with $gitLabData -}} + + +
+ +
+ + {{ partial "icon.html" "gitlab" }} + +
+ {{ .name_with_namespace | markdownify | emojify }} +
+
+ +

+ {{ .description | markdownify | emojify }} +

+ +
+ + {{ partial "icon.html" "star" }} + +
+ {{ .star_count }} +
+ + + {{ partial "icon.html" "fork" }} + +
+ {{ .forks_count }} +
+ +
+ +
+
+{{- end -}}