astro-cta-injector

Inject Call-to-Action blocks into Astro site content with intelligent placement strategies. Use when the user wants to add CTAs, newsletter signups, product promotions, or any content blocks to blog posts. Supports multiple placement strategies (end, after 50%, after 60%), content scoring for relevance, and dry-run preview.

16 stars

Best use case

astro-cta-injector is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Inject Call-to-Action blocks into Astro site content with intelligent placement strategies. Use when the user wants to add CTAs, newsletter signups, product promotions, or any content blocks to blog posts. Supports multiple placement strategies (end, after 50%, after 60%), content scoring for relevance, and dry-run preview.

Teams using astro-cta-injector should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/astro-cta-injector/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/content-media/astro-cta-injector/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/astro-cta-injector/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How astro-cta-injector Compares

Feature / Agentastro-cta-injectorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Inject Call-to-Action blocks into Astro site content with intelligent placement strategies. Use when the user wants to add CTAs, newsletter signups, product promotions, or any content blocks to blog posts. Supports multiple placement strategies (end, after 50%, after 60%), content scoring for relevance, and dry-run preview.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Astro CTA Injector Skill

## Purpose

This skill injects Call-to-Action (CTA) blocks into Astro site content. It supports:
- Multiple CTA types (newsletter, product, custom)
- Intelligent placement strategies
- Content-based relevance scoring
- Batch processing with preview

## When to Use This Skill

- User asks to "add CTAs to blog posts"
- User wants to "inject newsletter signup" into content
- User mentions "add product promotion" to posts
- User needs to batch-add any type of content block to posts
- User wants to "add calls to action" to their Astro site

## Prerequisites

- Astro site with content in `.astro` or `.md` files
- Python 3.10+
- BeautifulSoup4 for HTML parsing

## Configuration

Create a `config.json` in the skill directory:

```json
{
  "content_path": "./src/content/blog",
  "file_patterns": ["*.astro", "*.md"],
  "cta_types": {
    "newsletter": {
      "template": "newsletter.html",
      "default_placement": "after-paragraph-50%",
      "keywords": ["tip", "guide", "learn", "strategy"]
    },
    "product": {
      "template": "product.html",
      "default_placement": "end",
      "keywords": ["productivity", "task", "habit", "goal"]
    }
  },
  "output": {
    "state_file": "./state/cta_injection_progress.json",
    "backup_dir": "./backups",
    "report_file": "./reports/cta_injection_report.md"
  },
  "dry_run": true
}
```

## Placement Strategies

| Strategy | Description | Best For |
|----------|-------------|----------|
| `end` | After all content | Non-intrusive CTAs |
| `after-paragraph-50%` | After 50% of paragraphs | Mid-content engagement |
| `after-paragraph-60%` | After 60% of paragraphs | Later engagement |
| `after-heading` | After first H2 | Early engagement |
| `before-conclusion` | Before last paragraph | Strong finish |

## CTA Templates

Templates are HTML files in the `templates/` directory:

```html
<!-- templates/newsletter.html -->
<aside class="cta-newsletter" data-cta-type="newsletter">
  <h3>{{title}}</h3>
  <p>{{description}}</p>
  <form action="{{form_url}}" method="post">
    <input type="email" placeholder="Your email" required />
    <button type="submit">Subscribe</button>
  </form>
</aside>
```

Variables:
- `{{title}}` - CTA headline
- `{{description}}` - CTA body text
- `{{form_url}}` - Form submission URL
- `{{product_url}}` - Product link
- `{{image_url}}` - Image source

## Workflow

### Step 1: Score Posts for Relevance
```bash
python scripts/score_posts.py --content-path ./src/content/blog --cta-type newsletter
```

### Step 2: Preview Injections
```bash
python scripts/preview_injection.py --input scored_posts.json --cta-type newsletter
```

### Step 3: Apply Injections
```bash
python scripts/inject_ctas.py --input scored_posts.json --cta-type newsletter
```

## Input Format

Scored posts JSON:

```json
{
  "posts": [
    {
      "file_path": "./src/content/blog/my-post.astro",
      "title": "My Blog Post",
      "relevance_score": 8.5,
      "cta_type": "newsletter",
      "placement": "after-paragraph-50%",
      "cta_data": {
        "title": "Get More Tips Like This",
        "description": "Subscribe to my weekly newsletter"
      }
    }
  ]
}
```

## Scoring Algorithm

Posts are scored for CTA relevance based on:
1. **Keyword density** - How many relevant keywords appear
2. **Content length** - Longer posts = better candidates
3. **Topic match** - Title and content topic alignment
4. **Existing CTAs** - Skip posts that already have CTAs

Scores range from 0-10. Default threshold: 5.0

## Safety Features

- **Dry-run mode** by default
- **Backup creation** before any modifications
- **Duplicate detection** - Won't inject if CTA already exists
- **Rollback capability** - Restore from backups
- **Preview diffs** - See exactly what will change

## Example Usage

User: "Add a newsletter signup CTA to all my productivity-related blog posts"

Claude will:
1. Scan content directory for posts
2. Score posts for "newsletter" relevance using productivity keywords
3. Generate CTA HTML from template
4. Show preview of changes
5. Ask for confirmation
6. Inject CTAs into matching posts
7. Report results

Related Skills

astro-content

16
from diegosouzapw/awesome-omni-skill

Create Astro/Starlight MDX content pages. Use when the user says "write a new article", "add a blog post", "create content in Tech/Life category", or "add an MDX page".

astro-blog-write

16
from diegosouzapw/awesome-omni-skill

Phase 3 - Writing blog content with human voice and SEO optimization

astro-i18n

16
from diegosouzapw/awesome-omni-skill

Internationalization patterns for Astro sites. Multi-language routing, content translation, locale switching, RTL support. Use for multi-market lead generation.

managing-astro-local-env

16
from diegosouzapw/awesome-omni-skill

Manage local Airflow environment with Astro CLI. Use when the user wants to start, stop, or restart Airflow, view logs, troubleshoot containers, or fix environment issues. For project setup, see setting-up-astro-project.

astro-seo

16
from diegosouzapw/awesome-omni-skill

SEO markup patterns for Astro lead generation sites. Meta tags, Open Graph, Schema.org, sitemap, robots. Use for all SEO implementation.

astro-performance

16
from diegosouzapw/awesome-omni-skill

Core Web Vitals and performance optimization for Astro sites. LCP, CLS, INP optimization, bundle size, fonts, third-party scripts. Use for performance tuning.

astro-forms

16
from diegosouzapw/awesome-omni-skill

Form infrastructure for Astro. Zod validation, email, rate limiting, Turnstile, GDPR, Sheets. FAIL = no conversion.

astro-aso

16
from diegosouzapw/awesome-omni-skill

Query local Astro Mac app database for ASO insights. Use when the user asks about keyword rankings, historical ranking data, trend analysis, competitor keywords, app ratings, keyword opportunities, or ASO health metrics.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

mcp-create-declarative-agent

16
from diegosouzapw/awesome-omni-skill

Skill converted from mcp-create-declarative-agent.prompt.md

MCP Architecture Expert

16
from diegosouzapw/awesome-omni-skill

Design and implement Model Context Protocol servers for standardized AI-to-data integration with resources, tools, prompts, and security best practices

mathem-shopping

16
from diegosouzapw/awesome-omni-skill

Automatiserar att logga in på Mathem.se, söka och lägga till varor från en lista eller recept, hantera ersättningar enligt policy och reservera leveranstid, men lämnar varukorgen redo för manuell checkout.