Help:Shortcode Moderators

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

Moderators
Shortcode
Description
TypeHTML Shortcode
Nested?false
Shortcodemoderators
Return TypeHTML
Short Description
Display a list of moderators with an avatar in front of their names.
Development
MaintainerMichael Sasser

The moderators shortcode renders a table of all moderators 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 moderators shortcode has no parameters.

Examples

{{< moderators >}}

Code

Below you find the implementation of the shortcode.

HTML

Defined in layouts/shortcodes/moderators.html.

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

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

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

  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)

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

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

  Changelog
  =========

  Version 1
  ---------

  Initial release

-->

<!-- A variation of this shortcut is used in the reporting_issues shortcut -->

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Matrix</th>
      <th>Matrix Identifier</th>
    </tr>
  </thead>
  <tbody>
    {{ range where (where (where (where .Site.Pages "Section" "contributors")
    "Params.matrix_username" "!=" nil) "Params.matrix_identifier" "!=" nil)
    "Params.matrix_moderator" "==" 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 target="_blank" rel="noopener" href="https://app.element.io/#/user/{{ .Params.matrix_identitier }}">
          {{ .Params.matrix_username }}
        </a>
      </td>
      <td>
        <a
          class="text-body"
          target="_blank"
          href="https://app.element.io/#/user/{{ .Params.matrix_identitier }}"
        >
          {{ .Params.matrix_identifier }}
        </a>
      </td>
    </tr>
    {{ end -}}
  </tbody>
</table>

<p class="text-muted fst-italic fw-light" style="margin-top:-2.5em; margin-bottom:2em">
  If you click on a moderators 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.

  • Moderators Shortcode
    moderators.html2.52 KB
  • md5   11c3779d084724c40e3dcedf6c3ca60e
  • sha1   2a76923bf89338afbfd312002454403d65403e76
  • sha256   351a6704859b5273113265c8bcb1c7cf19a40c5f5756056f2e4008bc8a087428

SASS

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

This code is licensed under the MIT license.

The moderators shortcode uses the styles from the contributors shortcode, as it is derived from it.

Help:Shortcode Contributors
Display a table of contributors with their avatar in front of their names.
/*

  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