Support wiki

This is the wiki.gg support wiki! It's a different site from your content wiki!

DiscordWidget

From Support Wiki
Jump to navigation Jump to search

DiscordWidget is a template that provides a way for wikis to show a Discord server widget.

Installation

Make sure you enable your Widget in your Discord Server Settings:

Server Settings > Engagement > Server Widget > Enable Server Widget

You can also find the server ID in this screen.

Gadget

Copy MediaWiki:Gadgets/DiscordWidget, MediaWiki:Gadgets/DiscordWidget/main.js, and Category:Pages_using_DiscordWidget to your wiki.

Template

Copy Template:Discord and Template:Discord/doc to your wiki.

Make sure to read the documentation there, and replace the provided server id with you own when you use it.

Customization (optional)

If you want to customize the appearance with CSS, create the page MediaWiki:Gadgets/DiscordWidget/custom.css on your wiki. However, the actual widget is loaded in an iframe controlled by Discord, so there's nothing you can do to it directly. Customization is limited to what can be done to the wrapper, which is mostly just positioning and borders. For example:

.DiscordIntegrator {
	/* center */
	margin:auto;
	
	border:1px solid var(--wiki-content-border-color);
	
	/* adding padding makes space for the background, creating a sort of "inner border" */
	padding:20px;
	background:var(--wiki-accent-color);
}

Paste {{Template:Discord}} anywhere.

Work with ThemeToggle

If the wiki has multiple themes, You can specify the discord widget's theme individually for each wiki theme by providing a configuration array in the data-theme attribute.

For example, say there are 3 themes defined at MediaWiki:Theme-definitions:

* blue[bundled]
* red
* purple

Now you want to use dark discord theme for blue and red wiki themes, and light theme for purple wiki theme. You can configure it in Template:Discord:

...
<span class="DiscordIntegrator"
  ...
  data-theme='{{{theme| {"blue":"dark", "red":"dark", "purple":"light"} }}}'
  ...

The configuration array must follow valid JSON syntax including quoted property names.

See also