mirror of
https://github.com/tiennm99/blog.git
synced 2026-10-18 14:13:17 +00:00
4.0 KiB
4.0 KiB
applyTo
| applyTo |
|---|
| *.md |
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. The rule ensures consistent formatting and high-quality content in Vietnamese.
Trigger
- When a single URL is provided in the message
- When multiple URLs are provided in sequence
Actions
-
URL Processing:
- Remove tracking parameters (utm_source, ref, etc.)
- Clean and preserve base URL
- Extract original article title
- Verify URL accessibility
- Check for duplicate articles in existing newsletters
-
Newsletter Creation/Update:
- Check for existing newsletter file for current date using one of these methods:
# Method 1: Using Get-Date with explicit format Get-Date -Format "yyyy-MM-dd" # Method 2: Using .NET DateTime directly [DateTime]::Now.ToString("yyyy-MM-dd") # Method 3: Using date command (if PowerShell fails) date +%Y-%m-%d - If exists: append new content
- If not: create new file with proper structure
- Auto-increment newsletter number based on latest existing newsletter
- Check for existing newsletter file for current date using one of these methods:
-
Content Structure:
--- title: "Newsletter #[number]" date: [current date using one of the above methods] 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 in professional tone] [Optional bullet points for key takeaways] [New content URLs and summaries should be added before any bonus sections] -
File Location:
- Store in: content/post/YYYY/MM/DD/index.md
- Use one of the date methods above for date formatting
- Create directory structure if not exists
Content Guidelines
-
Vietnamese Summaries:
- Write in professional, clear Vietnamese
- Keep technical terms in English when appropriate
- Maintain consistent tone throughout
- Length: 2-4 paragraphs for main content
- Include key takeaways in bullet points when relevant
-
Tagging:
- Always include "AI-Assisted" tag
- Add relevant technical tags (e.g., "Development", "Architecture", "Java")
- Use consistent tag naming across newsletters
- Maximum 5 tags per newsletter
-
Formatting:
- Use proper markdown syntax
- Maintain consistent heading levels
- Include proper spacing between sections
- Use bullet points for lists
- Keep URLs clean and readable
Quality Checks
-
Content:
- 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
-
Technical:
- Validate front matter format
- Check directory structure
- Verify newsletter number sequence
- Ensure proper file naming
- Validate date format consistency
Example
Input: https://example.com/article?utm_source=twitter Output: Creates or updates newsletter post with:
- Clean URL: https://example.com/article
- Vietnamese summary
- Proper front matter
- Correct file location
- Appropriate tags
Error Handling
- If URL is inaccessible: Skip and notify
- If duplicate found: Skip and notify
- If date format invalid: Use current date
- If directory creation fails: Notify and abort
- If markdown validation fails: Fix and retry
Date Handling Troubleshooting
If the primary date method fails, try these alternatives in order:
- Use .NET DateTime directly:
[DateTime]::Now.ToString("yyyy-MM-dd") - Use date command:
date +%Y-%m-%d - Use JavaScript Date object:
new Date().toISOString().split('T')[0] - Use Python datetime:
python -c "from datetime import datetime; print(datetime.now().strftime('%Y-%m-%d'))"
Note: Always verify the date format matches the required "yyyy-MM-dd" pattern before using it in the newsletter.