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
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
Smart Display Behavior
- Displayed format:
wpcy.com/t/123(withouthttps://) - Copied content:
https://wpcy.com/t/123(full URL) - Copy feedback: Button text changes to “Copied ✓”
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)
- Go to your Discourse Admin Dashboard
- Navigate to Appearance → Themes
- Click Install → From Git Repository
- Enter the repository URL:
https://github.com/Cyberforums/discourse-shortlink-component - Click “Install”
Method 2: Upload ZIP File
- Download the component ZIP package
- Go to your Discourse Admin Dashboard
- Navigate to Appearance → Themes
- Click Install → From Local File
- Select and upload the ZIP file
Enabling the Component
After installation, you must add the component to your active theme:
- In the theme list, locate your currently active theme
- Click into its settings
- In the “Components” section, click “Add Component”
- Select “WPCommunity Shortlink”
- Save your changes
Component Settings
| Setting | Default Value | Description |
|---|---|---|
short_domain |
wpcy.com |
Domain used to generate short links |
Modifying Settings
- Go to Appearance → Themes
- Find and click on the “WPCommunity Shortlink” component
- Modify configuration in the Settings tab
- Save changes
How to Use
Getting a Topic’s Short Link
- Open any topic page
- Scroll to the bottom of the topic
- Locate the “Short Link” button (link icon)
- Click the button
- In the pop-up modal, click the “Copy” button
- 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
.gjsformat - 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:
- Discourse side (this component): Generates the short link
- 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:
- Whether the component has been added to your current theme
- Try a hard refresh (Ctrl+Shift+R)
- Check browser console for errors
Q: Copy functionality isn’t working?
A: Possible causes:
- Browser doesn’t support Clipboard API (requires HTTPS)
- Browser blocks clipboard access
- 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
- Go to Appearance → Themes
- Find the “WPCommunity Shortlink” component
- Click the “Check for Updates” button
- If an update is available, click “Update”
Manual Update
- Remove the current component
- 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
- Install the component (via Git repository)
- Make code changes and push them
- In the Discourse admin panel, click “Check for Updates”
- 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