This is an automated email from the ASF dual-hosted git repository.
zfc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-website.git
The following commit(s) were added to refs/heads/master by this push:
new 3664b1101 Tweak sidebar style, Fix broken links for blogs (#29)
3664b1101 is described below
commit 3664b1101ef2642ee2e29399f5a269a676d0fc27
Author: Glass Panel <[email protected]>
AuthorDate: Sat Jul 19 16:05:33 2025 +0800
Tweak sidebar style, Fix broken links for blogs (#29)
* Add sidebar for overview, Tweak sidebar style
* Cleanup console.log
* Fix broken links for blogs
---
.gitignore | 3 ++-
site/{src/pages => docs}/overview.md | 0
site/docusaurus.config.js | 28 +++++++++++++++++++++-------
site/sidebars.js | 18 +++++++++++++++++-
4 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/.gitignore b/.gitignore
index 4141ce3b8..ad8d548fa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,5 @@ sgx-sdk-docs/Cargo.lock
.docusaurus
Cargo.lock
site/docs/*
-!site/docs/community
\ No newline at end of file
+!site/docs/community
+!site/docs/*.md
\ No newline at end of file
diff --git a/site/src/pages/overview.md b/site/docs/overview.md
similarity index 100%
rename from site/src/pages/overview.md
rename to site/docs/overview.md
diff --git a/site/docusaurus.config.js b/site/docusaurus.config.js
index 954383d18..a5947c425 100644
--- a/site/docusaurus.config.js
+++ b/site/docusaurus.config.js
@@ -50,23 +50,36 @@ const config = {
if (path.resolve(params.filePath) == path.resolve(key)) {
result.frontMatter.displayed_sidebar = `${indexDocs[key]}_sidebar`;
}
- });
+ });
return result;
},
- // Replace autolinks to avoid mdx rendering issues.
+
preprocessor: (file) => {
+ // Replace autolinks to avoid mdx rendering issues.
const autolinks =
file.fileContent.match(/<((https?:)|(mailto:))[\S]+>/gi);
autolinks?.forEach((link) => {
file.fileContent = file.fileContent.replaceAll(link, `[${link.slice(1,
-1)}](${link.slice(1, -1)})`);
});
+
+ // Implement notice blocks.
const notices = file.fileContent.match(/^:::([\s\S]+?)^:::$/gm);
notices?.forEach((n) => {
const lines = n.split('\n');
lines[0] = '**' + lines[0].split(' ').slice(2).join(' ') + '** <br/>';
lines.pop(); // Remove the last line which is `:::`
- file.fileContent = file.fileContent.replaceAll(n, lines.map(i=>'>
'+i).join('\n'));
+ file.fileContent = file.fileContent.replaceAll(n, lines.map(i => '> '
+ i).join('\n'));
});
+
+ // Replace blog links date string to slash format.
+ if (path.relative(path.resolve(), file.filePath).startsWith('blog' +
path.sep)) {
+ const blogLinks =
file.fileContent.matchAll(/\[[^\]]+\]\(\/blog\/(\d{4}-\d{2}-\d{2}-)\S+\)/g);
+ for (const link of blogLinks) {
+ const result = link[0].replace(link[1], link[1].replace(/-/g, '/'));
+ file.fileContent = file.fileContent.replaceAll(link[0], result);
+ }
+ }
+
return file.fileContent;
},
@@ -168,14 +181,15 @@ const config = {
to: '/overview',
label: 'Docs',
items: [
- { label: 'Teaclave TrustZone SDK', to: '/trustzone-sdk-docs/' },
+ { label: 'Teaclave TrustZone SDK', to: '/trustzone-sdk-docs/',
file: 'teaclave-trustzone-sdk/docs/README.md' },
{ label: 'API Docs: Teaclave TrustZone SDK (Host)', href:
'https://teaclave.apache.org/api-docs/trustzone-sdk/optee_teec', target:
'_self', rel: '' },
{ label: 'API Docs: Teaclave TrustZone SDK (TA)', href:
'https://teaclave.apache.org/api-docs/trustzone-sdk/optee_utee', target:
'_self', rel: '' },
- { label: 'Teaclave SGX SDK', to: '/sgx-sdk-docs/' },
+ { label: 'Teaclave SGX SDK', to: '/sgx-sdk-docs/', file:
'teaclave-sgx-sdk/documents/README.md' },
{ label: 'API Docs: Teaclave SGX SDK', href:
'https://teaclave.apache.org/api-docs/sgx-sdk/', target: '_self', rel: '' },
- { label: 'Teaclave', to: '/teaclave-docs/' },
- { label: 'Teaclave FaaS (legacy)', to: '/docs/' },
+ { label: 'Teaclave', to: '/teaclave-docs/', file:
'teaclave-docs/README.md' },
+ { label: 'Teaclave FaaS (legacy)', to: '/docs/', file:
'teaclave-faas-legacy/docs/README.md' },
],
+ file: 'overview.md',
position: 'right',
},
{ to: '/blog', label: 'Blog', position: 'right' },
diff --git a/site/sidebars.js b/site/sidebars.js
index d6903df0e..a04275957 100644
--- a/site/sidebars.js
+++ b/site/sidebars.js
@@ -120,6 +120,7 @@ const repos = {
// Get rid of type annotation error
const navbar = Object.assign(Object.create({}), config.themeConfig?.navbar);
const communityNav = navbar.items?.find(item => item.label == 'Community');
+const docsNav = navbar.items?.find(item => item.label == 'Docs');
const sidebars = {
...Object.fromEntries(
@@ -128,7 +129,8 @@ const sidebars = {
repo.map(([title, items]) => ({
type: 'category',
label: title,
- items: items
+ items: items,
+ collapsed: false,
}))
])
),
@@ -137,6 +139,20 @@ const sidebars = {
].concat(communityNav.items
.map(item => sidebarItemFromNavbarItem(item))
),
+ 'overview_sidebar': [
+ Object.assign(
+ sidebarItemFromNavbarItem(docsNav), {
+ label: 'Overview',
+ })
+ ].concat(
+ docsNav.items
+ .map(item => sidebarItemFromNavbarItem(item))
+ .map(item => {
+ if (item.type == 'doc')
+ item.type = 'ref';
+ return item;
+ })
+ )
};
export default sidebars;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]