بنقرة واحدة
tests-local-test-and-update-internal-links
// Verify internal links database integrity and update with new pages and anchors.
// Verify internal links database integrity and update with new pages and anchors.
Analyze an article and add relevant internal links from both SLG and ITA projects. Use when the user asks to add internal or cross-project links to an article.
Verify all claims, numbers, deadlines, and legal references in an article against official sources. Use when the user asks to fact-check or verify article content before publication.
Prepare an article for publication by running internal link addition and fact-checking in parallel. Use when the user asks to finalize, prepare, or get an article ready for publishing.
Translate approved Russian content to Ukrainian, English, and Spanish. Use when the user asks to translate an article or content to other languages.
Write or edit article content in the author's authentic voice. Use when the user asks to write, create, or edit an article, blog post, or content for the Spain Life Guide site.
Run all local validation checks that don't require network access to the live site.
| name | tests-local-test-and-update-internal-links |
| description | Verify internal links database integrity and update with new pages and anchors. |
| user-invocable | false |
| allowed-tools | Bash(grep *) |
Verify internal links database integrity and update with new pages/anchors. This skill:
The internal links database (internal_links_{lang}.json) tracks:
/ru/mortgage/)#документы-для-ипотеки)Run this after adding/modifying content or before deploying to ensure all internal links work.
_resources/internal_links_ru.json - Russian_resources/internal_links_ua.json - Ukrainian_resources/internal_links_en.json - English_resources/internal_links_es.json - Spanish{
"description": "All internal links for Russian version",
"language": "ru",
"generated_at": "2025-01-21",
"pages": [
{
"path": "/",
"url": "https://spainlifeguide.com/",
"title": "Main page title",
"description": "What this page is about",
"anchors": ["anchor1", "anchor2"]
},
{
"path": "/ru/mortgage/",
"url": "https://spainlifeguide.com/ru/mortgage/",
"title": "Ипотека в Испании",
"anchors": ["документы-для-ипотеки", ...]
}
]
}
Convert path from JSON to HTML file:
/ → _site/index.html/ru/mortgage/ → _site/ru/mortgage/index.html/ru/why-valencia/ → _site/ru/why-valencia/index.html/en/ → _site/en/index.html/ua/ → _site/ua/index.html/es/ → _site/es/index.htmlRule: Remove trailing /, prepend _site, append /index.html. For root /, just use _site/index.html.
The following ID patterns are excluded from anchor tracking (technical IDs, not content anchors):
| Pattern | Description |
|---|---|
*-contact-form | Contact form element IDs |
hs-script-loader | HubSpot script loader ID |
| UUID patterns | Auto-generated IDs like f47ac10b-58cc-4372-a567-0e02b2c3d479 |
IMPORTANT: The _site/ directory must exist with compiled HTML files. If it doesn't exist, run:
bundle exec jekyll build
Check if _site/ exists
ls _site/index.html
If files don't exist, inform the user to run bundle exec jekyll build first.
For each language, read internal_links_{lang}.json
For each page in the pages array:
path to HTML file pathgrep -oE 'id="[^"]+"' HTML_FILE | sed 's/id="//;s/"$//' | grep -v -E '(-contact-form$|^hs-script-loader$|^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$)' | sort -u
anchors array for that pageRun all page scans in parallel using the Task tool for efficiency.
## Anchor Check & Update Results
### Russian (internal_links_ru.json)
| Page | In Database | In HTML | New | Removed |
|------|-------------|---------|-----|---------|
| / (main) | 5 | 5 | 0 | 0 |
| /ru/mortgage/ | 11 | 13 | 2 | 0 |
| /ru/why-valencia/ | 0 | 0 | 0 | 0 |
### English (internal_links_en.json)
| Page | In Database | In HTML | New | Removed |
|------|-------------|---------|-----|---------|
| /en/ (main) | 5 | 5 | 0 | 0 |
| /en/mortgage/ | 1 | 1 | 0 | 0 |
| /en/why-valencia/ | 1 | 1 | 0 | 0 |
IMPORTANT: Missing anchors indicate potential broken links!
## ❌ Missing Anchors (in database but NOT in HTML)
These anchors may have been renamed without adding legacy anchors. URLs pointing to them will break!
### RU - /ru/mortgage/ (1 missing)
1. `старое-название`
- URL: https://spainlifeguide.com/ru/mortgage/#старое-название
- Fix: Add legacy anchor before renamed heading:
```markdown
<span id="старое-название" class="legacy-anchor"></span>
## Новое Название
```
## New Anchors Found (in HTML but not in database)
These can be added to the database for future tracking.
### RU - /ru/mortgage/ (2 new)
1. `новый-раздел`
2. `дополнительная-информация`
After showing the report:
If missing anchors found: Stop and warn the user. These need legacy anchors BEFORE proceeding.
If new anchors found (and no missing): Ask user if they want to add them to the database
If user confirms: Update the JSON files:
pages arrayanchors arraygenerated_at to current date## Final Status
✅ **ALL CHECKS PASSED** - No missing anchors, database is up to date.
OR
## Final Status
✅ **DATABASE UPDATED** - All checks passed.
Updated files:
- _resources/internal_links_ru.json: /ru/mortgage/ (+2 anchors)
- _resources/internal_links_ua.json: /ua/ (+1 anchor)
OR
## Final Status
❌ **MISSING ANCHORS FOUND** - X anchor(s) missing across Y page(s).
Action required: Add legacy anchors for the missing IDs listed above, then rebuild and re-run this check.
bundle exec jekyll build) before running this skill