Managing Links¶
This guide covers creating, editing, and managing links in Trunk8.
Creating Links¶
Access the Add Link Page¶
- Log in to Trunk8
- Click "Add Link" in the navigation
- Fill out the link form
Link Properties¶
Short Code¶
- Unique identifier for your link
- Examples:
docs
,report-2024
,team-photo
- Allowed characters: letters, numbers, hyphens, underscores
- Case-sensitive (use lowercase for consistency)
Link Type¶
Choose from four types:
- Redirect - Forwards to another URL
- File - Serves a downloadable file
- Markdown - Renders markdown as HTML
- HTML - Renders raw HTML content
Expiration Date (Optional)¶
- Set when the link should expire
- Format:
YYYY-MM-DD HH:MM:SS
- Expired links are automatically deleted
Type-Specific Fields¶
For Redirect Links¶
- Target URL: Full URL including
http://
orhttps://
- Examples:
https://github.com/lancereinsmith/trunk8
https://example.com/very/long/url/that/needs/shortening
For File Links¶
- Choose File: Select file to upload
- All file types supported
- Files are renamed for security
- Original filename preserved in download
For Markdown Links¶
Two options:
- Upload .md file: Select a markdown file
- Enter text: Type/paste markdown directly
For HTML Links¶
Two options:
- Upload .html file: Select an HTML file
- Enter HTML: Type/paste HTML content directly
Auto-Detection
HTML files uploaded to the markdown section are automatically detected and rendered as HTML.
Viewing Links¶
List All Links¶
- Click "List Links" in navigation
- View all links in a table with:
- Short code
- Link type
- Target/content preview
- Expiration status
- Action buttons
Link Information¶
Each link shows:
- Type icon: 🔗 (redirect), 📁 (file), 📝 (markdown), 💻 (HTML)
- Short code: Click to visit link
- Target: URL, filename, markdown preview, or HTML preview
- Expires: Expiration date or "Never"
Editing Links¶
Access Edit Page¶
- From the links list, click "Edit" button
- Or navigate to
/edit_link/shortcode
What Cannot Be Edited:¶
- Short code (delete and recreate instead)
What Can Be Edited¶
Redirect Links¶
- Target URL
File Links¶
- Upload a replacement file
- Original file is deleted
Markdown Links¶
- Edit markdown content
- Upload new markdown file
HTML Links¶
- Edit HTML content
- Upload new HTML file
All Link Types¶
- Expiration date
Saving Changes¶
- Make your modifications
- Click "Update Link"
- Confirmation message appears
Deleting Links¶
Delete Process¶
- From links list, click "Delete" button
- Confirm deletion in popup
- Link and associated files are removed
What Gets Deleted¶
- Link data from your user's
links.toml
file - Uploaded files (for file/markdown/HTML types)
- Cannot be recovered - backup first!
Bulk Operations¶
Direct TOML Editing¶
For bulk operations, edit your user's links.toml
file directly (located at users/{username}/links.toml
):
# Add multiple redirects
[links.github]
type = "redirect"
url = "https://github.com/lancereinsmith/trunk8"
[links.docs]
type = "redirect"
url = "https://trunk8.readthedocs.io"
[links.demo]
type = "redirect"
url = "https://demo.trunk8.com"
After editing:
- Save the file
- Trunk8 reloads automatically
- No restart required
Bulk Import Script¶
Create a Python script for bulk imports:
import toml
# Load existing links (use appropriate user directory)
with open('users/admin/links.toml', 'r') as f:
config = toml.load(f)
# Add new links
new_links = {
'link1': {'type': 'redirect', 'url': 'https://example1.com'},
'link2': {'type': 'redirect', 'url': 'https://example2.com'},
}
for code, data in new_links.items():
config['links'][code] = data
# Save
with open('users/admin/links.toml', 'w') as f:
toml.dump(config, f)
Organization Strategies¶
Naming Conventions¶
Use prefixes for organization:
doc-api
- API documentationdoc-user
- User guidefile-report
- Report downloadtemp-meeting
- Temporary link
Categories¶
Group related links:
# Team Resources
[links.team-handbook]
[links.team-calendar]
[links.team-directory]
# Project Alpha
[links.alpha-spec]
[links.alpha-demo]
[links.alpha-repo]
Temporary Links¶
For time-sensitive content:
- Set expiration date
- Links auto-delete after expiring
Search and Filter¶
Finding Links¶
Currently manual, but you can:
- Use browser's find (Ctrl/Cmd + F)
- Search in user's
links.toml
file
Future Enhancements¶
Planned features: - Search by short code - Filter by type - Sort by clicking column headers - Sort by expiration - Tag system
Best Practices¶
Do's¶
- ✅ Use descriptive short codes
- ✅ Set expiration for temporary content
- ✅ Organize with naming conventions
- ✅ Regular backups of user
links.toml
files - ✅ Test links after creation
Don'ts¶
- ❌ Use spaces in short codes
- ❌ Create duplicate codes
- ❌ Upload sensitive files without expiration
- ❌ Use special characters (except
-
and_
) - ❌ Forget to backup before bulk changes
Troubleshooting¶
Link Not Working¶
- Check short code spelling
- Verify link hasn't expired
- Ensure target URL is valid
- Check file still exists
Can't Edit Link¶
- Ensure you're logged in
- Check file permissions on server
- Verify user's
links.toml
isn't corrupted
Bulk Import Failed¶
- Validate TOML syntax
- Check for duplicate short codes
- Ensure file permissions allow writing
Advanced Usage¶
Programmatic Access¶
Access links directly:
import toml
# Read links
with open('users/admin/links.toml', 'r') as f:
links = toml.load(f)['links']
# Count by type
by_type = {}
for code, data in links.items():
link_type = data.get('type', 'unknown')
by_type[link_type] = by_type.get(link_type, 0) + 1
print(f"Total links: {len(links)}")
print(f"By type: {by_type}")
Custom Integrations¶
Create shortcuts or bookmarklets:
// Bookmarklet to create Trunk8 link
javascript:(function(){
const url = encodeURIComponent(window.location.href);
window.open('https://trunk8.example.com/add?url=' + url);
})();
Next Steps¶
- Learn about Link Types in detail
- Explore Theme Customization
- Configure Settings