Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions docs-site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ npm run dev # http://localhost:4321 — hot reload
| Command | What it does |
| ------------------ | ----------------------------------------------------------- |
| `npm run dev` | Hot-reload dev server (port 4321). |
| `npm run check` | Check content and TypeScript with Astro. |
| `npm run check` | Test blog metadata integrity, then check content and TypeScript with Astro. |
| `npm run build` | Production build to `dist/`. |
| `npm run preview` | Serve the production build locally (close to canary). |
| `python3 -m unittest discover -s scripts/tests -p 'test_*.py'` | Run link/fragment checker unit tests. |
| `python3 -m unittest discover -s scripts/tests -p 'test_*.py'` | Test the link/fragment checker and built Blogs output (run after build). |
| `python3 scripts/validate_docs_site.py` | Validate built internal links, fragments, and HTML output shape. |

**Before pushing:** `npm run check && npm run build && python3 -m unittest discover -s scripts/tests -p 'test_*.py' && python3 scripts/validate_docs_site.py` (all green).
Expand Down Expand Up @@ -199,6 +199,45 @@ npm run check && npm run build

Cross-link the new page from related topics, then check its sidebar placement and links in the built site or PR preview. The check and build commands don't by themselves verify every link or fragment.

### Add a curated blog entry

The static `/docs/blogs/` index reads `src/data/blogs.json` through the local
`blogs` content collection. Tech Community hosts the originals: do not copy
article bodies, excerpts, or images, and do not add RSS, runtime, or build-time
network requests. No page or component changes are needed to add an entry.

1. Verify that the article is relevant to Azure Logic Apps Automation. Open the
original on Microsoft Tech Community and check its canonical URL, title,
author username, and original displayed publication date (not its updated
date or a UTC timestamp that falls on a different day).
2. Add one JSON object with `id` (article ID as a string), `title`, `url`,
`publishedAt` (`YYYY-MM-DD`), `author`, and `summary`. Use the canonical HTTPS
`techcommunity.microsoft.com/blog/.../<article-id>` URL without tracking
parameters or fragments. Retain percent-encoded characters in canonical URLs.
Decorative symbols in source titles can be omitted from the display title.
3. Write an original one- or two-sentence plain-text summary (up to 400
characters, no HTML or Markdown). Describe the article rather than promising
current availability or pricing. Link pricing announcements to current
pricing guidance instead of repeating rates or grants.
4. Optionally add up to two `relatedDocs` objects with `label` and `href`.
Use `/docs/`-prefixed routes with a trailing slash, such as
`/docs/getting-started/pricing/`; an existing `#fragment` can follow the slash.
5. Run the full **Before pushing** command above, sequentially. `npm run check`
tests schema edge cases and catalog integrity; both check and build validate
the local catalog before Astro indexes it. The Python validator checks
generated internal routes and fragments, including related docs links.
6. Review the Blogs page and homepage in the documentation preview: check
newest-first order, attribution, link destinations, keyboard navigation,
mobile layout, and light/dark themes. Request normal PR review for relevance,
metadata accuracy, summary originality, and related documentation.

The schema in `src/data/blogs.schema.mjs` rejects missing or empty required
fields, invalid or future dates, duplicate IDs/URLs, mismatched article IDs,
unsafe/noncanonical article URLs, formatted summaries, and malformed internal
routes. The list is rendered as static HTML with ordinary same-tab links and
requires no client-side script or remote service. The broader community blog
link remains available even when the curated catalog is empty.

### Update an existing page

Edit it. Keep existing page URLs and heading fragments working when reorganizing content; if a heading changes, preserve its old fragment as an explicit anchor, as in `features/runs-and-monitoring.md`. Check incoming links and run `npm run check` and `npm run build` before pushing.
Expand Down
4 changes: 4 additions & 0 deletions docs-site/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ export default defineConfig({
collapsed: true,
items: [{ autogenerate: { directory: 'demos' } }],
},
{
label: 'Blogs',
slug: 'blogs',
},
{
label: 'Release notes',
items: [{ autogenerate: { directory: 'release-notes' } }],
Expand Down
2 changes: 1 addition & 1 deletion docs-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"start": "astro dev",
"build": "astro build && node scripts/postbuild.mjs",
"preview": "astro preview",
"check": "astro check",
"check": "node --test scripts/tests/blogs.test.mjs && astro check",
"astro": "astro"
},
"dependencies": {
Expand Down
134 changes: 134 additions & 0 deletions docs-site/scripts/tests/blogs.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { test } from 'node:test';
import { blogCatalogSchema, blogSchema, parseBlogCatalog } from '../../src/data/blogs.schema.mjs';

const catalogText = readFileSync(new URL('../../src/data/blogs.json', import.meta.url), 'utf-8');
const [article] = JSON.parse(catalogText);

test('the curated catalog satisfies its schema and cross-entry integrity rules', () => {
assert.doesNotThrow(() => parseBlogCatalog(catalogText));
});

test('contains exactly the eight approved canonical Tech Community posts', () => {
assert.deepEqual(
JSON.parse(catalogText).map(({ id, url }) => ({ id, url })),
[
{
id: '4573643',
url: 'https://techcommunity.microsoft.com/blog/integrationsonazureblog/announcing-decision-apis-as-actions-in-azure-logic-apps/4573643',
},
{
id: '4573645',
url: 'https://techcommunity.microsoft.com/blog/IntegrationsonAzureBlog/what%E2%80%99s-new-in-logic-apps-automation-at-ignite-2026/4573645',
},
{
id: '4573879',
url: 'https://techcommunity.microsoft.com/blog/IntegrationsonAzureBlog/from-canvas-to-run-a-better-logic-apps-automation-experience/4573879',
},
{
id: '4574191',
url: 'https://techcommunity.microsoft.com/blog/IntegrationsonAzureBlog/whats-new-in-azure-logic-apps-at-microsoft-ignite-2026/4574191',
},
{
id: '4566381',
url: 'https://techcommunity.microsoft.com/blog/integrationsonazureblog/%f0%9f%86%95orchestrate-foundry-prompt-and-hosted-agents-with-logic-apps-automation/4566381',
},
{
id: '4562264',
url: 'https://techcommunity.microsoft.com/blog/integrationsonazureblog/%f0%9f%92%b2announcing-free-grant-and-pricing-for-logic-apps-automation/4562264',
},
{
id: '4524555',
url: 'https://techcommunity.microsoft.com/blog/integrationsonazureblog/%F0%9F%8E%89-automation-just-became-a-team-sport-meet-azure-logic-apps-automation-/4524555',
},
{
id: '4524685',
url: 'https://techcommunity.microsoft.com/blog/integrationsonazureblog/whats-new-in-azure-logic-apps-at-microsoft-build-2026/4524685',
},
],
);
});

test('allows an empty catalog so the index can retain its broader community link', () => {
assert.deepEqual(parseBlogCatalog('[]'), []);
});

for (const field of ['id', 'title', 'url', 'publishedAt', 'author', 'summary']) {
test(`rejects a missing required ${field}`, () => {
const entry = { ...article };
delete entry[field];
assert.equal(blogSchema.safeParse(entry).success, false);
});
}

for (const date of ['2026-02-29', '2026-02-30', '2026-13-01', '2026-10-7', 'not-a-date', '9999-12-31']) {
test(`rejects invalid publication date ${date}`, () => {
assert.equal(blogSchema.safeParse({ ...article, publishedAt: date }).success, false);
});
}

test('accepts a real leap day without timezone-dependent date coercion', () => {
assert.equal(blogSchema.safeParse({ ...article, publishedAt: '2024-02-29' }).success, true);
});

for (const url of [
article.url.replace('https:', 'http:'),
article.url.replace('techcommunity.microsoft.com', 'techcommunity.microsoft.com.evil.example'),
article.url.replace('techcommunity.microsoft.com', 'example.com'),
article.url.replace('https://', 'https://reader@'),
article.url.replace('https://', 'https://@'),
article.url.replace('techcommunity.microsoft.com', 'techcommunity.microsoft.com:443'),
article.url.replace('techcommunity.microsoft.com', 'techcommunity.microsoft.com:8443'),
article.url.replace('https://', '//'),
`${article.url}\n`,
`${article.url}?tracking=1`,
`${article.url}#fragment`,
`${article.url}/`,
article.url.replace(`/${article.id}`, '/1'),
'https://techcommunity.microsoft.com/category/azure/blog/integrationsonazureblog',
'javascript:alert(1)',
]) {
test(`rejects unsafe or noncanonical article URL ${url}`, () => {
assert.equal(blogSchema.safeParse({ ...article, url }).success, false);
});
}

for (const summary of ['', ' ', '<img src=x onerror=alert(1)>', '[Link](https://example.com)', '**Bold**', '`code`', 'First line\nSecond line']) {
test(`rejects non-plain summary ${JSON.stringify(summary)}`, () => {
assert.equal(blogSchema.safeParse({ ...article, summary }).success, false);
});
}

test('rejects duplicate IDs and URLs before collection indexing can replace them', () => {
const result = blogCatalogSchema.safeParse([article, article]);
assert.equal(result.success, false);
assert(result.error.issues.some(({ message }) => message === 'Duplicate article ID.'));
assert(result.error.issues.some(({ message }) => message === 'Duplicate article URL.'));
});

test('rejects duplicate URLs with different percent-escape casing', () => {
const alternate = { ...article, url: article.url.replace(/%[0-9a-f]{2}/g, (value) => value.toUpperCase()) };
const result = blogCatalogSchema.safeParse([article, alternate]);
assert.equal(result.success, false);
assert(result.error.issues.some(({ message }) => message === 'Duplicate article URL.'));
});

for (const href of ['/guides/agent-options/', '//example.com/', 'https://example.com/', '/docs/../support/', '/docs/guides/agent-options']) {
test(`rejects invalid internal-route syntax ${href}`, () => {
const relatedDocs = [{ label: 'Related guide', href }];
assert.equal(blogSchema.safeParse({ ...article, relatedDocs }).success, false);
});
}

test('allows no related docs or at most two base-prefixed routes with optional anchors', () => {
const link = { label: 'Pricing', href: '/docs/getting-started/pricing/#free-grants' };
assert.equal(blogSchema.safeParse({ ...article, relatedDocs: [] }).success, true);
assert.equal(blogSchema.safeParse({ ...article, relatedDocs: [link, link] }).success, true);
assert.equal(blogSchema.safeParse({ ...article, relatedDocs: [link, link, link] }).success, false);
});

test('rejects unexpected content fields instead of accepting copied article bodies or images', () => {
assert.equal(blogSchema.safeParse({ ...article, body: 'Article body' }).success, false);
assert.equal(blogSchema.safeParse({ ...article, image: 'https://example.com/image.png' }).success, false);
});
117 changes: 117 additions & 0 deletions docs-site/scripts/tests/test_blogs_output.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import json
import sys
import unittest
from datetime import date
from html.parser import HTMLParser
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parents[1]))

from validate_docs_site import scan_pages, validate_internal_links

DOCS_SITE = Path(__file__).resolve().parents[2]


class BlogParser(HTMLParser):
def __init__(self):
super().__init__(convert_charrefs=True)
self.articles = []
self.current = None
self.main_navigation = []
self.in_navigation = False

def handle_starttag(self, tag, attrs):
values = dict(attrs)
if tag == "nav" and values.get("aria-label") == "Main":
self.in_navigation = True
if tag == "a" and self.in_navigation:
self.main_navigation.append(values.get("href"))
if tag == "article":
self.current = {
"label": values.get("aria-labelledby"),
"ids": [], "links": [], "dates": [], "text": [], "dynamic": [],
}
self.articles.append(self.current)
if self.current is None:
return
if "id" in values:
self.current["ids"].append(values["id"])
if tag == "a":
self.current["links"].append(values)
if tag == "time":
self.current["dates"].append(values.get("datetime"))
if tag in ("script", "astro-island", "img"):
self.current["dynamic"].append(tag)

def handle_endtag(self, tag):
if tag == "article":
self.current = None
if tag == "nav":
self.in_navigation = False

def handle_data(self, data):
if self.current is not None:
self.current["text"].append(data)


class BlogsOutputTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
# CI and the documented validation command build before testing rendered output.
cls.root = DOCS_SITE / "dist/docs"
cls.blog_page = cls.root / "blogs/index.html"
cls.catalog = json.loads((DOCS_SITE / "src/data/blogs.json").read_text())
cls.parser = BlogParser()
cls.parser.feed(cls.blog_page.read_text())

def test_static_articles_have_complete_attribution_in_newest_first_order(self):
expected = sorted(
self.catalog,
key=lambda entry: (-int(date.fromisoformat(entry["publishedAt"]).strftime("%Y%m%d")), entry["id"]),
)
self.assertEqual(len(self.parser.articles), len(expected))
for actual, entry in zip(self.parser.articles, expected):
with self.subTest(article=entry["id"]):
text = " ".join("".join(actual["text"]).split())
published = date.fromisoformat(entry["publishedAt"])
self.assertIn(entry["title"], text)
self.assertIn(entry["summary"], text)
self.assertIn(entry["author"], text)
self.assertIn("Microsoft Tech Community", text)
self.assertIn(f"{published:%B} {published.day}, {published.year}", text)
self.assertEqual(actual["dates"], [entry["publishedAt"]])
self.assertIn(actual["label"], actual["ids"])
self.assertEqual(actual["links"][0]["href"], entry["url"])
self.assertEqual(actual["dynamic"], [])
self.assertTrue(all(link.get("target") != "_blank" for link in actual["links"]))

def test_related_documentation_is_rendered_and_resolves_in_built_output(self):
actual_links = {
link["href"] for article in self.parser.articles for link in article["links"]
}
for entry in self.catalog:
for link in entry.get("relatedDocs", []):
self.assertIn(link["href"], actual_links)
errors = validate_internal_links(self.root, scan_pages(self.root))
self.assertEqual(errors, [])

def test_homepage_and_explicit_sidebar_entry_link_to_blogs_before_release_notes(self):
navigation = self.parser.main_navigation
self.assertEqual(navigation.count("/docs/blogs/"), 1)
self.assertLess(
navigation.index("/docs/blogs/"),
navigation.index("/docs/release-notes/changelog/"),
)
homepage = (self.root / "index.html").read_text()
self.assertIn('href="/docs/blogs/"', homepage)

def test_broader_board_link_remains_available(self):
html = self.blog_page.read_text()
self.assertIn(
'href="https://techcommunity.microsoft.com/t5/azure-integration-services-blog/bg-p/IntegrationsonAzureBlog"',
html,
)


if __name__ == "__main__":
unittest.main()
58 changes: 58 additions & 0 deletions docs-site/src/components/BlogList.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
import { getCollection } from 'astro:content';

const entries = (await getCollection('blogs')).sort((a, b) =>
b.data.publishedAt.localeCompare(a.data.publishedAt) || a.id.localeCompare(b.id),
);
const dateFormat = new Intl.DateTimeFormat('en-US', {
year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC',
});
---

{entries.length === 0 ? (
<p>No articles have been selected yet. Browse the community blog below for more posts.</p>
) : (
<ul class="blog-list" role="list">
{entries.map(({ id, data }) => (
<li>
<article aria-labelledby={`blog-${id}`}>
<h2 id={`blog-${id}`}><a href={data.url}>{data.title}</a></h2>
<p class="attribution">
<time datetime={data.publishedAt}>
{dateFormat.format(new Date(`${data.publishedAt}T00:00:00Z`))}
</time>
{' · '}{data.author}{' · Microsoft Tech Community'}
</p>
<p>{data.summary}</p>
{data.relatedDocs.length > 0 && (
<p>
In the docs:{' '}
{data.relatedDocs.map((link, index) => (
<>{index > 0 && ' · '}<a href={link.href}>{link.label}</a></>
))}
</p>
)}
</article>
</li>
))}
</ul>
)}

<style>
.blog-list {
list-style: none;
padding-inline-start: 0;
}
.blog-list > li + li {
border-block-start: 1px solid var(--sl-color-hairline-light);
margin-block-start: 2rem;
padding-block-start: 1rem;
}
h2 {
font-size: var(--sl-text-h3);
overflow-wrap: anywhere;
}
.attribution {
font-size: var(--sl-text-sm);
}
</style>
Loading
Loading