Skip to content

Commit

Permalink
feat: 更新文章
Browse files Browse the repository at this point in the history
  • Loading branch information
neo committed Aug 10, 2023
1 parent 3e6ffd4 commit 46bea34
Show file tree
Hide file tree
Showing 5 changed files with 494 additions and 36 deletions.
44 changes: 41 additions & 3 deletions .dumi/theme/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React, { useContext, useState, useEffect } from 'react';
import React, { useContext, useState } from 'react';
import { IRouteComponentProps } from '@umijs/types';
import { context, Link } from 'dumi/theme';
import Navbar from 'dumi-theme-default/src/components/Navbar';
import SideMenu from 'dumi-theme-default/src/components/SideMenu';
import SlugList from 'dumi-theme-default/src/components/SlugList';
import SearchBar from 'dumi-theme-default/src/components/SearchBar';
import { Popover } from 'antd';
import { Helmet } from 'dumi'
import Notice from './Notice';
import { useLocation } from 'react-router-dom'
import './style/layout.less';

const Hero = hero => (
Expand Down Expand Up @@ -71,10 +73,18 @@ const Features = features => (

const Layout: React.FC<IRouteComponentProps> = ({ children, location }) => {
const {
config: { mode, repository },
config,
meta,
locale,
} = useContext(context);

const { mode, repository, logo } = config

const { pathname } = useLocation();

// todo 临时方案
const hostname = 'https://brew.idayer.com'

const { url: repoUrl, branch, platform } = repository;
const [menuCollapsed, setMenuCollapsed] = useState<boolean>(true);
const isSiteMode = mode === 'site';
Expand All @@ -94,9 +104,17 @@ const Layout: React.FC<IRouteComponentProps> = ({ children, location }) => {
});
const repoPlatform =
{ github: 'GitHub', gitlab: 'GitLab' }[
(repoUrl || '').match(/(github|gitlab)/)?.[1] || 'nothing'
(repoUrl || '').match(/(github|gitlab)/)?.[1] || 'nothing'
] || platform;

if(!meta.img && logo) {
meta.img = logo
}

if(meta.img.indexOf('https://') === -1) {
meta.img = hostname + meta.img
}

return (
<div
className="__dumi-default-layout"
Expand All @@ -110,6 +128,26 @@ const Layout: React.FC<IRouteComponentProps> = ({ children, location }) => {
setMenuCollapsed(true);
}}
>
<Helmet>
{meta.title && <title>{meta.title}</title>}
{meta.title && <meta property="og:title" content={meta.title} />}
{meta.description && <meta name="description" content={meta.description} />}
{meta.description && (
<meta property="og:description" content={meta.description} />
)}
{meta.keywords && (
<meta name="keywords" content={meta.keywords.join(',')} />
)}
{meta.keywords &&
meta.keywords.map((keyword) => (
<meta key={keyword} property="article:tag" content={keyword}></meta>
))}
{/* <meta property="og:image" content="https://brew.idayer.com/images/homebrew-256x256.png"/> */}
{hostname && <link rel="canonical" href={hostname + pathname} />}
{meta.img && (
<meta property="og:image" content={meta.img} ></meta>
)}
</Helmet>
<Navbar
location={location}
navPrefix={
Expand Down
41 changes: 8 additions & 33 deletions .umirc.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,12 @@
import { defineConfig } from 'dumi';

export default defineConfig({
title: 'Homebrew',
title: 'Homebrew 中文网',
mode: 'site',
logo: '/images/homebrew-256x256.png',
favicon: '/favicon.ico',
locales: [['zh-CN', '中文']],
metas: [
{
name: 'keywords',
content: 'Mac,Homebrew,macOS',
},
{
name: 'description',
content:
'Homebrew是一款包管理工具,目前支持macOS和linux系统。主要有四个部分组成: brew、homebrew-core 、homebrew-cask、homebrew-bottles。本文主要介绍 Homebrew安装方式以及如何加速访问,顺便普及一些必要的知识。…',
},
{
property: 'og:title',
content: '镜像快速安装Homebrew教程',
},
{
property: 'og:url',
content: 'https://brew.idayer.com/',
},
{
property: 'og:description',
content:
'Homebrew是一款包管理工具,目前支持macOS和linux系统。主要有四个部分组成: brew、homebrew-core 、homebrew-cask、homebrew-bottles。本文主要介绍 Homebrew安装方式以及如何加速访问,顺便普及一些必要的知识。…',
},
{
property: 'og:image',
content: 'https://brew.idayer.com/images/homebrew-256x256.png',
},
{
property: 'og:site_name',
content: 'Homebrew安装教程 - 镜像',
},
],
metas: [],
navs: [
null,
{ title: 'GitHub', path: 'https://github.com/ineo6/homebrew-install' },
Expand Down Expand Up @@ -66,6 +35,12 @@ export default defineConfig({
path: '/guide/faq/',
},
],
'/install': [
{
title: '快系列-你快了吗',
children: ['/install/stable-diffusion-webui', '/install/nvm-for-nodejs'],
}
]
},
extraBabelPlugins: [
[
Expand Down
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ hero:
- text: 快速开始
link: /guide/start/
footer: Open-source MIT Licensed | Copyright © 2023<br />Powered by [Neo](https://github.com/ineo6)

keywords: [Mac,Homebrew,macOS]
title: 快速安装Homebrew教程
description: Homebrew是macOS上最强大的包管理工具,可以帮你安装众多软件,本站提供的一键安装脚本可以帮你快速安装Homebrew。
---

<h1 style="display: none">镜像快速安装Homebrew教程</h1>
Expand Down
Loading

0 comments on commit 46bea34

Please sign in to comment.