From e7109e0aeba5d16b2ef927b2d736638d0a51ca36 Mon Sep 17 00:00:00 2001 From: Elliot Voris Date: Tue, 26 Mar 2024 09:51:10 -0500 Subject: [PATCH 01/12] Add redirects for the various guides --- docs/guides/README.mdx | 10 ++++++++++ nginx/includes/redirects.conf | 2 ++ src/sidebar-generator.js | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/docs/guides/README.mdx b/docs/guides/README.mdx index c4bb13ea..35a13f13 100644 --- a/docs/guides/README.mdx +++ b/docs/guides/README.mdx @@ -2,6 +2,16 @@ title: How-To Guides description: here you will find really useful guides hide_table_of_contents: true +sidebar_custom_props: + migration: + href: https://developers.stellar.org/docs/smart-contracts/guides + label: How-To Guides --- +:::danger These are not the droids you're looking for + +This page has been migrated to the Stellar Developers documentation. Please [click here](https://developers.stellar.org/docs/smart-contracts/guides) for the most up-to-date information + +::: + The page lists all guides we have available for Soroban. Simply put, a "guide" is a short, bite-sized example that details how to accomplish a specific task. These guides are focused on a single topic, and are limited in scope. diff --git a/nginx/includes/redirects.conf b/nginx/includes/redirects.conf index 707c6264..6bc9a4ef 100644 --- a/nginx/includes/redirects.conf +++ b/nginx/includes/redirects.conf @@ -63,3 +63,5 @@ rewrite "^/docs/category/soroban-internals$" "https://developers.stellar.org/doc rewrite "^/docs/soroban-internals/contract-interactions$" "https://developers.stellar.org/docs/learn/smart-contract-internals/contract-interactions/overview" permanent; rewrite "^/docs/soroban-internals(.*)$" "https://developers.stellar.org/docs/learn/smart-contract-internals$1" permanent; rewrite "^/docs/migrate(.*)$" "https://developers.stellar.org/docs/learn/migrate$1" permanent; +# smart contracts +rewrite "^/docs/guides(.*)$" "https://developers.stellar.org/docs/smart-contracts/guides$1" permanent; diff --git a/src/sidebar-generator.js b/src/sidebar-generator.js index 0fe8a08d..f311c086 100644 --- a/src/sidebar-generator.js +++ b/src/sidebar-generator.js @@ -4,6 +4,13 @@ const path = require('path') const migrationLinksRecursive = (sidebarItems) => { const result = sidebarItems.map((sidebarItem) => { if (sidebarItem.type === 'category') { + if (sidebarItem.label === 'How-To Guides') { + return { + type: 'link', + href: sidebarItem.customProps.migration.href, + label: sidebarItem.customProps.migration.label, + } + } return {...sidebarItem, items: migrationLinksRecursive(sidebarItem.items)} } From a4d2f1d83c63dabc3d6186f0a761eb1954a1cc74 Mon Sep 17 00:00:00 2001 From: Elliot Voris Date: Tue, 26 Mar 2024 10:59:23 -0500 Subject: [PATCH 02/12] add redirects for tutorials --- docs/tutorials/README.mdx | 10 ++++++++++ nginx/includes/redirects.conf | 13 +++++++------ src/sidebar-generator.js | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/docs/tutorials/README.mdx b/docs/tutorials/README.mdx index ba319b52..f03a4754 100644 --- a/docs/tutorials/README.mdx +++ b/docs/tutorials/README.mdx @@ -1,10 +1,20 @@ --- title: Tutorials hide_table_of_contents: true +sidebar_custom_props: + migration: + href: https://developers.stellar.org/docs/smart-contracts/example-contracts + label: Tutorials --- import DocCardList from "@theme/DocCardList"; +:::danger These are not the droids you're looking for + +This page has been migrated to the Stellar Developers documentation. Please [click here](https://developers.stellar.org/docs/smart-contracts/example-contracts) for the most up-to-date information + +::: + The Soroban team has put together a large collection of [example contracts] to demonstrate use of the Soroban smart contracts platform. For many of these example contracts, we've written an accompanying "tutorial" that will walk you through the example contracts and describe a bit more about their design. You can think of these "tutorials" as example contracts that end with a deployable smart contract. You can use the provided filters to find a relevant tutorial for your experience level. diff --git a/nginx/includes/redirects.conf b/nginx/includes/redirects.conf index 6bc9a4ef..df67e4a3 100644 --- a/nginx/includes/redirects.conf +++ b/nginx/includes/redirects.conf @@ -1,11 +1,11 @@ -rewrite "^/docs/category/examples$" "/docs/tutorials" permanent; +rewrite "^/docs/category/examples$" "https://developers.stellar.org/docs/smart-contracts/example-contracts" permanent; rewrite "^/docs/getting-started/run-rpc$" "https://developers.stellar.org/network/soroban-rpc/admin-guide" permanent; -rewrite "^/docs/category/tutorials$" "/docs/tutorials" permanent; +rewrite "^/docs/category/tutorials$" "https://developers.stellar.org/docs/smart-contracts/example-contracts" permanent; rewrite "^/docs/tutorials/deploy-to-futurenet$" "/docs/getting-started/deploy-to-testnet" permanent; rewrite "^/fundamentals-and-concepts/faq$" "/docs/faq" permanent; -rewrite "^/docs/examples/events$" "/docs/tutorials/events" permanent; +rewrite "^/docs/examples/events$" "https://developers.stellar.org/docs/smart-contracts/example-contracts/events" permanent; rewrite "^/docs/learn/rust-dialect$" "https://developers.stellar.org/docs/learn/smart-contract-internals/rust-dialect" permanent; -rewrite "^/docs/advanced-tutorials/liquidity-pool-b6f$" "/docs/tutorials/liquidity-pool" permanent; +rewrite "^/docs/advanced-tutorials/liquidity-pool-b6f$" "https://developers.stellar.org/docs/smart-contracts/example-contracts/liquidity-pool" permanent; rewrite "^/docs(/category)?/learn$" "https://developers.stellar.org/docs/learn/smart-contract-internals" permanent; rewrite "^/docs/category/fundamentals-and-concepts$" "https://developers.stellar.org/docs/learn/smart-contract-internals" permanent; rewrite "^/docs/built-in-contracts/token$" "/docs/tokens/stellar-asset-contract" permanent; @@ -15,7 +15,7 @@ rewrite "^/docs/tutorials/testing$" "https://developers.stellar.org/docs/learn/s rewrite "^/docs/category/how-to-guides$" "/docs/guides" permanent; rewrite "^/docs/getting-started/connect-freighter-wallet$" "/docs/reference/freighter" permanent; rewrite "^/docs/common-interfaces/token$" "/docs/tokens/token-interface" permanent; -rewrite "^/docs/how-to-guides/tokens$" "/docs/tutorials/tokens" permanent; +rewrite "^/docs/how-to-guides/tokens$" "https://developers.stellar.org/docs/smart-contracts/example-contracts/tokens" permanent; rewrite "^/dapps/category/challenges$" "/dashboard" permanent; rewrite "^/docs/guides/cli/wrap-token$" "/docs/guides/cli/deploy-stellar-asset-contract" permanent; # BEGIN re-structure redirects @@ -32,7 +32,7 @@ rewrite "^/docs/fundamentals-and-concepts/(built-in-types|custom-types|fully-typ rewrite "^/docs/fundamentals-and-concepts/invoking-contracts-with-transactions$" "https://developers.stellar.org/docs/learn/smart-contract-internals/contract-interactions/stellar-transaction" permanent; rewrite "^/docs/soroban-internals/contract-interactions/stellar-transactions$" "https://developers.stellar.org/docs/learn/smart-contract-internals/contract-interactions/stellar-transaction" permanent; rewrite "^/docs/fundamentals-and-concepts/interacting-with-contracts$" "https://developers.stellar.org/docs/learn/smart-contract-internals/contract-interactions" permanent; -rewrite "^/docs/(basic|advanced)-tutorials(/.*)$" "/docs/tutorials$2" permanent; +rewrite "^/docs/(basic|advanced)-tutorials(/.*)$" "https://developers.stellar.org/docs/smart-contracts/example-contracts$2" permanent; rewrite "^/docs/fundamentals-and-concepts(/.*)$" "https://developers.stellar.org/docs/learn/smart-contract-internals$1" permanent; rewrite "^/docs/notes" "https://developers.stellar.org/meetings" permanent; ##### BEGIN merge redirects @@ -65,3 +65,4 @@ rewrite "^/docs/soroban-internals(.*)$" "https://developers.stellar.org/docs/lea rewrite "^/docs/migrate(.*)$" "https://developers.stellar.org/docs/learn/migrate$1" permanent; # smart contracts rewrite "^/docs/guides(.*)$" "https://developers.stellar.org/docs/smart-contracts/guides$1" permanent; +rewrite "^/docs/tutorials(.*)$" "https://developers.stellar.org/docs/smart-contracts/example-contracts$1" permanent; diff --git a/src/sidebar-generator.js b/src/sidebar-generator.js index f311c086..9404f7d5 100644 --- a/src/sidebar-generator.js +++ b/src/sidebar-generator.js @@ -4,7 +4,7 @@ const path = require('path') const migrationLinksRecursive = (sidebarItems) => { const result = sidebarItems.map((sidebarItem) => { if (sidebarItem.type === 'category') { - if (sidebarItem.label === 'How-To Guides') { + if (sidebarItem.label === 'How-To Guides' || sidebarItem.label === 'Tutorials') { return { type: 'link', href: sidebarItem.customProps.migration.href, From 7fb57ff3d20b4a9ce58125a6d16d292c0d272e86 Mon Sep 17 00:00:00 2001 From: Elliot Voris Date: Tue, 26 Mar 2024 11:00:27 -0500 Subject: [PATCH 03/12] fix an older "guides" nginx redirect --- nginx/includes/redirects.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx/includes/redirects.conf b/nginx/includes/redirects.conf index df67e4a3..ba2e7789 100644 --- a/nginx/includes/redirects.conf +++ b/nginx/includes/redirects.conf @@ -12,7 +12,7 @@ rewrite "^/docs/built-in-contracts/token$" "/docs/tokens/stellar-asset-contract" rewrite "^/docs/getting-started/deploy-to-a-local-network$" "/docs/getting-started/deploy-to-testnet" permanent; rewrite "^/docs/getting-started/deploy-to-futurenet$" "/docs/getting-started/deploy-to-testnet" permanent; rewrite "^/docs/tutorials/testing$" "https://developers.stellar.org/docs/learn/smart-contract-internals/debugging" permanent; -rewrite "^/docs/category/how-to-guides$" "/docs/guides" permanent; +rewrite "^/docs/category/how-to-guides$" "https://developers.stellar.org/docs/smart-contracts/guides" permanent; rewrite "^/docs/getting-started/connect-freighter-wallet$" "/docs/reference/freighter" permanent; rewrite "^/docs/common-interfaces/token$" "/docs/tokens/token-interface" permanent; rewrite "^/docs/how-to-guides/tokens$" "https://developers.stellar.org/docs/smart-contracts/example-contracts/tokens" permanent; From 85894ab0dee365c13ed9e08383ce1aee7e32d584 Mon Sep 17 00:00:00 2001 From: Elliot Voris Date: Tue, 26 Mar 2024 11:28:50 -0500 Subject: [PATCH 04/12] remove "doc cards" from tutorials and guides pages --- docs/tutorials/README.mdx | 4 ---- src/theme/DocItem/Footer/index.js | 8 -------- 2 files changed, 12 deletions(-) diff --git a/docs/tutorials/README.mdx b/docs/tutorials/README.mdx index f03a4754..6c97a31e 100644 --- a/docs/tutorials/README.mdx +++ b/docs/tutorials/README.mdx @@ -7,8 +7,6 @@ sidebar_custom_props: label: Tutorials --- -import DocCardList from "@theme/DocCardList"; - :::danger These are not the droids you're looking for This page has been migrated to the Stellar Developers documentation. Please [click here](https://developers.stellar.org/docs/smart-contracts/example-contracts) for the most up-to-date information @@ -17,6 +15,4 @@ This page has been migrated to the Stellar Developers documentation. Please [cli The Soroban team has put together a large collection of [example contracts] to demonstrate use of the Soroban smart contracts platform. For many of these example contracts, we've written an accompanying "tutorial" that will walk you through the example contracts and describe a bit more about their design. You can think of these "tutorials" as example contracts that end with a deployable smart contract. You can use the provided filters to find a relevant tutorial for your experience level. - - [example contracts]: https://github.com/stellar/soroban-examples diff --git a/src/theme/DocItem/Footer/index.js b/src/theme/DocItem/Footer/index.js index d3c7981d..80f671ff 100644 --- a/src/theme/DocItem/Footer/index.js +++ b/src/theme/DocItem/Footer/index.js @@ -5,7 +5,6 @@ import {useDoc} from '@docusaurus/theme-common/internal'; import LastUpdated from '@theme/LastUpdated'; import EditThisPage from '@theme/EditThisPage'; import TagsListInline from '@theme/TagsListInline'; -import DocCardList from '@theme/DocCardList'; import ReaderFeedback from '@site/src/components/ReaderFeedback'; import styles from './styles.module.css'; @@ -52,18 +51,11 @@ export default function DocItemFooter() { const canDisplayTagsRow = tags.length > 0; const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy); const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow; - const canDisplayDocCardsOnGuide = metadata.permalink.startsWith('/docs/guides') if (!canDisplayFooter) { return null; } return ( <> - {canDisplayDocCardsOnGuide && -
- {metadata.permalink !== '/docs/guides/' &&

Guides in this category:

} - -
- }