当前位置: 首页 > backend >正文

博客标题栏添加一个 About Me

在这里插入图片描述

文章目录

    • ✅ 目标
    • ✍️ 第一步:创建 About 页面
    • 🧭 第二步:在导航栏添加菜单项
    • 🔄 第三步:重新启动本地服务
    • 🪄 可选美化:自定义样式
    • 💡 小贴士
    • 🎉 示例
      • ✅ 文件路径:
      • ✅ 页面代码(支持头像、技能图标、社交媒体、博客导航
      • ✅ CSS 样式(新建 /src/pages/about.module.css)
      • 📌 提示

✅ 目标

  • 新建一个 About Me 页面,访问路径为 /about
  • 在顶部导航栏添加 “About Me” 的链接按钮

✍️ 第一步:创建 About 页面

在你的 Docusaurus 项目中,创建一个 Markdown 文件(或者 React 页面):

路径示例:/src/pages/about.md

---
title: About Me
description: Learn more about me
---# 👋 About Me你好,我是某某,正在写博客、研究 Kubernetes 和前端开发...这里你可以写自我介绍、兴趣爱好、联系方式等内容。

📌 Docusaurus 会自动将 /src/pages/about.md 映射为网站路径 /about

🧭 第二步:在导航栏添加菜单项

编辑配置文件:docusaurus.config.js

找到 themeConfig.navbar.items 数组,添加如下内容:

navbar: {title: '你的博客名',items: [{ to: '/about', label: 'About Me', position: 'right' },// 其他菜单项...],
}
  • to: 页面路径 /about
  • label: 显示在导航栏的文字
  • position: left 或 right

🔄 第三步:重新启动本地服务

npm run start

🪄 可选美化:自定义样式

你可以在 /src/css/custom.css 添加一些自定义样式

.about-title {font-size: 2rem;margin-top: 2rem;
}

然后在 about.md 中用 HTML 或 React 写法调用样式。

💡 小贴士

  • 如果你想要页面支持 React 组件,改用 .tsx 放在 /src/pages/about.tsx
  • 你可以用这个页面写自我介绍、社交媒体、技能图标、博客地图等。

🎉 示例

对话:好的,帮你生成一个包含头像、技能列表、社交链接的 “About Me” 页面模板,支持 React 组件,改用 .tsx 放在 /src/pages/about.tsx,写自我介绍、社交媒体、技能图标、博客地图等。

✅ 文件路径:

/upmdocs/src/pages/about.tsx

✅ 页面代码(支持头像、技能图标、社交媒体、博客导航

import React from 'react';
import Layout from '@theme/Layout';
import styles from './about.module.css';export default function AboutPage(): JSX.Element {return (<Layouttitle="关于我"description="系统管理员 & 前端新手的个人介绍页面"><main className={styles.container}><section className={styles.profile}><imgclassName={styles.avatar}src="https://avatars.githubusercontent.com/u/your-github-id"alt="Avatar"/><h1>👋 Hi, I'm Ghostwritten</h1><p>欢迎来到我的博客!我是一名系统管理员,正在学习前端开发,对 Kubernetes、云原生、文档写作 和 AI 技术充满热情 💡</p></section><section><h2>🚀 技能栈</h2><ul className={styles.skills}><li><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/javascript/javascript-original.svg" alt="JavaScript" /> JavaScript</li><li><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/react/react-original.svg" alt="React" /> React</li><li><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/kubernetes/kubernetes-plain.svg" alt="Kubernetes" /> Kubernetes</li><li><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/docker/docker-original.svg" alt="Docker" /> Docker</li><li><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/linux/linux-original.svg" alt="Linux" /> Linux</li></ul></section><section><h2>🌐 社交链接</h2><ul className={styles.social}><li><a href="https://ghostwritten.github.io" target="_blank">📝 我的博客</a></li><li><a href="https://github.com/ghostwritten" target="_blank">💻 GitHub</a></li><li><a href="mailto:your-email@example.com">📧 Email</a></li></ul></section><section><h2>🗺️ 博客地图</h2><ul><li><a href="/docs/category/kubernetes">📦 Kubernetes 系列</a></li><li><a href="/docs/category/front-end">🎨 前端学习笔记</a></li><li><a href="/docs/category/linux">🐧 Linux 实用技巧</a></li><li><a href="/docs/category/tools">🔧 工具推荐 & 配置</a></li></ul></section></main></Layout>);
}

✅ CSS 样式(新建 /src/pages/about.module.css)

.container {max-width: 800px;margin: 2rem auto;padding: 1rem;font-family: system-ui, sans-serif;
}.profile {text-align: center;margin-bottom: 2rem;
}.avatar {width: 120px;height: 120px;border-radius: 50%;margin-bottom: 1rem;box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}.skills {display: flex;flex-wrap: wrap;list-style: none;padding: 0;gap: 1rem;margin: 1rem 0;
}.skills li {display: flex;align-items: center;gap: 0.5rem;background: #f9f9f9;padding: 0.5rem 1rem;border-radius: 12px;font-weight: bold;
}.skills img {width: 24px;height: 24px;
}.social {list-style: none;padding: 0;
}.social li {margin: 0.5rem 0;
}.social a {text-decoration: none;color: #007acc;
}

展示效果:
在这里插入图片描述

📌 提示

  • about.tsx 用 TypeScript 写的 React 页面
  • about.module.css 是局部样式,不会污染其他页面
  • 头像、图标链接、社交媒体请替换成你自己的
  • 博客地图链接请根据你的实际文档结构修改。
http://www.xdnf.cn/news/274.html

相关文章:

  • RUI桌面TV版最新版免费下载-安卓电视版使用教程
  • 二叉树理论基础
  • static关键字
  • qt QGroupButton 实现两个QPushButton的互斥
  • 动态计算FPS(每秒帧数)的方法
  • Jsp技术入门指南【六】jsp脚本原理及隐式对象
  • 关于AI提示工程的详解,分点说明其核心概念、关键技巧和应用场景
  • 语音合成之二TTS模型损失函数进化史
  • 极狐GitLab 项目和群组的导入导出速率限制如何设置?
  • Linux 文件查找终极指南:find, locate, grep 等命令详解
  • 18-算法打卡-哈希表-两数之和-leetcode(1)-第十八天
  • 智能体时代的产业范式确立,中国企业以探索者姿态走出自己的路
  • [密码学实战]详解gmssl库与第三方工具兼容性问题及解决方案
  • Python语言基础教程(上)4.0
  • 15.4K Star!Vercel官方出品,零基础构建企业级AI聊天机器人
  • 进程(转账,卖票)
  • C#核心笔记——(六)框架基础
  • 【MySQL】数据库和表的操作详解
  • 6.6 “3步调用ChatGPT打造高可靠Python调度器,零依赖实现定时任务自动化“
  • Linux工具学习之【vim】
  • 医学图像中的不同模态图像详细介绍
  • VirtualBox导入 .ova 文件出错,怎么解决
  • Java入门-Map双列集合
  • 通过C# 将Excel表格转换为图片(JPG/ PNG)
  • 51单片机实验七:EEPROM AT24C02 与单片机的通信实例
  • 《计算机视觉度量:从特征描述到深度学习》—工业检测大模型RAG白皮书
  • 12芯束装光纤不同包层线颜色之间的排列顺序
  • Linux 内核开发/测试工具对比 Windows 驱动验证工具 (Driver Verifier)
  • 从数据集到开源模型,覆盖无机材料设计/晶体结构预测/材料属性记录等
  • 70. 爬楼梯