Use this when you need the complete canonical static-site and validation-script listings.

B.1 Repository tree

jenkins-static-site-demo/
├── site/
│   ├── index.html
│   └── styles.css
├── scripts/
│   └── Test-StaticSite.ps1
├── Jenkinsfile
├── azure-pipelines.yml
└── .github/
    └── workflows/
        └── static-site.yml

B.2 site/index.html

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>CI/CD Static Site Demo</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <main>
        <h1>Hello, world!</h1>
        <p>This page was deployed by a CI/CD pipeline.</p>
    </main>
</body>
</html>

B.3 Test-StaticSite.ps1

[CmdletBinding()]
param(
    # Optional. Lets the same script validate a different site directory.
    [Parameter(Mandatory = $false)]
    [string] $SitePath = ".\site",

    # Optional. The required H1 text can be changed for future labs.
    [Parameter(Mandatory = $false)]
    [string] $ExpectedHeading = "Hello, world!"
)

$ErrorActionPreference = "Stop"

$IndexPath = Join-Path $SitePath "index.html"

if (-not (Test-Path -LiteralPath $IndexPath -PathType Leaf)) {
    throw "Required file not found: $IndexPath"
}

$Html = Get-Content -LiteralPath $IndexPath -Raw

if ([string]::IsNullOrWhiteSpace($Html)) {
    throw "index.html is empty."
}

if ($Html -notmatch '(?i)<html\b') {
    throw "index.html does not contain an <html> element."
}

if ($Html -notmatch '(?is)<title>.+?</title>') {
    throw "index.html does not contain a non-empty <title>."
}

$EscapedHeading = [regex]::Escape($ExpectedHeading)
if ($Html -notmatch "(?is)<h1[^>]*>\s*$EscapedHeading\s*</h1>") {
    throw "Expected H1 heading not found: $ExpectedHeading"
}

# Find simple local CSS references and verify that each referenced file exists.
$CssMatches = [regex]::Matches(
    $Html,
    '(?is)<link[^>]+href=["'']([^"'']+\.css)["'']'
)

foreach ($Match in $CssMatches) {
    $RelativeCssPath = $Match.Groups[1].Value

    # Skip remote URLs. This beginner validator only checks local files.
    if ($RelativeCssPath -match '^(https?:)?//') {
        continue
    }

    $CssPath = Join-Path $SitePath $RelativeCssPath
    if (-not (Test-Path -LiteralPath $CssPath -PathType Leaf)) {
        throw "Referenced stylesheet not found: $RelativeCssPath"
    }
}

Write-Host "Static-site validation passed."

B.4 site/styles.css

/* Keep the visual design intentionally simple. */
body {
    font-family: Arial, sans-serif;
    margin: 2rem;
    line-height: 1.5;
}

main {
    max-width: 48rem;
}