mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
docs: add dynamic href to cta
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10417 GitOrigin-RevId: eb92c66e777050457374968d45544d1dbb7c000d
This commit is contained in:
parent
b2eed614fa
commit
faf2636172
@ -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',
|
||||
|
@ -33,6 +33,23 @@ const CustomDocItem = props => {
|
||||
cell.innerHTML = cell.innerHTML.replace(/_/g, '_<wbr>');
|
||||
});
|
||||
}
|
||||
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user