Skip to content

Commit

Permalink
Merge pull request #38 from yunu7067/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
yunu7067 authored Jul 2, 2022
2 parents 2c11b63 + ce22d86 commit e8161ae
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 31 deletions.
Binary file not shown.
55 changes: 46 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 기능

- [x] 사이트 맵 xml (Using by @astrojs/sitemap)
- [x] 이미지 자동 최적화 (Using by [astro-imagetools](https://github.com/RafidMuhymin/astro-imagetools))
- [x] 게시글 태그
- [x] 게시글 검색
- [x] 조회수 (Using by [CountAPI](https://countapi.xyz/))
Expand All @@ -11,20 +13,55 @@
- [x] 가변 테마(자동/시스템)
- [x] 모바일 디바이스 스타일링

### 검토중인 기능

- [ ] [astro-imagetools](https://github.com/RafidMuhymin/astro-imagetools)[@astrojs/image](https://github.com/withastro/astro/tree/main/packages/integrations/image) 로 변경
- [ ] rss 제공

## 사용법

이 저장소는 `yarn berry`를 사용합니다. 따라서 실행 전에 `npm install -g yarn` 명령어를 사용하여 `yarn`을 사용할 수 있도록 준비합니다.
1. `yarn` 패키지 매니저 설치
이 저장소는 `yarn berry`를 사용합니다. 따라서 실행 전에 `npm install -g yarn` 명령어를 사용하여 `yarn`을 사용할 수 있도록 준비합니다.

| 명령어 | 동작 |
| :----------- | :--------------------------------------------------------------------- |
| yarn install | Install dependencies. |
| yarn dev | Runs Astro’s dev server. server |
| yarn build | Builds your site for production. |
| yarn preview | Starts a local static file server to serve your built dist/ directory. |

더 자세한 사용법은 [Astro 공식 문서](https://docs.astro.build/en/reference/cli-reference/#astro-preview)를 참조합니다.

2. 블로그 폴더 생성
```sh
mkdir your-name.github.io
cd your-name.github.io
```
`your-name.github.io` 폴더를 생성한 후 이동하니다.
3. git 서브모듈로 레포지토리 가져오기

```sh
git submodule add https://github.com/yunu7067/astro-blog ./astro-blog
```

astro-blog라는서브모듈로 이 레포지토리를 가져옵니다

4. 내용물 프로젝트 폴더 루트로 복사
```sh
cp -rf ./astro-blog/* ./
```
서브모듈의 astro-blog 내용물을 프로젝트 폴더의 최상단에 복사합니다.

### astro-blog 업데이트

| 명령어 | 동작 |
| :----------- | :--------------------------------------------------------------------- |
| yarn install | Install dependencies. |
| yarn dev | Runs Astro’s dev server. server |
| yarn build | Builds your site for production. |
| yarn preview | Starts a local static file server to serve your built dist/ directory. |
```sh
cd ./astro-blog
git pull
```

더 자세한 사용법은 [Astro 공식 문서](https://docs.astro.build/en/reference/cli-reference/#astro-preview)를 참조합니다.
서브모듈 폴더로 들어가 `git pull` 명령어를 이용해 최신 커밋을 받아옵니다. 그리고 `./src/pages``./blog.config.js`파일 (그리고 그 이외에 개인이 수정한 파일들)을 제외한 나머지 파일을 프로젝트 폴더의 최상단에 덮어쓰기해줍니다.

## 게시글 작성
### 게시글 작성

새로운 게시글은 `/src/pages/p/``./[slug].md` 혹은 `./[slug]/index.md` 파일명으로 작성한 후 서버를 재시작시켜줍니다.

Expand Down
11 changes: 3 additions & 8 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,18 @@ import {defineConfig} from 'astro/config';
import {astroImageTools} from 'astro-imagetools';
import solid from '@astrojs/solid-js';
import tailwind from '@astrojs/tailwind';
// import sitemap from '@astrojs/sitemap';
import sitemap from '@astrojs/sitemap';

// https://astro.build/config
export default defineConfig({
vite: {},
// site: 'https://yunu7067.github.io', // sitemap
site: 'https://yunu7067.github.io', // sitemap
markdown: {
syntaxHighlight: 'shiki',
},
experimental: {
ssr: false,
integrations: true,
},
integrations: [
solid(),
tailwind(),
// sitemap(),
astroImageTools,
],
integrations: [solid(), tailwind(), sitemap(), astroImageTools],
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@astropub/webapi": "^0.10.14",
"@tailwindcss/line-clamp": "^0.4.0",
"@types/flexsearch": "^0.7.3",
"astro": "^1.0.0-beta.62",
"astro": "^1.0.0-beta.63",
"astro-imagetools": "^0.6.10",
"flexsearch": "^0.7.21",
"node-html-parser": "^5.3.3",
Expand Down
16 changes: 9 additions & 7 deletions src/components/BlogToc.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ export interface Props {
const { contents } = Astro.props as Props;
---

<div class="bg-gray-200 dark:bg-gray-700 rounded-sm py-7 px-10 mb-8" aria-label="Table of Contents">
<div class="text-xl mb-2.5 font-bold">목차</div>
{ contents.map((el)=> (
<div class={`toc text-gray-800 dark:text-gray-300 mb-1.5 ${el.tagName.replace(`H`, `depth` )}`}>
<a href={`#${el.id}`}>{el.textContent}</a>
<details class="bg-gray-200 dark:bg-gray-700 rounded-sm py-7 px-10 mb-8" aria-label="Table of Contents" open>
<summary class="text-xl font-bold">목차</summary>
<div class="mt-2.5">
{ contents.map((el)=> (
<div class={`toc text-gray-800 dark:text-gray-300 mb-1.5 ${el.tagName.replace(`H`, `depth` )}`}>
<a href={`#${el.id}`}>{el.textContent}</a>
</div>
)) }
</div>
)) }
</div>
</details>

<style>
.toc.depth1 {}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default function Search({keys}: {keys: string[]}) {
<div>
{searchResult() &&
searchResult().map(({id, doc}) => (
<div class='p-8 border rounded-md mb-2x dark:border-gray-600'>
<div class='p-8 border rounded-md mb-2 dark:border-gray-600'>
<a href={id as unknown as string}>
<h1 class='mb-1.5 text-2xl font-bold hover:underline hover:underline-offset-1'>{doc.title}</h1>
</a>
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ __metadata:
"@astropub/webapi": ^0.10.14
"@tailwindcss/line-clamp": ^0.4.0
"@types/flexsearch": ^0.7.3
astro: ^1.0.0-beta.62
astro: ^1.0.0-beta.63
astro-imagetools: ^0.6.10
flexsearch: ^0.7.21
node-html-parser: ^5.3.3
Expand Down Expand Up @@ -1482,9 +1482,9 @@ __metadata:
languageName: node
linkType: hard

"astro@npm:^1.0.0-beta.62":
version: 1.0.0-beta.62
resolution: "astro@npm:1.0.0-beta.62"
"astro@npm:^1.0.0-beta.63":
version: 1.0.0-beta.63
resolution: "astro@npm:1.0.0-beta.63"
dependencies:
"@astrojs/compiler": ^0.17.1
"@astrojs/language-server": ^0.13.4
Expand Down Expand Up @@ -1543,7 +1543,7 @@ __metadata:
zod: ^3.17.3
bin:
astro: astro.js
checksum: db2c562e1b08163aad33b547f5adf8456778708e182770233b482191dacf5427c809f127703289b21b8b9e6d0dea2afb86d6250f0dfd646651a61566f097c4da
checksum: 4db4f64f3a636a6a64c829526be82aeae004e06261e18a84e0a17b849659635b29b1476d2e9ccfe4eca2a91a55d7faa57c56fb9a91bb17d80e07a32e1b663882
languageName: node
linkType: hard

Expand Down

0 comments on commit e8161ae

Please sign in to comment.