Skip to content

Commit

Permalink
docs: add redirects for old links (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiweiii authored Jul 28, 2021
1 parent 9c469db commit ae7659a
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 62 deletions.
142 changes: 80 additions & 62 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,156 +1,174 @@
module.exports = {
title: 'Rooks',
tagline: 'Collection of React hooks ⚓ for everyone. ',
url: 'https://react-hooks.org',
baseUrl: '/',
organizationName: 'imbhargav5',
projectName: 'rooks',
title: "Rooks",
tagline: "Collection of React hooks ⚓ for everyone. ",
url: "https://react-hooks.org",
baseUrl: "/",
organizationName: "imbhargav5",
projectName: "rooks",
scripts: [
{
src: 'https://buttons.github.io/buttons.js',
src: "https://buttons.github.io/buttons.js",
async: true,
defer: true,
},
{
src: 'https://cdn.splitbee.io/sb.js',
src: "https://cdn.splitbee.io/sb.js",
async: true,
},
{
src: 'https://cdn.jsdelivr.net/npm/@widgetbot/crate@3',
src: "https://cdn.jsdelivr.net/npm/@widgetbot/crate@3",
async: true,
defer: true,
},
],
favicon:
'https://github.com/imbhargav5/rooks/raw/master/.github/assets/favicon-24x24.png',
"https://github.com/imbhargav5/rooks/raw/master/.github/assets/favicon-24x24.png",
customFields: {
users: [
{
caption: 'User1',
image: '/img/undraw_open_source.svg',
infoLink: 'https://www.facebook.com',
caption: "User1",
image: "/img/undraw_open_source.svg",
infoLink: "https://www.facebook.com",
pinned: true,
},
],
repoUrl: 'https://github.com/imbhargav5/rooks',
repoUrl: "https://github.com/imbhargav5/rooks",
},
onBrokenLinks: 'log',
onBrokenLinks: "log",
presets: [
[
'@docusaurus/preset-classic',
"@docusaurus/preset-classic",
{
docs: {
showLastUpdateAuthor: true,
showLastUpdateTime: true,
path: 'docs',
sidebarPath: require.resolve('./sidebars.json'),
path: "docs",
sidebarPath: require.resolve("./sidebars.json"),
},
blog: {
path: 'blog',
path: "blog",
},
theme: {
customCss: [require.resolve('./src/css/customTheme.css')],
customCss: [require.resolve("./src/css/customTheme.css")],
},
},
],
],
plugins: [
[
"@docusaurus/plugin-client-redirects",
{
createRedirects: function (existingPath) {
if (/use[A-Z]/.test(existingPath)) {
return existingPath
.split(/(?=[A-Z])/)
.join("-")
.toLowerCase();
}
},
},
],
],
plugins: [],
themeConfig: {
navbar: {
title: 'Rooks',
title: "Rooks",
logo: {
alt: 'Site Logo',
alt: "Site Logo",
src:
'https://github.com/imbhargav5/rooks/raw/master/.github/assets/icon.png',
href: '/', // Default to `siteConfig.baseUrl`.
target: '_self', // By default, this value is calculated based on the `href` attribute (the external link will open in a new tab, all others in the current one).
"https://github.com/imbhargav5/rooks/raw/master/.github/assets/icon.png",
href: "/", // Default to `siteConfig.baseUrl`.
target: "_self", // By default, this value is calculated based on the `href` attribute (the external link will open in a new tab, all others in the current one).
},
items: [
{
to: '/docs/getting-started/',
label: 'Getting Started',
position: 'left',
to: "/docs/getting-started/",
label: "Getting Started",
position: "left",
},
{
to: '/docs/',
label: 'Documentation',
position: 'left',
to: "/docs/",
label: "Documentation",
position: "left",
},
{
href: 'https://github.com/imbhargav5/rooks',
label: 'Github',
position: 'right',
href: "https://github.com/imbhargav5/rooks",
label: "Github",
position: "right",
},
{
href: '/docs/hooks-list/',
label: 'Hooks List',
position: 'left',
href: "/docs/hooks-list/",
label: "Hooks List",
position: "left",
},
{
href: '/docs/motivation/',
label: 'Motivation',
position: 'right',
href: "/docs/motivation/",
label: "Motivation",
position: "right",
},
// {
// "to": "/help",
// "label": "Help",
// "position": "left"
// },
{
type: 'docsVersionDropdown',
position: 'right',
type: "docsVersionDropdown",
position: "right",
dropdownItemsBefore: [],
dropdownItemsAfter: [{ to: '/versions', label: 'All versions' }],
dropdownItemsAfter: [{ to: "/versions", label: "All versions" }],
},
],
},
image: 'img/undraw_online.svg',
image: "img/undraw_online.svg",
footer: {
links: [
{
// Label of the section of these links
title: 'Docs',
title: "Docs",
items: [
{
// Label of the link
label: 'All in one',
label: "All in one",
// Client-side routing, used for navigating within the website.
// The baseUrl will be automatically prepended to this value.
to: 'docs/',
to: "docs/",
},
{
label: "Getting Started",
to: "docs/getting-started/",
},
{
label: 'use-counter',
to: 'docs/use-counter/',
label: "Motivation",
to: "docs/motivation/",
},
{
label: 'use-did-mount',
to: 'docs/use-did-mount/',
label: "Hooks List",
to: "docs/hooks-list/",
},
],
},
{
// Label of the section of these links
title: 'Community',
title: "Community",
items: [
{
// Label of the link
label: 'Stack overflow',
label: "Stack overflow",
// Client-side routing, used for navigating within the website.
// The baseUrl will be automatically prepended to this value.
to: 'https://stackoverflow.com/questions/tagged/rooks',
to: "https://stackoverflow.com/questions/tagged/rooks",
},
{
label: 'Twitter',
to: 'https://twitter.com/imbhargav5',
label: "Twitter",
to: "https://twitter.com/imbhargav5",
},
],
},
{
title: 'More',
title: "More",
items: [
{
label: 'Github',
to: 'https://github.com/imbhargav5/rooks',
label: "Github",
to: "https://github.com/imbhargav5/rooks",
},
// {
// html: `
Expand All @@ -173,12 +191,12 @@ module.exports = {
],
},
],
copyright: 'MIT© 2020 Bhargav Ponnapalli',
copyright: "MIT© 2020 Bhargav Ponnapalli",
logo: {},
},
algolia: {
apiKey: process.env.ALGOLIA_API_KEY,
indexName: 'react-hooks',
indexName: "react-hooks",
// Optional: see doc section bellow,
contextual: true,
// searchParameters: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@babel/preset-env": "7.12.11",
"@babel/preset-react": "7.0.0",
"@docusaurus/core": "^2.0.0-alpha.75",
"@docusaurus/plugin-client-redirects": "2.0.0-alpha.75",
"@docusaurus/preset-classic": "^2.0.0-alpha.75",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^16.0.0",
Expand Down
21 changes: 21 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2301,6 +2301,22 @@
url-loader "^4.1.1"
webpack "^5.28.0"

"@docusaurus/plugin-client-redirects@2.0.0-alpha.75":
version "2.0.0-alpha.75"
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-2.0.0-alpha.75.tgz#b74e871571648836a9e0533fc6c3502c06463574"
integrity sha512-6J41kR1aOTp8Ky7p7/pWtsEJxZgwDaRqXIE5K9eGt328XKprXoaLThE1w6dT9tGpwEdC/3gCNc2pTS6HHcyWYg==
dependencies:
"@docusaurus/core" "2.0.0-alpha.75"
"@docusaurus/types" "2.0.0-alpha.75"
"@docusaurus/utils" "2.0.0-alpha.75"
"@docusaurus/utils-validation" "2.0.0-alpha.75"
chalk "^3.0.0"
eta "^1.11.0"
fs-extra "^9.1.0"
globby "^11.0.2"
lodash "^4.17.20"
tslib "^2.1.0"

"@docusaurus/plugin-content-blog@2.0.0-alpha.75":
version "2.0.0-alpha.75"
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.0.0-alpha.75.tgz#a8e97c4aac1117c175318a69ca38ea97f2493653"
Expand Down Expand Up @@ -7947,6 +7963,11 @@ esutils@^2.0.2:
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==

eta@^1.11.0:
version "1.12.3"
resolved "https://registry.yarnpkg.com/eta/-/eta-1.12.3.tgz#2982d08adfbef39f9fa50e2fbd42d7337e7338b1"
integrity sha512-qHixwbDLtekO/d51Yr4glcaUJCIjGVJyTzuqV4GPlgZo1YpgOKG+avQynErZIYrfM6JIJdtiG2Kox8tbb+DoGg==

eta@^1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/eta/-/eta-1.12.1.tgz#d985766591676c323f02dfc48a67539212745937"
Expand Down

0 comments on commit ae7659a

Please sign in to comment.