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
1 change: 1 addition & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,7 @@ const config = {
sitemap: {
changefreq: "weekly",
priority: 0.5,
lastmod: "date",
ignorePatterns: [
"/docs/graphql-reference/**",
"/markdown-page/**",
Expand Down
4 changes: 4 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ server {
root /usr/share/nginx/html;
index index.html;

# Behind TLS termination nginx sees plain http; emit relative Location headers
# so 301s keep the client's https scheme (no extra http->https upgrade hop).
absolute_redirect off;

# --- Compression (WP-0.1) ---
# The base image gzips text/html only; add JS/CSS/SVG/JSON so bundles ship
# compressed. Brotli is intentionally NOT enabled: nginx:stable-alpine ships
Expand Down
35 changes: 3 additions & 32 deletions plugins/tech-article-jsonld.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,33 +69,6 @@ function gitDate(siteDir, filePath, first) {
}
}

function humanize(seg) {
return seg
.replace(/[-_]+/g, " ")
.replace(/\b\w/g, (c) => c.toUpperCase());
}

function breadcrumb(base, permalink, title) {
const parts = permalink.split("/").filter(Boolean); // e.g. ["docs","blockchain","Solana","x"]
const items = [];
let acc = "";
parts.forEach((seg, i) => {
acc += `/${seg}`;
const isLast = i === parts.length - 1;
items.push({
"@type": "ListItem",
position: i + 1,
name: isLast ? title || humanize(seg) : seg === "docs" ? "Docs" : humanize(seg),
item: `${base}${acc}/`,
});
});
return {
"@context": "https://schema.org",
"@type": "BreadcrumbList",
itemListElement: items,
};
}

/** @type {import('@docusaurus/types').PluginModule} */
module.exports = function techArticleJsonLdPlugin(context) {
return {
Expand Down Expand Up @@ -142,11 +115,9 @@ module.exports = function techArticleJsonLdPlugin(context) {
},
};

const crumbs = breadcrumb(base, permalink, title);

const tag =
`<script type="application/ld+json">${JSON.stringify(techArticle)}</script>` +
`<script type="application/ld+json">${JSON.stringify(crumbs)}</script>`;
// BreadcrumbList is emitted natively by the Docusaurus theme's breadcrumbs,
// so we inject only TechArticle here to avoid duplicate structured data.
const tag = `<script type="application/ld+json">${JSON.stringify(techArticle)}</script>`;

let html = fs.readFileSync(htmlPath, "utf8");
if (html.includes('"@type":"TechArticle"')) {
Expand Down
Loading