diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 4a3e86eb656..6aee8213ff6 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -249,7 +249,7 @@ const config = { className: 'nav-link_login', }, { - to: 'https://cloud.hasura.io/signup?pg=products&plcmt=header&cta=try-hasura&tech=default', + to: 'https://cloud.hasura.io/signup?pg=products&plcmt=header&cta=get_started&tech=default', label: 'Get Started', position: 'right', className: 'nav-link_getting-started', diff --git a/docs/src/components/CustomDocItem/index.tsx b/docs/src/components/CustomDocItem/index.tsx index 554a436bdb6..dc6df5ec73b 100644 --- a/docs/src/components/CustomDocItem/index.tsx +++ b/docs/src/components/CustomDocItem/index.tsx @@ -33,6 +33,23 @@ const CustomDocItem = props => { cell.innerHTML = cell.innerHTML.replace(/_/g, '_'); }); } + + // dynamically updating the pg prop for the getting started cta + function updateGettingStartedParam() { + const linkElement = document.querySelector('.navbar__link.nav-link_getting-started'); + + if (linkElement) { + let page = props.location.pathname; + page = page.slice(0, -1); + page = page.replace('/docs/', 'docs_v2_').replace('latest/', '').replace(/\//g, '_'); + + const href = linkElement.getAttribute('href'); + const newHref = href.replace(/pg=[a-z_-]+/, `pg=${page}`); + linkElement.setAttribute('href', newHref); + } + } + + updateGettingStartedParam(); }, []); // redirect them to the index if they attempt to directly navigate to a path with