WPCommunity Shortlink Theme Component User Guide

WPCommunity Shortlink Theme Component User Guide

Component Overview

WPCommunity Shortlink is a Discourse theme component that enables users to generate and copy short links with a single click from topic pages. When used alongside the WordPress-side short-link plugin, it delivers a seamless content-sharing experience for community members.

Key Features

:link: One-Click Short Link Generation

  • Displays a “Short Link” button at the bottom of each topic
  • Clicking opens a modal showing the short link
  • One-click copy to clipboard

:clipboard: Smart Display Behavior

  • Displayed format: wpcy.com/t/123 (without https://)
  • Copied content: https://wpcy.com/t/123 (full URL)
  • Copy feedback: Button text changes to “Copied ✓”

:globe_with_meridians: Multilingual Support

  • Built-in Chinese and English UI
  • Automatically adapts to the user’s language preference

Installation Methods

Method 1: Install from Git Repository (Recommended)

  1. Go to your Discourse Admin Dashboard
  2. Navigate to Appearance → Themes
  3. Click Install → From Git Repository
  4. Enter the repository URL:
    https://github.com/Cyberforums/discourse-shortlink-component
    
  5. Click “Install”

Method 2: Upload ZIP File

  1. Download the component ZIP package
  2. Go to your Discourse Admin Dashboard
  3. Navigate to Appearance → Themes
  4. Click Install → From Local File
  5. Select and upload the ZIP file

Enabling the Component

After installation, you must add the component to your active theme:

  1. In the theme list, locate your currently active theme
  2. Click into its settings
  3. In the “Components” section, click “Add Component”
  4. Select “WPCommunity Shortlink”
  5. Save your changes

Component Settings

Setting Default Value Description
short_domain wpcy.com Domain used to generate short links

Modifying Settings

  1. Go to Appearance → Themes
  2. Find and click on the “WPCommunity Shortlink” component
  3. Modify configuration in the Settings tab
  4. Save changes

How to Use

Getting a Topic’s Short Link

  1. Open any topic page
  2. Scroll to the bottom of the topic
  3. Locate the “Short Link” button (link icon)
  4. Click the button
  5. In the pop-up modal, click the “Copy” button
  6. The short link is now copied to your clipboard — ready to paste and share

Short Link Format

The short link generated by this component follows this format:

https://wpcy.com/t/TopicID

For example, the short link for topic ID 123 is:

https://wpcy.com/t/123

UI Preview

Topic Footer Button

A link-icon button appears in the action bar at the bottom of each topic. Hovering displays the tooltip “Get short link for this topic.”

Modal Dialog

Clicking the button opens a modal containing:

  • Title: “Topic Short Link”
  • Input field: Displays the short link (read-only)
  • Copy button: Click to copy to clipboard
  • Close button: Dismisses the modal

Technical Architecture

File Structure

discourse-shortlink-component/
├── about.json                           # Component metadata
├── settings.yml                         # Configuration options
├── README.md                            # Documentation
├── LICENSE                              # MIT License
├── common/
│   └── common.scss                      # Styles
└── javascripts/discourse/
    ├── api-initializers/
    │   └── shortlink-button.js          # Main entry & translation injection
    └── components/
        ├── shortlink-footer-button.js   # Footer button logic
        ├── shortlink-footer-button.hbs  # Footer button template
        ├── post-shortlink-button.gjs    # Inline post button
        └── modal/
            └── shortlink-modal.gjs      # Modal component

Tech Stack

  • Glimmer Components: Uses Discourse’s latest .gjs format
  • Ember.js: Underlying framework
  • Discourse Plugin API: v0.11.1+

Compatibility

Item Version
Minimum Discourse Version 3.6.0
Tested Discourse Version 2026.1.0

Integration with WordPress Plugin

The short links generated by this component require coordination with the WordPress-side short-link plugin:

  1. Discourse side (this component): Generates the short link
  2. WordPress side (discourse-shortlinks.php): Handles redirection

Workflow:

User copies wpcy.com/t/123
        ↓
User shares link with others
        ↓
Others visit wpcy.com/t/123
        ↓
WordPress plugin processes request
        ↓
301 redirect to wpcommunity.com/t/-/123
        ↓
Discourse topic page opens

Frequently Asked Questions

Q: The button doesn’t appear?

A: Please check:

  1. Whether the component has been added to your current theme
  2. Try a hard refresh (Ctrl+Shift+R)
  3. Check browser console for errors

Q: Copy functionality isn’t working?

A: Possible causes:

  1. Browser doesn’t support Clipboard API (requires HTTPS)
  2. Browser blocks clipboard access
  3. Try manually selecting and copying the text

Q: How do I customize the domain?

A: Change the short_domain value in component settings — remember to update the corresponding configuration on the WordPress side.

Q: Can anonymous users see the button?

A: Yes — all users, including unauthenticated visitors, can see and use the short link feature.

Updating the Component

Updating from Git Repository

  1. Go to Appearance → Themes
  2. Find the “WPCommunity Shortlink” component
  3. Click the “Check for Updates” button
  4. If an update is available, click “Update”

Manual Update

  1. Remove the current component
  2. Reinstall it from the Git repository

Development & Contribution

Local Development

# Clone the repository
git clone https://github.com/Cyberforums/discourse-shortlink-component

# After editing code, push changes
git add .
git commit -m "feat: Description of new feature"
git push origin main

Testing in Discourse

  1. Install the component (via Git repository)
  2. Make code changes and push them
  3. In the Discourse admin panel, click “Check for Updates”
  4. Apply the update and refresh the page

Version History

  • v1.0.0 – Initial release
    • Short link button at topic footer
    • Modal display and copy functionality
    • Chinese and English UI support

Author: WPCommunity / Cyberforums
License: MIT
GitHub: discourse-shortlink-component