fix(docs): add split Get Started button to main docs page with audience links (#39467)

This commit is contained in:
Shantanu Khond
2026-04-28 20:05:26 +05:30
committed by GitHub
parent 3aa99c577e
commit ef50b688ee
7 changed files with 278 additions and 23 deletions

View File

@@ -0,0 +1,41 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import DocNavbarItem from '@theme-original/NavbarItem/DocNavbarItem';
import DocSidebarNavbarItem from '@theme-original/NavbarItem/DocSidebarNavbarItem';
import DocsVersionDropdownNavbarItem from '@theme-original/NavbarItem/DocsVersionDropdownNavbarItem';
import DocsVersionNavbarItem from '@theme-original/NavbarItem/DocsVersionNavbarItem';
import DropdownNavbarItem from '@theme-original/NavbarItem/DropdownNavbarItem';
import DefaultNavbarItem from '@theme-original/NavbarItem/DefaultNavbarItem';
import HtmlNavbarItem from '@theme-original/NavbarItem/HtmlNavbarItem';
import LocaleDropdownNavbarItem from '@theme-original/NavbarItem/LocaleDropdownNavbarItem';
import SearchNavbarItem from '@theme-original/NavbarItem/SearchNavbarItem';
import GetStartedSplitNavbarItem from './GetStartedSplitNavbarItem';
export default {
default: DefaultNavbarItem,
localeDropdown: LocaleDropdownNavbarItem,
search: SearchNavbarItem,
dropdown: DropdownNavbarItem,
html: HtmlNavbarItem,
doc: DocNavbarItem,
docSidebar: DocSidebarNavbarItem,
docsVersion: DocsVersionNavbarItem,
docsVersionDropdown: DocsVersionDropdownNavbarItem,
'custom-getStartedSplit': GetStartedSplitNavbarItem,
};

View File

@@ -0,0 +1,29 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import GetStartedSplitButton from '../../components/GetStartedSplitButton';
import '../../styles/main.css';
export default function GetStartedSplitNavbarItem() {
return (
<GetStartedSplitButton
variant="navbar"
rootClassName="default-button-theme get-started-split get-started-button"
/>
);
}

View File

@@ -147,7 +147,9 @@ export default function Root({ children }) {
const button = event.target.closest('.get-started-button, .default-button-theme');
if (button) {
const buttonText = button.textContent?.trim() || 'Unknown';
const href = button.getAttribute('href') || '';
const clickedLink = event.target.closest?.('a');
const href =
clickedLink?.getAttribute('href') || button.getAttribute('href') || '';
trackEvent('CTA', 'Click', `${buttonText} - ${href}`);
}
};