Skip to content
Closed
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
1,695 changes: 1,695 additions & 0 deletions .github/workflows/copilot-workshops-sync.lock.yml

Large diffs are not rendered by default.

226 changes: 226 additions & 0 deletions .github/workflows/copilot-workshops-sync.md

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions website/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import sitemap from "@astrojs/sitemap";
import starlight from "@astrojs/starlight";
import { defineConfig } from "astro/config";
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
import pagefindResources from "./src/integrations/pagefind-resources";

// Learning Hub course content mirrored from external workshop repos is authored
// in GitHub admonition syntax (`> [!NOTE]`). This remark plugin rewrites those
// callouts into Starlight aside directives before Starlight renders them, so the
// same syntax used in the source repos and on github.com also produces styled
// callouts here. The mapping targets Starlight's aside types (note / tip / caution).
const githubAdmonitionMapping = {
NOTE: "note",
TIP: "tip",
IMPORTANT: "note",
WARNING: "caution",
CAUTION: "caution",
};

const site = "https://awesome-copilot.github.com/";
const siteDescription =
"Community-contributed agents, instructions, and skills to enhance your GitHub Copilot experience";
Expand All @@ -19,6 +33,11 @@ export default defineConfig({
site,
base: "/",
output: "static",
markdown: {
remarkPlugins: [
[remarkGithubAdmonitionsToDirectives, { mapping: githubAdmonitionMapping }],
],
},
integrations: [
starlight({
title: "Awesome GitHub Copilot",
Expand Down Expand Up @@ -66,6 +85,20 @@ export default defineConfig({
"./src/styles/starlight-overrides.css",
"./src/styles/global.css",
],
// English is served at the site root (no locale prefix), preserving all
// existing URLs. Additional locales are served under a locale prefix
// (e.g. /es-es/…) and fall back to the English page when a translation
// does not yet exist. These keys match the locale directory names used by
// mirrored Learning Hub course content (website/src/content/docs/<locale>/…).
defaultLocale: "root",
locales: {
root: { label: "English", lang: "en" },
"es-es": { label: "Español", lang: "es-ES" },
"ja-jp": { label: "日本語", lang: "ja-JP" },
"ko-kr": { label: "한국어", lang: "ko-KR" },
"pt-br": { label: "Português (Brasil)", lang: "pt-BR" },
"zh-cn": { label: "简体中文", lang: "zh-CN" },
},
editLink: {
baseUrl:
"https://github.com/github/awesome-copilot/edit/staged/website/",
Expand Down Expand Up @@ -146,6 +179,7 @@ export default defineConfig({
Head: "./src/components/Head.astro",
Footer: "./src/components/Footer.astro",
Search: "./src/components/Search.astro",
LanguageSelect: "./src/components/LanguageSelect.astro",
},
}),
sitemap(),
Expand Down
16 changes: 16 additions & 0 deletions website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"gray-matter": "^4.0.3",
"jszip": "^3.10.1",
"marked": "^18.0.2",
"remark-github-admonitions-to-directives": "^2.1.0",
"shiki": "^4.0.2"
}
}
40 changes: 40 additions & 0 deletions website/src/components/LanguageSelect.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
// Custom override of Starlight's LanguageSelect.
//
// By default Starlight renders the language dropdown on every page as soon as
// more than one locale is configured. Most of this site's docs are English-only,
// so we only want the picker to appear on pages that actually have a translation
// in a non-English locale. This override checks the docs collection for a
// translated version of the current page and renders the stock picker only when
// one exists; otherwise it renders nothing (no dropdown).
import Default from "@astrojs/starlight/components/LanguageSelect.astro";
import config from "virtual:starlight/user-config";
import { getCollection } from "astro:content";

// Locale directory names configured for the site, excluding the English root.
const localeCodes = Object.keys(config.locales ?? {}).filter(
(code) => code !== "root"
);

/** Strip a leading `<locale>/` segment from a docs entry id, if present. */
function baseSlug(id) {
const [first, ...rest] = id.split("/");
return localeCodes.includes(first) ? rest.join("/") : id;
}

// Set of base slugs (locale-stripped) that have at least one non-English
// translation available in the docs collection.
const docs = await getCollection("docs");
const translatedBaseSlugs = new Set();
for (const entry of docs) {
const [first, ...rest] = entry.id.split("/");
if (localeCodes.includes(first)) {
translatedBaseSlugs.add(rest.join("/"));
}
}

const currentBaseSlug = baseSlug(Astro.locals.starlightRoute.id);
const hasTranslations = translatedBaseSlugs.has(currentBaseSlug);
---

{hasTranslations && <Default {...Astro.props} />}
Loading