diff --git a/.cursor/rules/newsletter.md b/.cursor/rules/newsletter.md deleted file mode 100644 index ffad40b..0000000 --- a/.cursor/rules/newsletter.md +++ /dev/null @@ -1,99 +0,0 @@ -# Cursor Rules for Newsletter Management - -## 1. URL Processing -When a URL is provided: -- Remove any tracking/metrics parameters (e.g., ?utm_source=, ?ref=) -- Keep the base URL clean and readable -- Preserve the original article title exactly as written - -## 2. Newsletter Structure -### Front Matter (YAML) -```yaml ---- -title: "Newsletter #[number]" -date: [current date] -tags: [ "AI-Assisted", [additional relevant tags] ] -categories: [ "Newsletter" ] ---- -``` - -### Content Format -1. Intro text: "*Mời bạn thưởng thức Newsletter #[number].*" -2. Article sections: - ``` - ## [Original Article Title](clean_url) - - [Vietnamese summary] - - [Optional bullet points for key takeaways] - ``` - -## 3. Content Guidelines -- Summaries must be in Vietnamese -- Maintain professional tone -- Include key points in bullet format when appropriate -- Keep summaries concise but informative -- Add relevant tags based on article content -- Always include "AI-Assisted" tag - -## 4. File Management -- Check if there's an open newsletter file -- If yes: append new content to existing file -- If no: create new file with proper structure -- Follow date-based directory structure: content/post/YYYY/MM/DD/index.md - -## 5. Quality Checks -- Ensure proper markdown formatting -- Verify all links are clean and working -- Check for consistent Vietnamese language usage -- Maintain proper spacing between sections -- Validate YAML front matter structure - -## 6. Example Format -```markdown ---- -title: "Newsletter #16" -date: 2025-05-17 -tags: [ "AI-Assisted", "Programming Languages" ] -categories: [ "Newsletter" ] ---- - -*Mời bạn thưởng thức Newsletter \#16.* - -## [Article Title](https://clean-url.com) - -[Vietnamese summary] - -[Optional bullet points] -``` - -## 7. Error Prevention -- Always verify URL is accessible -- Check for duplicate articles -- Ensure proper date formatting -- Validate markdown syntax -- Maintain consistent formatting across all entries - -## 8. Implementation Steps -1. When a URL is provided: - - Clean the URL by removing tracking parameters - - Fetch and analyze the content - - Create a Vietnamese summary - - Identify relevant tags - -2. For new newsletters: - - Create file in correct directory structure - - Add proper front matter - - Include intro text - - Add article with summary - -3. For existing newsletters: - - Append new article to existing content - - Maintain consistent formatting - - Update tags if necessary - -4. Final checks: - - Verify all formatting - - Check Vietnamese language quality - - Ensure proper spacing - - Validate all links \ No newline at end of file diff --git a/.cursor/rules/newsletter_processor.mdc b/.cursor/rules/newsletter_processor.mdc new file mode 100644 index 0000000..66403c8 --- /dev/null +++ b/.cursor/rules/newsletter_processor.mdc @@ -0,0 +1,66 @@ +--- +description: +globs: +alwaysApply: true +--- +# Newsletter URL Processor + +## Description +This rule processes URLs to create or update newsletter posts. When a single URL is provided, it will either create a new newsletter post or append to an existing one. + +## Trigger +- When a single URL is provided in the message + +## Actions +1. URL Processing: + - Remove tracking parameters (utm_source, ref, etc.) + - Clean and preserve base URL + - Extract original article title + +2. Newsletter Creation/Update: + - Check for existing newsletter file for current date + - If exists: append new content + - If not: create new file with proper structure + +3. Content Structure: + ```markdown + --- + title: "Newsletter #[number]" + date: [current date] + tags: [ "AI-Assisted", [additional relevant tags] ] + categories: [ "Newsletter" ] + --- + + *Mời bạn thưởng thức Newsletter #[number].* + + ## [Original Article Title](mdc:clean_url) + + [Vietnamese summary] + + [Optional bullet points for key takeaways] + ``` + +4. File Location: + - Store in: content/post/YYYY/MM/DD/index.md + +## Requirements +- Summaries must be in Vietnamese +- Maintain professional tone +- Include key points in bullet format when appropriate +- Keep summaries concise but informative +- Add relevant tags based on article content +- Always include "AI-Assisted" tag + +## Quality Checks +- Verify URL accessibility +- Check for duplicate articles +- Ensure proper date formatting +- Validate markdown syntax +- Maintain consistent formatting +- Check Vietnamese language quality +- Verify all links are working + +## Example +Input: https://example.com/article?utm_source=twitter +Output: Creates or updates newsletter post with cleaned URL and Vietnamese summary +