Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hashtag Support to Mastopod for Enhanced Content Discovery #44

Open
outlaw-dame opened this issue Dec 7, 2024 · 0 comments
Open

Comments

@outlaw-dame
Copy link

Description

Currently, Mastopod lacks native support for hashtags, a feature essential for content categorization and discovery in social networks. Adding hashtag functionality would enhance user experience by enabling content grouping, trend identification, and interactivity.

This feature aligns with ActivityPub standards, allowing hashtags to function as linked data objects that can be used across federated networks.

Proposed Feature

Introduce native support for hashtags, including:
1. Hashtag Detection: Automatically extract hashtags (e.g., #example) from post content.
2. Hashtag Storage: Maintain a database of hashtags and their relationships with posts.
3. Hashtag Pages: Create pages for individual hashtags to display all associated posts.
4. Trending Hashtags: Add a system to track and display trending hashtags.
5. ActivityPub Compliance: Ensure hashtags are included in Note activities as linked tags.

Key Features

  1. Backend Changes
    • Extend the database schema:
    • Add a tags table to store hashtags and metadata (e.g., usage count).
    • Create a post_tags table to manage the many-to-many relationship between posts and hashtags.
    • Implement hashtag extraction during post creation.
    • Add API endpoints:
    • Fetch posts by hashtag: /tags/:tagName/posts
    • Fetch trending hashtags: /tags/trending

  2. Frontend Changes
    • Render Hashtags:
    • Automatically convert hashtags in posts into clickable links.
    • Hashtag Pages:
    • Create a dedicated page for each hashtag to display associated posts.
    • Trending Hashtags:
    • Display a list of trending hashtags on the main page or a dedicated trends section.

  3. ActivityPub Compliance
    • Include hashtags in the tags property of Note objects as ActivityPub-compatible Hashtag entities.

Benefits
1. Improved Content Discovery:
• Users can easily find and follow posts related to specific topics or interests.
2. Enhanced User Engagement:
• Hashtags create natural groupings, encouraging participation in broader conversations.
3. ActivityPub Interoperability:
• Supports federated functionality by aligning hashtags with the ActivityPub specification.
4. Customization Opportunities:
• Enables future enhancements like hashtag filtering, muting, or analytics.

Example Implementation

Post Schema

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Note",
"content": "This is a #test post",
"tags": [
{
"type": "Hashtag",
"name": "#test",
"href": "https://example.com/tags/test"
}
]
}

API Endpoints
• Fetch posts by hashtag:

GET /tags/:tagName/posts

•	Fetch trending hashtags:

GET /tags/trending

Frontend Rendering
• Posts:
• Convert hashtags in post content into clickable links.
• Tag Pages:
• Display all posts associated with a specific hashtag.

Potential Challenges
1. Hashtag Abuse:
• Users may misuse hashtags for spam or inappropriate content.
• Solution: Implement hashtag moderation tools.
2. Performance:
• Frequent querying for hashtags could slow down performance.
• Solution: Optimize database queries and add indexing.
3. Trending Manipulation:
• Bots or users may manipulate trending hashtags.
• Solution: Use decay mechanisms to score trends dynamically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant