4.2 KiB
Epic 3: Pre-Deployment, URL Generation & Interlinking
Epic Goal
To loop through each article in a batch, validate/create its cloud target, generate its final URL, and then inject all required interlinks (batch "wheel," home page, and tiered) into the HTML content before deployment.
Stories
Story 3.1: Generate and Validate Article URLs
As a developer, I want to loop through every article in my batch, validate or create its specific cloud bucket, and generate its final public URL, so that I have a definitive list of all new URLs before I try to interlink them.
Acceptance Criteria A script iterates through each new article in the batch.
- A script iterates through each new article in the batch.
- For each article, it identifies the target cloud bucket (one bucket per article).
- It checks if that specific bucket exists and is accessible.
- If the bucket does not exist, it creates it.
- If bucket validation/creation fails for any article, the script halts with a clear error for that article.
- Using the bucket's base URL and the FQDN mapping logic, it constructs the final, absolute URL for the article.
- The script outputs a complete list/map of all newly generated URLs for the batch (e.g.,
[{ title: 'Article 1', url: '...' }, { title: 'Article 2', url: '...' }]).
Story 3.2: Find Tiered Links
As a developer, I want a module that finds all required tiered links (money site or lower-tier) based on the current batch's tier, so I have them ready for injection.
Acceptance Criteria:
- The module checks the current batch's Tier.
- If Tier 1: It gets the
money_site_urlfrom the project settings. - If Tier 2 or higher: It queries the
urlstable for 2-4 random URLs from the tier immediately below it (e.g., a T2 batch gets T1 URLs). - It returns an object containing the required links (e.g.,
{ money_site_url: '...' }or{ lower_tier_urls: [...] }).
Story 3.3: Content Interlinking Injection
As a User, I want the system to inject all required links (batch "wheel", home page, and tiered/money site) into each new article using the finalized URL list.
Acceptance Criteria:
- A script takes the raw HTML content (from Epic 2), the list of new URLs (from 3.1), the tiered links (from 3.2), and the
projectJSON (for anchor text). - Wheel/Home Page Links:
- For each article in the
new_article_urlslist, it injects a "next" and "previous" link. - The "next" link points to the next article in the list. The last article's "next" link must loop back and point to the first article.
- The "previous" link points to the previous article in the list. The first article's "previous" link must loop back and point to the last article.
- Each article must also contain a link to its bucket's home page (derived from its URL in 3.1).
- For each article in the
- Tiered/Anchor Text Links:
- It loads the anchor text lists (T1, T2, etc.) from the
projectJSON. - If Tier 1: It scans the HTML for anchor text from the T1 list and links the first instance to the
money_site_url. - If Tier 2 or higher: It scans the HTML for anchor text from the appropriate tier's list. For each of the 2-4 anchor texts found, it inserts a link to one of the
lower_tier_urls.
- It loads the anchor text lists (T1, T2, etc.) from the
- The script produces the final, fully interlinked HTML content, ready for deployment in Epic 4.
Story 3.4: Generate Boilerplate Site Pages
As a developer, I want to automatically generate boilerplate about.html, contact.html, and privacy.html pages for each site in my batch, so that the navigation menu links from Story 3.3 work and the sites appear complete.
Acceptance Criteria:
- A function generates three boilerplate pages for each unique site in the batch.
- Pages created:
about.html,contact.html,privacy.html - Each page uses the same template as the articles for that site (basic/modern/classic/minimal).
- Pages contain professional, generic content suitable for any niche.
- Privacy policy is comprehensive and legally sound (generic template).
- Pages are stored in database and associated with the correct site.
- Pages are generated once per site (skip if already exist from previous batches).
- Navigation menu links from Story 3.3 now point to actual pages instead of being broken.