Initial commit for Hugo site.
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
---
|
||||
title: "What's New in 2.0 ✨"
|
||||
date: 2022-01-19
|
||||
draft: false
|
||||
description: "Congo 2.0の新機能について"
|
||||
summary: "Version 2.0では、Congoを新たな高みへと導き、その軽量さを維持しながらも、テーマをさらに強力なものにしています。"
|
||||
tags: ["new", "docs"]
|
||||
---
|
||||
|
||||
{{< lead >}}
|
||||
Congo 2.0には、大量の新機能と最適化が詰め込まれています。
|
||||
{{< /lead >}}
|
||||
|
||||
Congoの当初の目的は、シンプルで軽量なテーマを開発することでした。Version 2では、これをさらに一歩進め、軽量でありながら、よりパワフルなテーマとなっています。
|
||||
|
||||
新機能については以下をご覧ください。アップグレードの準備ができましたら、[アップグレードガイド]({{< ref "upgrade" >}})をご覧ください。
|
||||
|
||||
## Tailwind CSS 3.0
|
||||
|
||||
Tailwind CSSはCongoの中核であり、この新しいリリースには最新の[Tailwind CSS version 3](https://tailwindcss.com/blog/tailwindcss-v3)が含まれています。Tailwind CSS 3.0では、パフォーマンスが最適化され、新しいCSS機能がサポートされています。
|
||||
|
||||
{{< youtube "TmWIrBPE6Bc" >}}
|
||||
|
||||
この新バージョンを実装することで、テーマからTailwindプラグインの依存関係をいくつか削除し、全体的なフットプリントを軽量に保つことができるようになりました。
|
||||
|
||||
## 多言語対応
|
||||
|
||||
要望の多かった多言語対応を行いました!複数の言語でコンテンツを公開する場合、サイトはすべての翻訳が利用可能な状態で構築されます。
|
||||
|
||||
<div class="text-2xl text-center" style="font-size: 2.8rem">:gb: :de: :fr: :es: :cn: :jp: :brazil: :tr: :bangladesh:</div>
|
||||
|
||||
コミュニティの貢献によって、Congoはすでに[23言語](https://github.com/jpanther/congo/tree/dev/i18n)以上に翻訳されています。新しい翻訳も[Pull Request](https://github.com/jpanther/congo/pulls)からいつでも歓迎しています!
|
||||
|
||||
## Right to Left言語のサポート
|
||||
|
||||
新しいTailwindの利点の一つは、RTL言語サポートを追加する機能です。有効にすると、サイト全体のコンテンツが右から左にリフローされます。テーマ内のすべての要素は、RTL言語でも見栄えが良くなるように再構築されています。
|
||||
|
||||
RTLは言語ごとに制御されるため、プロジェクト内でRTLとLTRの両方のコンテンツを混ぜてマッチさせることができ、テーマはそれに応じて対応します。
|
||||
|
||||
## 画像の自動リサイズ
|
||||
|
||||
Congo 2.0の大きな変更点は、画像の自動リサイズ機能の追加です。Hugo Pipesのパワーを使って、Markdownコンテンツ内の画像が自動的に異なる出力サイズに拡大縮小されるようになりました。これらの画像はHTMLの `srcset` 属性を使って表示され、サイト訪問者に最適化されたファイルサイズを提供することができます。
|
||||
|
||||

|
||||
|
||||
```html
|
||||
<!-- Markdown:  -->
|
||||
<img
|
||||
srcset="
|
||||
/image_320x0_resize_q75_box.jpg 320w,
|
||||
/image_635x0_resize_q75_box.jpg 635w,
|
||||
/image_1024x0_resize_q75_box.jpg 1024w,
|
||||
/image_1270x0_resize_q75_box.jpg 2x"
|
||||
src="/image_635x0_resize_q75_box.jpg"
|
||||
alt="My image"
|
||||
/>
|
||||
```
|
||||
|
||||
あなたは何も変更する必要がありません!標準的なMarkdown画像構文を挿入するだけで、あとはテーマにお任せください。もう少しコントロールしたい場合は、 `figure` ショートコードを完全に書き換えて、同じリサイズの利点を提供します。
|
||||
|
||||
## パフォーマンスの改善
|
||||
|
||||
今回のアップデートでは、全体的にパフォーマンスが向上している。今回のリリースの主な目的はLighthouseのスコアを向上させることで、Congoは4つの指標すべてで100点満点を獲得しました。
|
||||
|
||||
{{< screenshot src="lighthouse.jpg" >}}
|
||||
|
||||
個々の変更点が多すぎて、ここでは紹介しきれませんが、さらに詳しく知りたい場合は、[Lighthouseのレポート](lighthouse.html)をご覧ください。実際のパフォーマンスは、サーバーの構成によって異なります。
|
||||
|
||||
## サイト内検索
|
||||
|
||||
[Fuse.js](https://fusejs.io)を利用したサイト内検索で、訪問者が素早く簡単にコンテンツを見つけることができます。すべての検索はクライアントサイドで実行されるため、サーバー上で設定する必要がなく、クエリは超高速で実行されます。サイト設定でこの機能を有効にするだけで準備は完了です。また、フルキーボードナビゲーションにも対応しています!
|
||||
|
||||
## 記事ページ内の目次
|
||||
|
||||
要望の多かった記事ページ内の目次をサポートしました。このページで実際にご覧いただけます。コンテンツは完全にレスポンシブで、異なる画面解像度で利用可能なスペースを活用するように調整されます。
|
||||
|
||||
グローバルまたは記事単位で利用可能な目次は、Hugoの標準設定値を使用して完全にカスタマイズすることができます。
|
||||
|
||||
## アクセシビリティの改善
|
||||
|
||||
より多くの項目にARIA記述を追加し、特定のテキスト要素のコントラストを調整してアクセシビリティを改善しました。
|
||||
|
||||
Congo 2.0では、クイックナビゲーションを可能にする「コンテンツへスキップ」と「トップへスクロール」リンクも導入されています。また、マウスに手を伸ばすことなく検索などの項目を有効にするためのキーボードショートカットもあります。
|
||||
|
||||
新しい画像サイズ変更機能は、 `alt` と `title` 要素の完全なコントロールを提供し、すべての訪問者にアクセシブルな体験を提供します。
|
||||
|
||||
## その他もろもろ
|
||||
|
||||
他にも数え切れないほどの細かな変更があります。記事やリストページでTaxonomyを表示できるようになったり、新しい `headline` の著者パラメーターを使ってホームページをカスタマイズできるようになったり。また、SEOのパフォーマンスをさらに最適化するJSON-LDも改善されています。さらに、一貫したデザイン言語を保証するために、テーマ全体がさらに洗練されました。
|
||||
|
||||
:rocket: 詳細は[full changelog](https://github.com/jpanther/congo/blob/dev/CHANGELOG.md)をご覧ください。
|
||||
|
||||
## Next steps
|
||||
|
||||
準備ができたら[Version 1.xからのアップグレードガイド]({{< ref "upgrade" >}})をお読みください。Congoを初めてお使いになる方は[インストール]({{< ref "docs/installation" >}})に進んでください。
|
||||
|
||||
---
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
title: "What's New in 2.0 ✨"
|
||||
date: 2022-01-19
|
||||
draft: false
|
||||
description: "Discover what's new in Congo version 2.0."
|
||||
summary: "Version 2 takes Congo to new heights, making the theme even more powerful while still maintaining its lightweight footprint."
|
||||
tags: ["new", "docs"]
|
||||
---
|
||||
|
||||
{{< lead >}}
|
||||
Congo 2.0 is packed with tons of new features and optimisations.
|
||||
{{< /lead >}}
|
||||
|
||||
The original aim of Congo was to develop a theme that was simple and lightweight. Version 2 takes this one step further and makes the theme even more powerful while still maintaining its lightweight footprint.
|
||||
|
||||
Continue reading below to discover what's new. When you're ready to upgrade, check out the [guide to upgrading]({{< ref "upgrade" >}}).
|
||||
|
||||
## Tailwind CSS 3.0
|
||||
|
||||
Tailwind CSS is at the heart of Congo and this new release contains the very latest [Tailwind CSS version 3](https://tailwindcss.com/blog/tailwindcss-v3). It brings with it performance optimisations and support for some great new CSS features.
|
||||
|
||||
{{< youtube "TmWIrBPE6Bc" >}}
|
||||
|
||||
Implementing this new version has also removed some Tailwind plugin dependencies from the theme, allowing the overall footprint to remain lightweight.
|
||||
|
||||
## Multilingual support
|
||||
|
||||
A highly requested feature, Congo is now multilingual! If you publish your content in multiple languages, the site will be built with all the translations available.
|
||||
|
||||
<div class="text-2xl text-center" style="font-size: 2.8rem">:gb: :de: :fr: :es: :cn: :brazil: :tr: :bangladesh:</div>
|
||||
|
||||
Thanks to submissions from the community, Congo has already been translated into [23 languages](https://github.com/jpanther/congo/tree/dev/i18n) with more to be added over time. By the way, [pull requests](https://github.com/jpanther/congo/pulls) for new languages are always welcome!
|
||||
|
||||
## RTL language support
|
||||
|
||||
One of the benefits of the new Tailwind and Multilingual features is the ability to add RTL language support. When enabled, the entire site will reflow content from right-to-left. Every element in the theme has been restyled to ensure it looks great in this mode which aids authors who wish to generate content in RTL languages.
|
||||
|
||||
RTL is controlled on a per-language basis so you can mix and match both RTL and LTR content in your projects and the theme will respond accordingly.
|
||||
|
||||
## Automatic image resizing
|
||||
|
||||
A big change in Congo 2.0 is the addition of automatic image resizing. Using the power of Hugo Pipes, images in Markdown content are now automatically scaled to different output sizes. These are then presented using HTML `srcset` attributes enabling optimised file sizes to be served to your site visitors.
|
||||
|
||||

|
||||
|
||||
```html
|
||||
<!-- Markdown:  -->
|
||||
<img
|
||||
srcset="
|
||||
/image_320x0_resize_q75_box.jpg 320w,
|
||||
/image_635x0_resize_q75_box.jpg 635w,
|
||||
/image_1024x0_resize_q75_box.jpg 1024w,
|
||||
/image_1270x0_resize_q75_box.jpg 2x"
|
||||
src="/image_635x0_resize_q75_box.jpg"
|
||||
alt="My image"
|
||||
/>
|
||||
```
|
||||
|
||||
Best of all there's nothing you need to change! Simply insert standard Markdown image syntax and let the theme do the rest. If you want a little more control, the `figure` shortcode has been completely rewritten to provide the same resizing benefits.
|
||||
|
||||
## Performance improvements
|
||||
|
||||
This update packs performance improvements throughout. A key objective for this release was to improve Lighthouse scores and Congo now scores a perfect 100 on all four metrics.
|
||||
|
||||
{{< screenshot src="lighthouse.jpg" >}}
|
||||
|
||||
There's too many individual changes to highlight them here but the results speak for themselves. If you want to dig deeper, you can [view the Lighthouse report](lighthouse.html). Real world performance will vary based upon server configuration.
|
||||
|
||||
## Site search
|
||||
|
||||
Powered by [Fuse.js](https://fusejs.io), site search allows visitors to quickly and easily find your content. All searches are performed client-side meaning there's nothing to configure on the server and queries are performed super fast. Simply enable the feature in your site configuration and you're all set. Oh, and it also supports full keyboard navigation!
|
||||
|
||||
## Tables of contents
|
||||
|
||||
A highly requested feature, Congo now supports tables of contents on article pages. You can see it in action on this page. The contents are fully responsive and will adjust to take advantage of the space available at different screen resolutions.
|
||||
|
||||
Available on a global or per article basis, the table of contents can be fully customised using standard Hugo configuration values, allowing you to adjust the behaviour to suit your project.
|
||||
|
||||
## Accessibility improvements
|
||||
|
||||
From adding ARIA descriptions to more items or simply adjusting the contrast of certain text elements, this release is the most accessible yet.
|
||||
|
||||
Version 2 also introduces "skip to content" and "scroll to top" links that enable quick navigation. There's also keyboard shortcuts for enabling items like search without reaching for the mouse.
|
||||
|
||||
The new image resizing features also provide full control over `alt` and `title` elements enabling an accessible experience for all visitors.
|
||||
|
||||
## A whole lot more
|
||||
|
||||
There's countless other minor changes to explore. From being able to display taxonomies on articles and list pages, to using the new `headline` author parameter to customise your homepage. There's also improved JSON-LD strucured data which further optimises SEO performance. Plus the entire theme has had extra polish to ensure a consistent design language.
|
||||
|
||||
:rocket: Check out the [full changelog](https://github.com/jpanther/congo/blob/dev/CHANGELOG.md) to learn more.
|
||||
|
||||
## Next steps
|
||||
|
||||
If you're ready to upgrade, read the [upgrading from version 1 guide]({{< ref "upgrade" >}}) to get started. If you're new to Congo, check out the [Installation guide]({{< ref "docs/installation" >}}) to begin a new project.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
title: "2.0版本新特性 ✨"
|
||||
date: 2022-01-19
|
||||
draft: false
|
||||
description: "探索Congo 2.0的新功能"
|
||||
summary: "2.0版本将Congo推向新的高度,使主题变得更加强大,同时仍然保持其轻量的特点。"
|
||||
tags: ["new", "docs"]
|
||||
---
|
||||
|
||||
{{< lead >}}
|
||||
Congo 2.0版本中包含了大量的新功能和优化。
|
||||
{{< /lead >}}
|
||||
|
||||
Congo最初的目标是开发一个简单轻量的主题。第2版更进一步,使主题变得更加强大,同时仍然保持其轻量级的特点。
|
||||
|
||||
继续阅读下面的内容,了解新的特性。当您准备升级时,请查看 [升级指南]({{< ref "upgrade" >}})。
|
||||
|
||||
## Tailwind CSS 3.0
|
||||
|
||||
Tailwind CSS是Congo的核心,这个新版本包含最新的 [Tailwind CSS 版本 3](https://tailwindcss.com/blog/tailwindcss-v3)。它带来了性能优化和对一些出色的新CSS功能的支持。
|
||||
|
||||
{{< youtube "TmWIrBPE6Bc" >}}
|
||||
|
||||
实现这个新版本还删除了主题中的一些Tailwind插件依赖,使整体体积保持轻量。
|
||||
|
||||
## 国际化支持
|
||||
|
||||
一个备受期待的功能,Congo现在支持多语言了!如果您发布内容支持多种语言,网站将构建包含所有可用翻译的版本。
|
||||
|
||||
<div class="text-2xl text-center" style="font-size: 2.8rem">:gb: :de: :fr: :es: :cn: :jp: :brazil: :tr: :bangladesh:</div>
|
||||
|
||||
通过社区的贡献,Congo已经被翻译成[23种语言](https://github.com/jpanther/congo/tree/dev/i18n)以上。欢迎随时通过[Pull Request](https://github.com/jpanther/congo/pulls)提交新的翻译!
|
||||
|
||||
## RTL语言支持
|
||||
|
||||
新的Tailwind和多语言功能的一个好处是能够添加RTL(从右到左)语言支持。启用时,整个站点的内容都将从右到左重新排列。主题中的每个元素都经过重新设计,以确保在此模式下看起来很棒,有助于希望使用RTL语言生成内容的作者。
|
||||
|
||||
RTL是基于每种语言的控制,因此您可以在项目中混合和匹配RTL和LTR内容,主题将相应地进行响应。
|
||||
|
||||
## 自动图像调整大小
|
||||
|
||||
Congo 2.0的一个重大变化是添加了自动图像调整大小的功能。利用Hugo Pipes的强大功能,Markdown内容中的图像现在会自动缩放到不同的输出大小。然后使用HTML的 `srcset` 属性来呈现,从而能够为您的站点访问者提供优化过的文件大小。
|
||||
|
||||

|
||||
|
||||
```html
|
||||
<!-- Markdown:  -->
|
||||
<img
|
||||
srcset="
|
||||
/image_320x0_resize_q75_box.jpg 320w,
|
||||
/image_635x0_resize_q75_box.jpg 635w,
|
||||
/image_1024x0_resize_q75_box.jpg 1024w,
|
||||
/image_1270x0_resize_q75_box.jpg 2x"
|
||||
src="/image_635x0_resize_q75_box.jpg"
|
||||
alt="My image"
|
||||
/>
|
||||
```
|
||||
|
||||
最重要的是,您无需进行任何更改!只需插入标准的Markdown图像语法,让主题来处理其余的事情。如果您想要更多控制,`figure` shortcode已经完全重写,以提供相同的调整大小优势。
|
||||
|
||||
## 性能优化
|
||||
|
||||
此更新在整个主题中进行了性能优化。这个版本的一个关键目标是提高Lighthouse分数,而现在Congo在所有四个指标上都得分完美的100。
|
||||
|
||||
{{< screenshot src="lighthouse.jpg" >}}
|
||||
|
||||
有太多单独的更改,无法在这里一一突出显示,但结果不言而喻。如果您想深入了解,可以[查看Lighthouse报告](lighthouse.html)。实际的性能将根据服务器配置而有所不同。
|
||||
|
||||
## 站内搜索
|
||||
|
||||
该功能由 [Fuse.js](https://fusejs.io) 提供支持,站内搜索允许访问者快速轻松地找到您的内容。所有搜索都在客户端执行,这意味着在服务器上无需进行任何配置,查询速度非常快。只需在站点配置中启用此功能,就可以轻松使用。对了,它还支持完整的键盘导航!
|
||||
|
||||
## 目录
|
||||
|
||||
这是一个备受期待的功能,Congo现在支持在文章页面上显示目录。您可以在此页面上看到它的效果。目录是完全响应式的,将根据不同屏幕分辨率的可用空间进行调整。
|
||||
|
||||
可以在全局或每篇文章的基础上使用,目录可以使用标准的Hugo配置值进行全面定制,从而使您能够调整其行为以适应您的项目。
|
||||
|
||||
## 可访问性改进
|
||||
|
||||
从为更多项目添加ARIA描述到可以调整某些文本元素的对比度,此版本是迄今为止最具可访问性的。
|
||||
|
||||
第2版还引入了"跳转到内容"和"返回顶部"的链接,以实现快速导航。还有用于启用诸如搜索之类的项目的键盘快捷键,无需使用鼠标。
|
||||
|
||||
新的图像调整大小功能还提供对`alt`和`title`元素的完全控制,为所有访问者提供了可访问的体验。
|
||||
|
||||
## 还有很多改进
|
||||
|
||||
还有无数其他的小改变值得探索。从能够在文章和列表页面上显示分类法,到使用新的`headline`作者参数自定义您的主页。还有改进的JSON-LD结构化数据,进一步优化了SEO性能。此外,整个主题都经过了额外的润色,以确保一致的设计语言。
|
||||
|
||||
:rocket: 查看[完整的更改日志](https://github.com/jpanther/congo/blob/dev/CHANGELOG.md)以了解更多信息。
|
||||
|
||||
## 下一步
|
||||
|
||||
如果您准备升级,请阅读 [从版本1升级的指南]({{< ref "upgrade" >}}) 开始。如果您是Congo的新用户,请查看 [安装指南]({{< ref "docs/installation" >}}) 开始一个新项目。
|
||||
|
||||
---
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 247 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,198 @@
|
||||
---
|
||||
title: "Congo 1.xからのアップグレード"
|
||||
date: 2022-01-20
|
||||
draft: false
|
||||
description: "Congo 1.xからのアップグレード"
|
||||
tags: ["new", "docs"]
|
||||
---
|
||||
|
||||
Congo 2.0には多くの変更点が含まれていますが、最新リリースへのアップグレードに必要な労力を最小限に抑えるように設計されています。
|
||||
|
||||
とはいえ、Version 1.xで構築された既存のサイトには、調整が必要な場合もあります。このガイドでは、そのプロセスを順を追って説明し、考慮すべき点を説明します。
|
||||
|
||||
## Step 1: Hugoのアップグレード
|
||||
|
||||
{{< alert >}}
|
||||
Congo 2.0は**Hugo v0.87.0以上**が必要です。
|
||||
{{< /alert >}}
|
||||
|
||||
Congoは、Hugoの最新機能のいくつかを利用するように作られています。問題を避けるために、定期的にHugoのインストールを最新の状態に保つ必要があります。
|
||||
|
||||
Hugoのバージョンは `hugo version` コマンドで確認できます。あなたのプラットフォーム用の新しいリリースを入手する方法については、[Hugoのドキュメント](https://gohugo.io/getting-started/installing/)をご覧ください。
|
||||
|
||||
## Step 2: Congoのアップグレード
|
||||
|
||||
Congoをアップグレードする手順は、プロジェクトにどのようにテーマを含めるかによって異なります。各手順は以下にあります。
|
||||
|
||||
- [Upgrade using Hugo](#upgrade-using-hugo)
|
||||
- [Upgrade using Git](#upgrade-using-git)
|
||||
- [Upgrade manually](#upgrade-manually)
|
||||
|
||||
### Upgrade using Hugo
|
||||
|
||||
Goモジュールを新しいメジャーリリースにアップグレードするには、 `modules.toml` と `go.mod` ファイルを更新する必要があります。それぞれのファイルで、テーマへのパスを `github.com/jpanther/congo` から `github.com/jpanther/congo/v2` に更新してください。
|
||||
|
||||
そして、プロジェクト・ディレクトリに移動し、以下のコマンドを実行してください。
|
||||
|
||||
```shell
|
||||
hugo mod get -u
|
||||
```
|
||||
|
||||
Hugo がローカルにモジュールをキャッシュしているため、状況によってはこのステップで問題が発生する場合があることに注意してください。上記のコマンドがうまくいかない場合は、 `hugo mod clean` を使ってローカルキャッシュを消去し、モジュールを再ダウンロードしてみてください。
|
||||
|
||||
Congoがアップグレードされたら、次のステップに進みます。
|
||||
|
||||
### Upgrade using Git
|
||||
|
||||
Git サブモジュールは `git` コマンドを使ってアップグレードできます。次のコマンドを実行するだけで、最新バージョンのテーマがローカルリポジトリにダウンロードされます:
|
||||
|
||||
```shell
|
||||
git submodule update --remote --merge
|
||||
```
|
||||
|
||||
サブモジュールがアップデートされたら、次のステップに進みます。
|
||||
|
||||
### Upgrade manually
|
||||
|
||||
Congoを手動で更新するには、テーマの最新コピーをダウンロードして、プロジェクト内の古いバージョンを置き換える必要があります。
|
||||
|
||||
{{< alert >}}
|
||||
テーマファイルに対して行ったローカルでのカスタマイズは、この処理中に失われますのでご注意ください。
|
||||
{{< /alert >}}
|
||||
|
||||
1. テーマのソースコードの最新リリースをダウンロードする。
|
||||
|
||||
{{< button href="https://github.com/jpanther/congo/releases/latest" target="_blank" >}}Download from Github{{< /button >}}
|
||||
|
||||
2. アーカイブを解凍し、ディレクトリ名を `congo` に変更して、Hugoプロジェクトのルートディレクトリ内の `themes/` ディレクトリに移動します。すべてのテーマファイルを置き換えるには、既存のディレクトリを上書きする必要があります。
|
||||
|
||||
3. 次のステップに進んでください。
|
||||
|
||||
## Step 3: テーマの設定
|
||||
|
||||
Congo 2.0では新しいテーマ設定パラメーターが多数導入されています。このテーマは既存のバージョン1の設定に適応しますが、より新しいテーマ機能のいくつかを利用するためには、既存の設定を調整する必要があります。
|
||||
|
||||
これを行う最も簡単な方法は、テーマのデフォルト設定のコピーを取り、既存のファイルと比較することです。以下にその手順を詳しく説明します。
|
||||
|
||||
### languages.toml
|
||||
|
||||
多言語サポートを提供するために、言語固有のテーマパラメーターは新しい設定ファイル `languages.[lang-code].toml` に移動されました。テーマにはテンプレート `languages.en.toml` ファイルが付属しており、ガイドとして使用することができます。
|
||||
|
||||
{{< alert >}}
|
||||
多言語サポートが必要ない場合は、このステップは必要ありません。
|
||||
{{< /alert >}}
|
||||
|
||||
言語設定ファイルはこのような構造になっています:
|
||||
|
||||
```toml
|
||||
# config/_default/languagues.en.toml
|
||||
|
||||
languageCode = "en"
|
||||
languageName = "English"
|
||||
displayName = "EN"
|
||||
htmlCode = "en"
|
||||
weight = 1
|
||||
rtl = false
|
||||
|
||||
# Language-specific parameters go here
|
||||
```
|
||||
|
||||
お好みの言語を使って、 `config/_default/` に新しいファイルを作成し、既存の設定ファイルから言語固有のパラメーターをこの新しいファイルに移動するだけです。下の表は移動させる必要のあるパラメーターの概要です。
|
||||
|
||||
| Parameter | Old location |
|
||||
| ------------- | ------------- |
|
||||
| `title` | `config.toml` |
|
||||
| `description` | `params.toml` |
|
||||
| `copyright` | `config.toml` |
|
||||
| `dateFormat` | `params.toml` |
|
||||
| `[author]` | `config.toml` |
|
||||
|
||||
値を移行したら、これらのパラメーターは元の場所から削除すべきです。
|
||||
|
||||
### menus.toml
|
||||
|
||||
テーマが言語を認識するようになったので、 `menus.toml` ファイルの名前も言語コードを含むように変更する必要があります。既存の `menus.toml` を `menus.[lang-code].toml` にリネームしてください。言語コードは前のセクションの `languages.toml` ファイルで使用したコードと同じです。
|
||||
|
||||
### config.toml
|
||||
|
||||
config.toml`ファイルには、Hugoの基本設定値のみが含まれるようになりました。上記の言語固有の文字列を削除した以外に、考慮すべき変更は2つだけです。
|
||||
|
||||
英語以外の言語を使用している場合は、その言語用に作成した設定ファイルの言語コードと一致する `defaultContentLanguage` 値を指定してください。次に、Congo 2.0の新しいサイト内検索を利用するために、 `[outputs]` ブロックを用意する必要があります。
|
||||
|
||||
```toml
|
||||
# config/_default/config.toml
|
||||
|
||||
defaultContentLanguage = "en"
|
||||
|
||||
enableRobotsTXT = true
|
||||
paginate = 10
|
||||
summaryLength = 0
|
||||
|
||||
[outputs]
|
||||
home = ["HTML", "RSS", "JSON"]
|
||||
```
|
||||
|
||||
### markup.toml
|
||||
|
||||
Congo 2.0では記事ページの目次がサポートされました。Hugoには目次を生成するためのデフォルト設定が同梱されていますが、 `markup.toml` ファイルに新しい `[tableOfContents]` ブロックを追加することで、この動作を調整することができます。
|
||||
|
||||
推奨設定は以下のとおりで、目次にレベル2、3、4のの見出しを含みます:
|
||||
|
||||
```toml
|
||||
# config/_default/markup.toml
|
||||
|
||||
[tableOfContents]
|
||||
startLevel = 2
|
||||
endLevel = 4
|
||||
```
|
||||
|
||||
### params.toml
|
||||
|
||||
Congo 2.0では多くの新しいテーマ・パラメーターが導入されました。既存の設定にも若干の変更が必要です。パラメーターが提供されない場合、常にデフォルト値に戻ることを覚えておいてください。
|
||||
|
||||
Congoでのダークモードの動作方法が変更され、より柔軟に設定できるようになりました。従来の `darkMode` と `darkToggle` パラメーターは **削除され、3つの新しいパラメーターに置き換えられました**。これらの新しいオプションはそれぞれ独立して動作するため、強制的に表示させることができ、またユーザーが上書きすることもできます。
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
| New parameter | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `defaultAppearance` | String | `"light"` | デフォルトの外観; `light` か `dark` のどちらか。<br>:warning: _`light` に設定すると以前の `darkMode = false` の設定が再現され、 `dark` に設定すると `darkMode = true` の設定が再現される。_ |
|
||||
| `autoSwitchAppearance` | Boolean | `true` | 外観をオペレーティングシステムの環境設定に基づいて自動的に切り替えるかどうか。 `false` に設定すると、常に `defaultAppearance` を使用します。 <br>:warning: _これを `true` にすることで以前の `darkMode = "auto"` 設定が再現されます。_ |
|
||||
| `showAppearanceSwitcher` | Boolean | `false` | 外観スイッチャーをフッターに表示するかどうか。 <br>:warning: _この設定は `darkToggle` を置き換えます。_ |
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
次の表は、Version 2の新機能を制御する、その他の主要なパラメーターの概要です:
|
||||
|
||||
| New parameter | Type | Default |
|
||||
| ----------------------------- | ------- | ------- |
|
||||
| `enableSearch` | Boolean | `false` |
|
||||
| `showScrollToTop` | Boolean | `true` |
|
||||
| `article.showTaxonomies` | Boolean | `false` |
|
||||
| `article.showTableOfContents` | Boolean | `false` |
|
||||
| `list.showTableOfContents` | Boolean | `false` |
|
||||
|
||||
サポートされるすべてのパラメーターについては[設定]({{< ref "docs/configuration" >}})を参照ください。
|
||||
|
||||
## Step 4: assetsの移動
|
||||
|
||||
ファビコンを除くすべてのassetsが、Hugo Pipesにて最適化されるようになりました。テーマがあなたのファイルを見つけるためには、以前の `static/` から `assets/` ディレクトリに移動する必要があります。主に、著者画像とサイトロゴです:
|
||||
|
||||
`static/me.jpg` **→** `assets/me.jpg`
|
||||
`static/logo.jpg` **→** `assets/logo.jpg`
|
||||
|
||||
著者画像やサイトロゴを提供した場合は、これらのアセットを `static/` から `assets/` に移動するだけです。同じディレクトリ構造を使用している場合、テーマはこれらのファイルがどこにあるかを自動的に認識します。新しいパスを指定したい場合は、 `logo` と `author.image` の設定値を適宜更新してください。
|
||||
|
||||
このステップは、プロジェクト内の静的なassetsには適用されないことに注意してください。例えば、記事内から直接リンクしているPDFファイルは静的なassetsです。これらのファイルは、Hugoがサイトを構築するときに出力ディレクトリに確実にコピーされるよう、`static/` ディレクトリに残しておく必要があります。
|
||||
|
||||
## Step 5: コンテンツの確認
|
||||
|
||||
Congo 2.0では `figure` ショートコードの振る舞いが変わります。記事内で `figure` を使用している場合、パラメーターを調整する必要があるかもしれません。
|
||||
|
||||
サポートされているパラメーターについては、[shortcode]({{< ref "docs/shortcodes#figure" >}})を参照してください。
|
||||
|
||||
## Step 6: 再構築
|
||||
|
||||
これですべての設定変更が完了したので、いよいよサイトを再構築します。 `hugo` またはあなたのビルドコマンドを実行し、すべてが期待通りに動作することを確認してください。
|
||||
|
||||
エラーに遭遇した場合は、設定が正しいことを確認し、[ドキュメント]({{<ref "docs" >}})を参照してください。テーマに同梱されている設定ファイルの例には、デフォルトのパラメーターがすべて含まれており、出発点として最適です。
|
||||
|
||||
🙋♀️ それでもまだ助けが必要な場合は、[GitHub Discussions](https://github.com/jpanther/congo/discussions)で遠慮なく質問してください。
|
||||
@@ -0,0 +1,198 @@
|
||||
---
|
||||
title: "Upgrading from Congo 1.x"
|
||||
date: 2022-01-20
|
||||
draft: false
|
||||
description: "Discover what's new in Congo version 2.0."
|
||||
tags: ["new", "docs"]
|
||||
---
|
||||
|
||||
Although Congo 2.0 contains a large number of changes, the theme has been designed to minimise the effort required to upgrade to the latest release.
|
||||
|
||||
That said, there are some changes that require adjustments to existing sites that are built with Congo version 1.x. This guide will step you through the process and highlight things you need to consider.
|
||||
|
||||
## Step 1: Upgrade Hugo
|
||||
|
||||
{{< alert >}}
|
||||
Congo 2.0 requires a minimum of **Hugo v0.87.0 or later**
|
||||
{{< /alert >}}
|
||||
|
||||
Congo is built to take advantage of some of the latest Hugo features. You should regularly keep your Hugo installation up to date to avoid any issues.
|
||||
|
||||
You can check your current version using the command `hugo version`. Visit the [Hugo docs](https://gohugo.io/getting-started/installing/) for information on obtaining a newer release for your platform.
|
||||
|
||||
## Step 2: Upgrade Congo
|
||||
|
||||
The process for upgrading Congo will depend on how you include the theme in your project. Instructions for each method can be found below.
|
||||
|
||||
- [Upgrade using Hugo](#upgrade-using-hugo)
|
||||
- [Upgrade using git](#upgrade-using-git)
|
||||
- [Upgrade manually](#upgrade-manually)
|
||||
|
||||
### Upgrade using Hugo
|
||||
|
||||
To upgrade a go module to a new major release, the `modules.toml` and `go.mod` files need to be updated. In each file, update the path to the theme from `github.com/jpanther/congo` to `github.com/jpanther/congo/v2`.
|
||||
|
||||
Then change into your project directory and execute the following command:
|
||||
|
||||
```shell
|
||||
hugo mod get -u
|
||||
```
|
||||
|
||||
Note that in some circumstances there may be issues with this step due to the way that Hugo locally caches modules. If the command above doesn't work, try using `hugo mod clean` to clear out the local cache and re-download any modules.
|
||||
|
||||
Once the theme has been upgraded, continue to the [next section](#step-3-theme-configuration).
|
||||
|
||||
### Upgrade using git
|
||||
|
||||
Git submodules can be upgraded using the `git` command. Simply execute the following command and the latest version of the theme will be downloaded into your local repository:
|
||||
|
||||
```shell
|
||||
git submodule update --remote --merge
|
||||
```
|
||||
|
||||
Once the submodule has been upgraded, continue to the [next section](#step-3-theme-configuration).
|
||||
|
||||
### Upgrade manually
|
||||
|
||||
Updating Congo manually requires you to download the latest copy of the theme and replace the old version in your project.
|
||||
|
||||
{{< alert >}}
|
||||
Note that any local customisations you have made to the theme files will be lost during this process.
|
||||
{{< /alert >}}
|
||||
|
||||
1. Download the latest release of the theme source code.
|
||||
|
||||
{{< button href="https://github.com/jpanther/congo/releases/latest" target="_blank" >}}Download from Github{{< /button >}}
|
||||
|
||||
2. Extract the archive, rename the folder to `congo` and move it to the `themes/` directory inside your Hugo project's root folder. You will need to overwrite the existing directory to replace all the theme files.
|
||||
|
||||
3. Continue to the [next section](#step-3-theme-configuration).
|
||||
|
||||
## Step 3: Theme configuration
|
||||
|
||||
Congo 2.0 introduces a number of new theme configuration parameters. Although the theme will adapt to existing version 1 configurations, in order to take advantage of some of the newer theme features, you will need to adjust your existing configuration.
|
||||
|
||||
The simplest way to do this is to take a copy of the theme's default configuration and compare it to your existing files. The process is outlined in greater detail below.
|
||||
|
||||
### Languages.toml
|
||||
|
||||
In order to provide multilingual support, language-specific theme parameters have been moved to a new config file `languages.[lang-code].toml`. The theme comes with a template `languages.en.toml` file which can be used as a guide.
|
||||
|
||||
{{< alert >}}
|
||||
This step is optional if you do not need multilingual support, although completing it now will make future theme upgrades easier.
|
||||
{{< /alert >}}
|
||||
|
||||
The languages config file follows this structure:
|
||||
|
||||
```toml
|
||||
# config/_default/languagues.en.toml
|
||||
|
||||
languageCode = "en"
|
||||
languageName = "English"
|
||||
displayName = "EN"
|
||||
htmlCode = "en"
|
||||
weight = 1
|
||||
rtl = false
|
||||
|
||||
# Language-specific parameters go here
|
||||
```
|
||||
|
||||
Using your preferred language, simply create this new file in `config/_default/` and then move the language-specific parameters from any existing config files over to this new file. The table below outlines the parameters that need to be moved.
|
||||
|
||||
| Parameter | Old location |
|
||||
| ------------- | ------------- |
|
||||
| `title` | `config.toml` |
|
||||
| `description` | `params.toml` |
|
||||
| `copyright` | `config.toml` |
|
||||
| `dateFormat` | `params.toml` |
|
||||
| `[author]` | `config.toml` |
|
||||
|
||||
Once the values have been moved to the new location, these parameters should be deleted from their original locations.
|
||||
|
||||
### Menus.toml
|
||||
|
||||
As the theme is now aware of languages, the `menus.toml` file should also be renamed to include a language code. Rename the existing `menus.toml` to `menus.[lang-code].toml`, where the language code matches the code used in the `languages.toml` file in the previous section.
|
||||
|
||||
### Config.toml
|
||||
|
||||
The `config.toml` file now only contains base Hugo configuration values. Other than removing the language-specific strings above, there are only two changes to consider.
|
||||
|
||||
If you're using a language other than English, provide a `defaultContentLanguage` value that matches the language code in the config file you created for your language. Secondly, to take advange of the new site search in Congo 2.0, an `[outputs]` block needs to be provided.
|
||||
|
||||
```toml
|
||||
# config/_default/config.toml
|
||||
|
||||
defaultContentLanguage = "en"
|
||||
|
||||
enableRobotsTXT = true
|
||||
paginate = 10
|
||||
summaryLength = 0
|
||||
|
||||
[outputs]
|
||||
home = ["HTML", "RSS", "JSON"]
|
||||
```
|
||||
|
||||
### Markup.toml
|
||||
|
||||
Congo 2.0 adds support for tables of contents on article pages. Although Hugo ships with default settings for generating contents listings, you can adjust this behaviour by adding a new `[tableOfContents]` block to your `markup.toml` file.
|
||||
|
||||
The recommended settings are as follows, which includes any headings in the Markdown content at levels 2, 3 and 4:
|
||||
|
||||
```toml
|
||||
# config/_default/markup.toml
|
||||
|
||||
[tableOfContents]
|
||||
startLevel = 2
|
||||
endLevel = 4
|
||||
```
|
||||
|
||||
### Params.toml
|
||||
|
||||
A number of new theme parameters have been introduced in Congo 2.0. Some minor changes are requried to existing configurations. Remember, the theme will always revert to a sensible default if a parameter is not provided.
|
||||
|
||||
The way that dark mode works in Congo has been changed to allow greater flexibility around configuration. The old `darkMode` and `darkToggle` parameters have been **removed and replaced** by three new parameters. These new options operate independently of each other, making it possible to force the appearance while still allowing the user to override.
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
| New parameter | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `defaultAppearance` | String | `"light"` | Default theme appearance; either `light` or `dark`.<br>:warning: _Setting this to `light` replicates the old `darkMode = false` setting, while `dark` replicates `darkMode = true`._ |
|
||||
| `autoSwitchAppearance` | Boolean | `true` | Whether the theme appearance automatically switches based upon the operating system preference. Set to `false` to force the site to always use the `defaultAppearance`. <br>:warning: _Setting this to `true` replicates the old `darkMode = "auto"` setting._ |
|
||||
| `showAppearanceSwitcher` | Boolean | `false` | Whether the theme appearance switcher is dispalyed in the site footer. <br>:warning: _This parameter replaces `darkToggle`._ |
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
The following table outlines some other key **new parameters** that control new features in version 2:
|
||||
|
||||
| New parameter | Type | Default |
|
||||
| ----------------------------- | ------- | ------- |
|
||||
| `enableSearch` | Boolean | `false` |
|
||||
| `showScrollToTop` | Boolean | `true` |
|
||||
| `article.showTaxonomies` | Boolean | `false` |
|
||||
| `article.showTableOfContents` | Boolean | `false` |
|
||||
| `list.showTableOfContents` | Boolean | `false` |
|
||||
|
||||
For the full list of supported parameters, refer to the [Configuration]({{< ref "docs/configuration" >}}) docs.
|
||||
|
||||
## Step 4: Move assets
|
||||
|
||||
All site assets, with the exception of favicons, now use Hugo Pipes to build an optimised version of your project. In order for the theme to locate your files, any previously static theme assets need to be moved to the Hugo assets folder. Primarily this is the author image and site logo:
|
||||
|
||||
`static/me.jpg` **→** `assets/me.jpg`
|
||||
`static/logo.jpg` **→** `assets/logo.jpg`
|
||||
|
||||
If you have provided an author image or site logo, simply move these assets from `static/` to `assets/`. If you use the same directory structure the theme will know where to find these files automatically. If you would like to provide a new path, update the `logo` and `author.image` config values accordingly.
|
||||
|
||||
Note that this step does not apply to any assets in your project that are actually static. For example, a PDF file that you link directly to from within an article is a static asset. These files should remain in the `static/` directory to ensure they are copied to the output folder when Hugo builds the site.
|
||||
|
||||
## Step 5: Check content
|
||||
|
||||
The behavior of the `figure` shortcode is different in version 2. If you are using `figure` in your content and have advanced use cases, you may need to adjust the parameters you are providing.
|
||||
|
||||
Consult the [shortcode docs]({{< ref "docs/shortcodes#figure" >}}) to learn more about supported parameters.
|
||||
|
||||
## Step 6: Rebuild
|
||||
|
||||
Now that all the configuration changes are complete, it's time to rebuild the site. Run `hugo`, or your build command, and check that everything works as expected.
|
||||
|
||||
If you come across any errors, check the configuration is correct and refer to the [full documentation]({{< ref "docs" >}}) for further guidance. Remember, the example config files bundled with the theme contain all the default parameters and are a great starting point.
|
||||
|
||||
🙋♀️ If you still need help, feel free to ask your question on [GitHub Discussions](https://github.com/jpanther/congo/discussions).
|
||||
@@ -0,0 +1,223 @@
|
||||
---
|
||||
title: "从Congo 1.x升级"
|
||||
date: 2022-01-20
|
||||
draft: false
|
||||
description: "探索2.0的新特性"
|
||||
tags: ["new", "docs"]
|
||||
---
|
||||
|
||||
尽管 Congo 2.0 包含大量变化,但主题已经经过设计,以最小化升级到最新版本所需的努力。
|
||||
|
||||
话虽如此,有一些变化需要调整使用 Congo 1.x 构建的现有站点。本指南将引导你完成整个过程,并突出需要考虑的事项。
|
||||
|
||||
## 步骤1:升级Hugo
|
||||
|
||||
{{< alert >}}
|
||||
Congo 2.0 要求最低 **Hugo v0.87.0 或更高版本**
|
||||
{{< /alert >}}
|
||||
|
||||
Congo被设计以充分利用一些最新的Hugo功能。为避免任何问题,你应该定期保持Hugo的安装版本。
|
||||
|
||||
你可以使用命令 `hugo version` 检查你当前的版本。请访问[Hugo文档](https://gohugo.io/getting-started/installing/)获取适用于你平台的更新版本的信息。
|
||||
|
||||
## 步骤2:升级Congo
|
||||
|
||||
升级Congo的过程取决于你如何在项目中引入主题。每种方法的说明如下。
|
||||
|
||||
- [使用Hugo升级](#使用Hugo升级)
|
||||
- [使用git升级](#使用git升级)
|
||||
- [手动升级](#手动升级)
|
||||
|
||||
### 使用Hugo升级
|
||||
|
||||
要将go模块升级到新的主版本,需要更新 `modules.toml` 和 `go.mod` 文件。在每个文件中,将主题的路径从 `github.com/jpanther/congo` 更新为 `github.com/jpanther/congo/v2`。
|
||||
|
||||
然后进入你的项目目录并执行以下命令:
|
||||
|
||||
```shell
|
||||
hugo mod get -u
|
||||
```
|
||||
|
||||
请注意,在某些情况下,由于Hugo本地缓存模块的方式,此步骤可能会出现问题。如果上述命令不起作用,请尝试使用 `hugo mod clean` 来清除本地缓存并重新下载任何模块。
|
||||
|
||||
一旦主题已经升级,继续到[下一节](#步骤-3-主题配置)。
|
||||
|
||||
### 使用git升级
|
||||
|
||||
可以使用`git`命令升级Git子模块。只需执行以下命令,最新版本的主题将被下载到你的本地存储库中:
|
||||
|
||||
```shell
|
||||
git submodule update --remote --merge
|
||||
```
|
||||
|
||||
一旦子模块升级完成,继续到[下一节](#step-3-theme-configuration)。
|
||||
|
||||
### 手动升级
|
||||
|
||||
手动更新Congo需要下载主题的最新副本,并替换项目中的旧版本。
|
||||
|
||||
{{< alert >}}
|
||||
请注意,在此过程中,您对主题文件所做的任何本地自定义将会丢失。
|
||||
{{< /alert >}}
|
||||
|
||||
1. 下载主题源代码的最新发布。
|
||||
|
||||
{{< button href="https://github.com/jpanther/congo/releases/latest" target="_blank" >}}从Github下载{{< /button >}}
|
||||
|
||||
2. 解压缩存档,将文件夹重命名为 `congo` 并将其移动到Hugo项目根目录下的 `themes/` 目录。你需要覆盖现有目录以替换所有主题文件。
|
||||
|
||||
3. 继续到[下一节](#step-3-theme-configuration)。
|
||||
|
||||
## 步骤 3:主题配置
|
||||
|
||||
Congo 2.0 引入了许多新的主题配置参数。虽然主题会适应现有的版本1配置,但为了利用一些新的主题功能,你需要调整你现有的配置。
|
||||
|
||||
最简单的方法是复制主题的默认配置并将其与你的现有文件进行比较。下面详细介绍了这个过程。
|
||||
|
||||
### Languages.toml
|
||||
|
||||
为了提供多语言支持,特定于语言的主题参数已移至新的配置文件 `languages.[lang-code].toml`。主题附带一个模板文件 `languages.en.toml`,可作为参考。
|
||||
|
||||
{{< alert >}}
|
||||
如果您不需要多语言支持,此步骤是可选的,但现在完成它将使未来的主题升级更容易。
|
||||
{{< /alert >}}
|
||||
|
||||
语言配置文件遵循以下结构:
|
||||
|
||||
```toml
|
||||
# config/_default/languagues.en.toml
|
||||
|
||||
languageCode = "en"
|
||||
languageName = "English"
|
||||
displayName = "EN"
|
||||
htmlCode = "en"
|
||||
weight = 1
|
||||
rtl = false
|
||||
|
||||
# Language-specific parameters go here
|
||||
```
|
||||
|
||||
### Languages.toml
|
||||
|
||||
为了提供多语言支持,特定于语言的主题参数已移至新的配置文件 `languages.[lang-code].toml`。主题附带一个模板文件 `languages.en.toml`,可作为参考。
|
||||
|
||||
{{< alert >}}
|
||||
如果您不需要多语言支持,此步骤是可选的,但现在完成它将使未来的主题升级更容易。
|
||||
{{< /alert >}}
|
||||
|
||||
语言配置文件遵循以下结构:
|
||||
|
||||
```toml
|
||||
# config/_default/languagues.en.toml
|
||||
|
||||
languageCode = "en"
|
||||
languageName = "English"
|
||||
displayName = "EN"
|
||||
htmlCode = "en"
|
||||
weight = 1
|
||||
rtl = false
|
||||
|
||||
# 此处放置特定于语言的参数
|
||||
```
|
||||
|
||||
使用你喜欢的语言,在 `config/_default/` 中创建这个新文件,然后将任何现有配置文件中的特定于语言的参数移到这个新文件中。下表概述了需要移动的参数。
|
||||
|
||||
| 参数 | 旧位置 |
|
||||
| ------------- | ------------- |
|
||||
| `title` | `config.toml` |
|
||||
| `description` | `params.toml` |
|
||||
| `copyright` | `config.toml` |
|
||||
| `dateFormat` | `params.toml` |
|
||||
| `[author]` | `config.toml` |
|
||||
|
||||
一旦值已经移动到新位置,应该从其原始位置删除这些参数。
|
||||
|
||||
### Menus.toml
|
||||
|
||||
由于主题现在支持多语言,`menus.toml` 文件也应该重命名,包含语言代码。将现有的 `menus.toml` 重命名为 `menus.[lang-code].toml`,其中语言代码与前一节中的 `languages.toml` 文件中使用的代码匹配。
|
||||
|
||||
### Config.toml
|
||||
|
||||
`config.toml` 文件现在只包含基本的Hugo配置值。除了删除上述特定于语言的字符串之外,只有两个更改需要考虑。
|
||||
|
||||
如果你使用的是英语以外的语言,请提供一个与你为语言创建的配置文件中的语言代码匹配的 `defaultContentLanguage` 值。其次,为了利用Congo 2.0中的新站点搜索,需要提供一个 `[outputs]` 块。
|
||||
|
||||
```toml
|
||||
# config/_default/config.toml
|
||||
|
||||
defaultContentLanguage = "en"
|
||||
|
||||
enableRobotsTXT = true
|
||||
paginate = 10
|
||||
summaryLength = 0
|
||||
|
||||
[outputs]
|
||||
home = ["HTML", "RSS", "JSON"]
|
||||
```
|
||||
|
||||
### Markup.toml
|
||||
|
||||
Congo 2.0 添加了对文章页面上目录的支持。尽管Hugo默认提供了生成目录列表的默认设置,你可以通过在 `markup.toml` 文件中添加一个新的 `[tableOfContents]` 块来调整此行为。
|
||||
|
||||
建议的设置如下,包括Markdown内容中的任何标题,级别为2、3和4:
|
||||
|
||||
```toml
|
||||
# config/_default/markup.toml
|
||||
|
||||
[tableOfContents]
|
||||
startLevel = 2
|
||||
endLevel = 4
|
||||
```
|
||||
|
||||
### Params.toml
|
||||
|
||||
Congo 2.0 引入了许多新的主题参数。一些现有配置需要进行一些小的更改。请记住,如果未提供参数,主题将始终恢复为合理的默认值。
|
||||
|
||||
Congo中深色模式的工作方式已更改,以提供更大的配置灵活性。旧的 `darkMode` 和 `darkToggle` 参数已被 **删除并替换** 为三个新参数。这些新选项彼此独立操作,使得可以强制外观同时仍然允许用户覆盖。
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
| 新参数 | 类型 | 默认值 | 描述 |
|
||||
| --- | --- | --- | --- |
|
||||
| `defaultAppearance` | 字符串 | `"light"` | 默认主题外观;可以是 `light` 或 `dark`。<br>:warning: _将其设置为 `light` 复制了旧的 `darkMode = false` 设置,而 `dark` 复制了 `darkMode = true`。_ |
|
||||
| `autoSwitchAppearance` | 布尔值 | `true` | 主题外观是否根据操作系统首选项自动切换。将其设置为 `false` 可始终强制站点使用 `defaultAppearance`。<br>:warning: _将其设置为 `true` 复制了旧的 `darkMode = "auto"` 设置。_ |
|
||||
| `showAppearanceSwitcher` | 布尔值 | `false` | 主题外观切换器是否显示在站点页脚中。<br>:warning: _此参数替代了 `darkToggle`。_ |
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
以下表格概述了版本2中控制新功能的一些其他关键 **新参数**。
|
||||
|
||||
| 新
|
||||
|
||||
参数 | 类型 | 默认值 |
|
||||
| ----------------------- | ------- | ------- |
|
||||
| `enableSearch` | 布尔值 | `false` |
|
||||
| `showScrollToTop` | 布尔值 | `true` |
|
||||
| `article.showTaxonomies` | 布尔值 | `false` |
|
||||
| `article.showTableOfContents` | 布尔值 | `false` |
|
||||
| `list.showTableOfContents` | 布尔值 | `false` |
|
||||
|
||||
有关支持的所有参数的完整列表,请参阅[配置]({{< ref "docs/configuration" >}})文档。
|
||||
|
||||
## 步骤4:移动assets
|
||||
|
||||
除了favicon之外,现在所有站点assets都使用Hugo Pipes构建项目的优化版本。为了使主题能够定位你的文件,任何先前的静态主题assets需要移动到Hugo资产文件夹。主要是作者图片和站点标志:
|
||||
|
||||
`static/me.jpg` **→** `assets/me.jpg`
|
||||
`static/logo.jpg` **→** `assets/logo.jpg`
|
||||
|
||||
如果你提供了作者图片或站点标志,只需将这些资产从 `static/` 移动到 `assets/`。如果使用相同的目录结构,主题将自动知道在哪里找到这些文件。如果想提供新的路径,相应地更新 `logo` 和 `author.image` 配置值。
|
||||
|
||||
请注意,此步骤不适用于项目中实际上是静态的任何assets。例如,直接从文章中链接的PDF文件是静态资产。这些文件应保留在 `static/` 目录中,以确保在Hugo构建站点时将它们复制到输出文件夹中。
|
||||
|
||||
## 步骤5:检查内容
|
||||
|
||||
版本2中 `figure` 短代码 的行为不同。如果在内容中使用 `figure` 并且有高级用例,可能需要调整提供的参数。
|
||||
|
||||
查阅[短代码文档]({{< ref "docs/shortcodes#figure" >}})以了解有关支持的参数的更多信息。
|
||||
|
||||
## 步骤6:重新构建
|
||||
|
||||
现在所有配置更改都已完成,是时候重新构建站点了。运行 `hugo` 或你的构建命令,并检查一切是否按预期工作。
|
||||
|
||||
如果遇到任何错误,请检查配置是否正确,并参考[完整文档]({{< ref "docs" >}})获取进一步的指导。记住,主题捆绑的示例配置文件包含所有默认参数,并且是一个很好的起点。
|
||||
|
||||
🙋♀️ 如果仍然需要帮助,请随时在[GitHub Discussions](https://github.com/jpanther/congo/discussions)上提问。
|
||||
Reference in New Issue
Block a user