aboutsummaryrefslogtreecommitdiffstats
path: root/src/theme/BlogSidebar/Desktop.tsx
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2024-03-23 18:02:45 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2024-03-23 18:07:21 +0100
commitfbd41d395916176dde11bb0e417f1210f34eb4ab (patch)
tree7384a50b1a90ba5909d8f93f589df661640681e6 /src/theme/BlogSidebar/Desktop.tsx
parentSimplify compression (diff)
downloadblog-fbd41d395916176dde11bb0e417f1210f34eb4ab.tar.gz
blog-fbd41d395916176dde11bb0e417f1210f34eb4ab.tar.zst
blog-fbd41d395916176dde11bb0e417f1210f34eb4ab.zip
Add blog
Site structure follows SEO tips from https://johnnyreilly.com/how-we-fixed-my-seo * The blog pages have as simple of an URL as possible. To this end, the home page of the site is actually the first index page of the blog. * Customize the blog index page BlogListPage component to show the landing page as the first index page. * Rename /archive to /blog to avoid a dated feel. * Remove the date from post URLs using the slug property.
Diffstat (limited to 'src/theme/BlogSidebar/Desktop.tsx')
-rw-r--r--src/theme/BlogSidebar/Desktop.tsx55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/theme/BlogSidebar/Desktop.tsx b/src/theme/BlogSidebar/Desktop.tsx
new file mode 100644
index 0000000..d06f239
--- /dev/null
+++ b/src/theme/BlogSidebar/Desktop.tsx
@@ -0,0 +1,55 @@
1/*
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 * Copyright (c) 2024 Kristóf Marussy <kristof@marussy.com>
4 *
5 * SPDX-License-Identifier: MIT
6 *
7 * This file was derived from
8 * https://github.com/facebook/docusaurus/blob/6f17d5493877ba38d8b4e0b0d468f44401375c30/packages/docusaurus-theme-classic/src/theme/BlogSidebar/Desktop/index.tsx
9 * via the `swizzle` mechanism of Docusaurus.
10 *
11 * It was modified to change the sidebar title styling.
12 */
13
14import Link from '@docusaurus/Link';
15import { translate } from '@docusaurus/Translate';
16import { useVisibleBlogSidebarItems } from '@docusaurus/theme-common/internal';
17import type { Props } from '@theme/BlogSidebar/Desktop';
18import React from 'react';
19import clsx from 'clsx';
20
21import styles from './Desktop.module.css';
22
23export default function BlogSidebarDesktop({ sidebar }: Props) {
24 const items = useVisibleBlogSidebarItems(sidebar.items);
25 return (
26 <aside className="col col--3">
27 <nav
28 className={clsx(styles.sidebar, 'thin-scrollbar')}
29 aria-label={translate({
30 id: 'theme.blog.sidebar.navAriaLabel',
31 message: 'Blog recent posts navigation',
32 description: 'The ARIA label for recent posts in the blog sidebar',
33 })}
34 >
35 <div className={clsx(styles.sidebarItemTitle, 'margin-bottom--md')}>
36 <span aria-hidden="true">🗓️</span> {sidebar.title}
37 </div>
38 <ul className={clsx(styles.sidebarItemList, 'clean-list')}>
39 {items.map((item) => (
40 <li key={item.permalink} className={styles.sidebarItem}>
41 <Link
42 isNavLink
43 to={item.permalink}
44 className={styles.sidebarItemLink}
45 activeClassName={styles.sidebarItemLinkActive}
46 >
47 {item.title}
48 </Link>
49 </li>
50 ))}
51 </ul>
52 </nav>
53 </aside>
54 );
55}