UI/UX Improvements: Modern design + hashtag system + cover images

- Added modern CSS design system with better typography
- Created hashtag/tag functionality with auto-tagging
- Improved homepage with hero section and trending tags
- Enhanced article pages with full-width cover images
- Added tag pages for filtering articles by hashtag
- Better mobile responsive design
- Smoother animations and transitions
- Auto-tag system analyzes content and assigns relevant tags
- 30+ predefined AI-related tags (ChatGPT, OpenAI, etc.)
This commit is contained in:
Zeya Phyo
2026-02-19 13:49:45 +00:00
parent afa8fb8d78
commit 161dce1501
8 changed files with 1616 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
-- Add tags/hashtags system to Burmddit
-- Run this migration to add tag functionality
-- Tags are already in schema.sql, but let's ensure everything is ready
-- Add some default popular tags if they don't exist
INSERT INTO tags (name, name_burmese, slug) VALUES
('Breaking News', 'လတ်တလော သတင်း', 'breaking-news'),
('Tutorial', 'သင်ခန်းစာ', 'tutorial'),
('OpenAI', 'OpenAI', 'openai'),
('Google', 'Google', 'google'),
('Microsoft', 'Microsoft', 'microsoft'),
('Meta', 'Meta', 'meta'),
('DeepMind', 'DeepMind', 'deepmind'),
('Language Models', 'ဘာသာစကား မော်ဒယ်များ', 'language-models'),
('Computer Vision', 'Computer Vision', 'computer-vision'),
('Robotics', 'စက်ရုပ်နည်းပညာ', 'robotics'),
('Ethics', 'ကျင့်ဝတ်', 'ethics'),
('Research', 'သုတေသန', 'research'),
('Startup', 'စတင်လုပ်ငန်း', 'startup'),
('Funding', 'ရန်ပုံငွေ', 'funding'),
('Product Launch', 'ထုတ်ကုန်အသစ်', 'product-launch')
ON CONFLICT (slug) DO NOTHING;
-- Function to auto-generate tags from article content
CREATE OR REPLACE FUNCTION extract_tags_from_content(content_text TEXT)
RETURNS TEXT[] AS $$
DECLARE
tag_keywords TEXT[] := ARRAY[
'ChatGPT', 'GPT-4', 'GPT-5', 'OpenAI', 'Claude', 'Anthropic',
'Google', 'Gemini', 'Microsoft', 'Copilot', 'Meta', 'Llama',
'DeepMind', 'DeepSeek', 'Mistral', 'Hugging Face',
'AGI', 'LLM', 'AI Safety', 'Neural Network', 'Transformer',
'Machine Learning', 'Deep Learning', 'NLP', 'Computer Vision',
'Robotics', 'Autonomous', 'Generative AI'
];
found_tags TEXT[] := ARRAY[]::TEXT[];
keyword TEXT;
BEGIN
FOREACH keyword IN ARRAY tag_keywords
LOOP
IF content_text ILIKE '%' || keyword || '%' THEN
found_tags := array_append(found_tags, keyword);
END IF;
END LOOP;
RETURN found_tags;
END;
$$ LANGUAGE plpgsql;
-- View for articles with tags
CREATE OR REPLACE VIEW articles_with_tags AS
SELECT
a.id,
a.slug,
a.title_burmese,
a.excerpt_burmese,
a.featured_image,
a.category_id,
c.name_burmese as category_name_burmese,
c.slug as category_slug,
a.published_at,
a.view_count,
a.reading_time,
COALESCE(
array_agg(t.name_burmese) FILTER (WHERE t.id IS NOT NULL),
ARRAY[]::VARCHAR[]
) as tags_burmese,
COALESCE(
array_agg(t.slug) FILTER (WHERE t.id IS NOT NULL),
ARRAY[]::VARCHAR[]
) as tag_slugs
FROM articles a
LEFT JOIN categories c ON a.category_id = c.id
LEFT JOIN article_tags at ON a.id = at.article_id
LEFT JOIN tags t ON at.tag_id = t.id
WHERE a.status = 'published'
GROUP BY a.id, c.id
ORDER BY a.published_at DESC;