Help:Shortcode Contributors

Display a table of contributors with their avatar in front of their names.

Contributors
Shortcode
Description
TypeHTML Shortcode
Nested?false
Shortcodecontributors
Return TypeHTML
Short Description
Display a list of contributors with an avatar in front of their names.
Development
MaintainerMichael Sasser

The contributors shortcode renders a table of all contributors from the data entered in the front matter of their contributor page.

For more information on how to create a contributor, check out the Contributor documentation.

Help:Contributors
Create a contributor's profile page.

Parameters

The contributors shortcode has no parameters.

Examples

{{< contributors >}}
Rendered
NameGitLabMatrixMatrix Identifier
   Michael SasserMichaelSasserMichael Sasser@michael:michaelsasser.org

If you click on a contributors name or avatar, you get their profile page

Code

Below you find the implementation of the shortcode.

HTML

Defined in layouts/shortcodes/contributors.html.

This code is licensed under the MIT license.
<!--

  Contributors Shortcode
  ======================

  Contributors: Michael Sasser
  Maintainer: Michael Sasser
  License: MIT
  Version: 1
  Child Shortcodes: None
  Parent Shortcodes: None

  LAYOUT: /layouts/shortcodes/contributors.html
  STYLE:  /assets/scss/components/_shortcode_contributors.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Contributors.md
  PREP:   /utils/get_matrix_users
  DATA:   /data/matrix_users.json
  CI:     /gitlab-ci.yml (get-data)

  Description
  -----------

  Use the contributors shortcode to display a list of contributors with an
  avatar infront of their names.

  Changelog
  =========

  Version 1
  ---------

  Initial release

-->

<table>
  <thead>
    <tr>
      <th>{{ i18n "name" | title }}</th>
      <th>GitLab</th>
      <th>Matrix</th>
      <th>{{ i18n "matrix-identifier" | title }}</th>
    </tr>
  </thead>
  <tbody>
    {{ range where
               (where
                 (where
                   (where .Site.Pages "Section"  "contributors")
                 "Params.matrix_username" "!=" nil)
               "Params.matrix_identifier" "!=" nil)
             "Params.gitlab_username" "!=" nil
    -}}

      {{ if or (eq .Params.website_content true) (eq .Params.website_developer true) }}

        {{- $matrix_user_identifier := .Params.matrix_identifier }}

        {{- $avatar := "" -}}
        {{ if isset $.Site.Data "matrix_users" }}
          {{- range $.Site.Data.matrix_users -}}
            {{- if eq .userId $matrix_user_identifier  -}}
              {{- with .avatar -}}
                {{- $avatar = (printf "https://matrix.org/_matrix/media/r0/thumbnail/%s?width=64&height=64&method=scale" (substr  . 6)) -}}
              {{- end -}}
            {{- end -}}
          {{- end -}}
        {{- end -}}

      <tr>
        <td>
          <a href="{{ .RelPermalink }}">

            {{- with $avatar -}}
            <img
              width="25"
              height="25"
              src="{{- . -}}">
            </img>
            {{- end -}}
            &ThickSpace; {{ .Params.title }}
          </a>
        </td>
        <td>
          <a href="https://gitlab.com/{{ .Params.gitlab_username }}">
            {{ .Params.gitlab_username }}
          </a>
        </td>
        <td>
          <a href="https://app.element.io/#/user/{{ .Params.matrix_identitier }}">
            {{ .Params.matrix_username }}
          </a>
        </td>
        <td>
          <a
            class="text-body"
            href="https://app.element.io/#/user/{{ .Params.matrix_identitier }}"
          >
            {{ .Params.matrix_identifier }}
          </a>
        </td>
      </tr>
      {{ end -}}
    {{ end -}}
  </tbody>
</table>

<p class="text-muted fst-italic fw-light" style="margin-top:-2.5em; margin-bottom:2em">
  If you click on a contributors name or avatar, you get their profile page
</p>

Download

Copy the source code above or use the download link below to use this file on your website according to the license.

  • Contributors Shortcode
    contributors.html2.88 KB
  • md5   f3a527c5e1d75697b99c8096a4034916
  • sha1   547bd095d82632f693bd856761df072fe5063fa7
  • sha256   53c04767ad1731ee727953a9f2a2fb5cb9c74c4426fa637a25526315999f96c0

SASS

Defined in: /assets/scss/components/_shortcode_contributors.scss

This code is licensed under the MIT license.
/*

  Contributors Shortcode
  ======================

  Contributors: Michael Sasser
  Maintainer: Michael Sasser
  License: MIT
  Version: 1
  Child Shortcodes: None
  Parent Shortcodes: None

  LAYOUT: /layouts/shortcodes/contributors.html
  STYLE:  /assets/scss/components/_shortcode_contributors.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Contributors.md
  PREP:   /utils/get_matrix_users
  DATA:   /data/matrix_users.json
  CI:     /gitlab-ci.yml (get-data)

  Moderators Shortcode
  =====================

  LAYOUT: /layouts/shortcodes/moderators.html
  STYLE:  /assets/scss/components/_shortcode_contributors.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Moderators.md
  PREP:   /utils/get_matrix_users
  DATA:   /data/matrix_users.json
  CI:     /gitlab-ci.yml (get-data)

*/

.contributor-social {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0;
  margin-bottom: 2em;
  margin-top: 2em;
  list-style: none;
  justify-content: center;
}

.social-item,
.social li {
  margin-left: 20px;
  margin-right: 20px;
}

Download

Copy the source code above or use the download link below to use this file on your website according to the license.

  • Contributors Style
    _shortcode_contributors.scss1.05 KB
  • md5   d94c4fd2ddbbcf02d13b32fb1e1bbf5a
  • sha1   d8152b00ff3c8c1fec5cc83e9d654f20c906e199
  • sha256   eff359cba51ef98eb361b4bbd791d97dd0398340de817e4ba77f4f08e11042cc
Top