diff --git a/packages/rsbuild-config/src/lib/config/entries.ts b/packages/rsbuild-config/src/lib/config/entries.ts index e44310a..8def76b 100644 --- a/packages/rsbuild-config/src/lib/config/entries.ts +++ b/packages/rsbuild-config/src/lib/config/entries.ts @@ -18,7 +18,11 @@ export function discoverEntries(root: string, pattern: string): Record name is 'articles/index' + // We want it to be 'articles/index' to generate 'dist/articles/index.html' + // Rsbuild automatically maps 'articles/index' entry to 'dist/articles/index.html' + // The previous replace(/\/index$/, '') was stripping the 'index' making it 'articles' + // which generates 'dist/articles.html' instead of 'dist/articles/index.html' entries[name] = join(root, file); } diff --git a/packages/rsbuild-config/src/lib/config/rsbuild.ts b/packages/rsbuild-config/src/lib/config/rsbuild.ts index 78ed702..d7ade42 100644 --- a/packages/rsbuild-config/src/lib/config/rsbuild.ts +++ b/packages/rsbuild-config/src/lib/config/rsbuild.ts @@ -22,6 +22,9 @@ export function defineServiceConfig(config: RsbuildConfig = {}): RsbuildConfig { plugins: [pluginReact(), pluginTypeCheck()], html: { template: './src/static/index.html', + meta: { + description: 'Thoughts and creations of mine', + }, tags: [ { tag: 'style', diff --git a/packages/ui/src/components/Link/Link.tsx b/packages/ui/src/components/Link/Link.tsx index 7729065..b4a64ad 100644 --- a/packages/ui/src/components/Link/Link.tsx +++ b/packages/ui/src/components/Link/Link.tsx @@ -42,7 +42,7 @@ export const Link = memo(function Link(props: LinkProps) { const sharedClasses = cn( !color && 'text-[var(--rb-ring)]', - 'cursor-pointer hover:underline underline-offset-4 transition-colors', + 'cursor-pointer underline hover:no-underline underline-offset-4 transition-colors', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2', className ); diff --git a/packages/ui/src/components/ThemeSwitch/ThemeSwitch.tsx b/packages/ui/src/components/ThemeSwitch/ThemeSwitch.tsx index 5683f34..188dd58 100644 --- a/packages/ui/src/components/ThemeSwitch/ThemeSwitch.tsx +++ b/packages/ui/src/components/ThemeSwitch/ThemeSwitch.tsx @@ -45,7 +45,7 @@ export function ThemeSwitch(): React.JSX.Element { onPress={() => setPreference('system')} > - Auto + Follow system theme diff --git a/services/static/src/lib/core/createPage.tsx b/services/static/src/lib/core/createPage.tsx index 7cdf060..b2a5e90 100644 --- a/services/static/src/lib/core/createPage.tsx +++ b/services/static/src/lib/core/createPage.tsx @@ -28,6 +28,16 @@ export function createPage(Component: React.ComponentType, options: PageOptions document.title = options.title; } + if (options.description) { + let metaDescription = document.querySelector('meta[name="description"]'); + if (!metaDescription) { + metaDescription = document.createElement('meta'); + metaDescription.setAttribute('name', 'description'); + document.head.appendChild(metaDescription); + } + metaDescription.setAttribute('content', options.description); + } + if (rootElement) { const node = ( diff --git a/services/www/public/robots.txt b/services/www/public/robots.txt new file mode 100644 index 0000000..712a3a8 --- /dev/null +++ b/services/www/public/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Allow: / + +Sitemap: https://www.ermnvldmr.com/sitemap.xml diff --git a/services/www/src/components/layouts/ArticleLayout/ArticleLayout.tsx b/services/www/src/components/layouts/ArticleLayout/ArticleLayout.tsx index 5cb74e8..f528018 100644 --- a/services/www/src/components/layouts/ArticleLayout/ArticleLayout.tsx +++ b/services/www/src/components/layouts/ArticleLayout/ArticleLayout.tsx @@ -68,7 +68,7 @@ export const ArticleLayout: React.FC = ({ return ( - + @@ -97,7 +97,7 @@ export const ArticleLayout: React.FC = ({ )} - + {children} diff --git a/services/www/src/lib/core/createPage.tsx b/services/www/src/lib/core/createPage.tsx index 08b04f7..5571d15 100644 --- a/services/www/src/lib/core/createPage.tsx +++ b/services/www/src/lib/core/createPage.tsx @@ -29,6 +29,16 @@ export function createPage(Component: React.ComponentType, options: PageOptions document.title = options.title; } + if (options.description) { + let metaDescription = document.querySelector('meta[name="description"]'); + if (!metaDescription) { + metaDescription = document.createElement('meta'); + metaDescription.setAttribute('name', 'description'); + document.head.appendChild(metaDescription); + } + metaDescription.setAttribute('content', options.description); + } + if (rootElement) { const node = (