Skip to content

microsoft/power-platform-skills / plugins/power-pages/skills/add-seo

add-seo

Verified

Adds SEO essentials to a Power Pages SPA site, including robots.txt, sitemap.xml, meta tags, Open Graph tags, and favicon configuration. Use when the user wants to improve search engine optimization or make their site more searchable.

FileKindSize
SKILL.mdskill md13.9 KB
scripts/validate-seo.jsscript2.9 KB

scripts/validate-seo.js

View on GitHub
#!/usr/bin/env node

// Validates SEO assets added to a Power Pages SPA site.
// Runs as a PostToolUse(Skill) hook to verify robots.txt, sitemap.xml, and meta tags were created.

const fs = require('fs');
const path = require('path');
const { approve, block, runValidation, findPath } = require('../../../scripts/lib/validation-helpers');

runValidation((cwd) => {
  const configPath = findPath(cwd, 'powerpages.config.json');
  if (!configPath) approve(); // Not a Power Pages project, skip

  const projectRoot = path.dirname(configPath);
  const publicDir = path.join(projectRoot, 'public');

  if (!fs.existsSync(publicDir)) approve();

  // Check if any SEO file exists — if none, this wasn't an SEO session, skip
  const hasRobots = fs.existsSync(path.join(publicDir, 'robots.txt'));
  const hasSitemap = fs.existsSync(path.join(publicDir, 'sitemap.xml'));
  if (!hasRobots && !hasSitemap) approve();

  const errors = [];

  // 1. robots.txt
  if (!hasRobots) {
    errors.push('Missing public/robots.txt');
  } else {
    const content = fs.readFileSync(path.join(publicDir, 'robots.txt'), 'utf8');
    if (!content.includes('User-agent:')) errors.push('robots.txt: missing User-agent directive');
    if (!content.toLowerCase().includes('sitemap:')) errors.push('robots.txt: missing Sitemap directive');
  }

  // 2. sitemap.xml
  if (!hasSitemap) {
    errors.push('Missing public/sitemap.xml');
  } else {
    const content = fs.readFileSync(path.join(publicDir, 'sitemap.xml'), 'utf8');
    if (!content.includes('<urlset')) errors.push('sitemap.xml: missing <urlset> element');
    if (!content.includes('<loc>')) errors.push('sitemap.xml: missing <loc> entries');
    if (content.includes('<PRODUCTION_URL>') || content.includes('<TODAY_DATE>')) {
      errors.push('sitemap.xml: contains unreplaced template placeholders');
    }
  }

  // 3. Meta tags in index.html
  const indexPath = findIndexHtml(projectRoot);
  if (indexPath) {
    const content = fs.readFileSync(indexPath, 'utf8');
    if (!content.includes('meta name="description"')) errors.push('index.html: missing meta description tag');
    if (!content.includes('meta name="viewport"')) errors.push('index.html: missing viewport meta tag');
  }

  if (errors.length > 0) {
    block('SEO validation failed:\n- ' + errors.join('\n- '));
  }

  approve();
});

function findIndexHtml(projectRoot) {
  const candidates = [
    path.join(projectRoot, 'index.html'),
    path.join(projectRoot, 'src', 'index.html'),
  ];

  for (const candidate of candidates) {
    if (fs.existsSync(candidate)) return candidate;
  }

  // For Astro, check layout files
  const layoutDir = path.join(projectRoot, 'src', 'layouts');
  if (fs.existsSync(layoutDir)) {
    try {
      for (const entry of fs.readdirSync(layoutDir, { withFileTypes: true })) {
        if (entry.isFile() && entry.name.endsWith('.astro')) {
          return path.join(layoutDir, entry.name);
        }
      }
    } catch {}
  }

  return null;
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall