-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
171 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"content":{"en":{"components":{"dev-component":{}},"documentation":{"content-management":{"introduction":{},"shortcodes":{"built-in":{},"extended":{"echarts":{}}},"encryption":{},"timeline-support":{}}}},"zh-cn":{"documentation":{"content-management":{"introduction":{}},"getting-started":{"quick-start":{}}},"components":{"dev-component":{}}}},"assets":{"images":{"icons":{}}}} | ||
{"content":{"en":{"components":{"dev-component":{}},"documentation":{"content-management":{"introduction":{},"shortcodes":{"built-in":{},"extended":{"echarts":{}}},"encryption":{},"timeline-support":{}}}},"zh-cn":{"documentation":{"content-management":{"introduction":{}},"getting-started":{"quick-start":{}}},"components":{"dev-component":{}},"references":{"blocks":{}}}},"assets":{"images":{"icons":{}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
title: Open Custom Blocks | ||
date: 2024-05-09T10:28:58+08:00 | ||
type: posts | ||
collections: | ||
- References | ||
resources: | ||
- name: featured-image-preview | ||
src: featured-image.webp | ||
lightgallery: true | ||
--- | ||
|
||
To enhance the extensibility of the FixIt theme, we provide some custom blocks that you can use in your project to achieve more functionality. | ||
|
||
<!--more--> | ||
|
||
## Entry File | ||
|
||
{{< version 0.3.7 >}} | ||
|
||
The FixIt theme opens a unified custom template entry file [`layouts/partials/custom.html`][custom-html], through which you can implement custom blocks or more ideas. | ||
|
||
To avoid upgrade conflicts and facilitate the reference of theme components, it's strongly recommended to copy this file from the theme to your project and override it. | ||
|
||
```bash | ||
cp themes/FixIt/layouts/partials/custom.html layouts/partials/custom.html | ||
``` | ||
|
||
## Custom Blocks | ||
|
||
You can implement these blocks through `define`. | ||
|
||
| Block Name | Description | Location | | ||
| :--------------------------- | :------------------------------ | :------------------------------------- | | ||
| `custom-head` | Head custom block | `layouts/_default/baseof.html` | | ||
| `custom-profile` | Profile custom block | `layouts/partials/home/profile.html` | | ||
| `custom-comment` | Comment system custom block | `layouts/partials/single/comment.html` | | ||
| `custom-aside` | Sidebar custom block | `layouts/posts/single.html` | | ||
| `custom-footer` | Footer custom block | `layouts/partials/footer.html` | | ||
| `custom-widgets` | Widgets custom block | `layouts/partials/widgets.html` | | ||
| `custom-assets` | Assets custom block | `layouts/partials/assets.html` | | ||
| `custom-post__footer:before` | Custom block before post footer | `layouts/posts/single.html` | | ||
| `custom-post__footer:after` | Custom block after post footer | `layouts/posts/single.html` | | ||
|
||
## What's the Meaning | ||
|
||
By opening custom blocks, the extensibility of the FixIt theme is further enhanced. | ||
|
||
After that, we can make full use of the basic features of the theme and build more upper-level components, so that the blog is full of unlimited imagination and creativity! | ||
|
||
![Theme, Components, Blog Venn Diagram](./featured-image.webp "Build multiple upper-level components based on the FixIt theme, and finally use them in the top-level blog.") | ||
|
||
## How to Use | ||
|
||
For example, the FixIt theme documentation site customizes the `custom-profile` block on the homepage. | ||
|
||
First, create a custom template entry file: | ||
|
||
```bash | ||
cp themes/FixIt/layouts/partials/custom.html layouts/partials/custom.html | ||
``` | ||
|
||
Then, define the `custom-profile` block in the custom template: | ||
|
||
```go-html-template {title="layouts/partials/custom.html"} | ||
<!-- ... --> | ||
{{- define "custom-profile" -}} | ||
{{- partial "custom/profile.html" . -}} | ||
{{- end -}} | ||
<!-- ... --> | ||
``` | ||
|
||
<!-- link reference definition --> | ||
[custom-html]: https://github.com/hugo-fixit/FixIt/blob/master/layouts/partials/custom.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
title: 开放的自定义块 | ||
date: 2024-05-09T10:28:58+08:00 | ||
type: posts | ||
collections: | ||
- References | ||
resources: | ||
- name: featured-image-preview | ||
src: featured-image.webp | ||
lightgallery: true | ||
--- | ||
|
||
为了提升 FixIt 主题的可扩展性,我们提供了一些自定义块,你可以在你的项目中使用这些自定义块来实现更多的功能。 | ||
|
||
<!--more--> | ||
|
||
## 入口文件 | ||
|
||
{{< version 0.3.7 >}} | ||
|
||
FixIt 主题开放了统一的自定义模板入口文件 [`layouts/partials/custom.html`][custom-html],你可以通过这个文件来实现自定义块或者更多的想法。 | ||
|
||
为了避免升级冲突并方便引用主题组件,我们强烈建议你将此文件从主题复制到你的项目中并重写。 | ||
|
||
```bash | ||
cp themes/FixIt/layouts/partials/custom.html layouts/partials/custom.html | ||
``` | ||
|
||
## 自定义块 | ||
|
||
你可以通过 `define` 来实现这些块。 | ||
|
||
| 块名称 | 描述 | 位置 | | ||
| :--------------------------- | :----------------- | :------------------------------------- | | ||
| `custom-head` | 头部自定义块 | `layouts/_default/baseof.html` | | ||
| `custom-profile` | 首页自定义块 | `layouts/partials/home/profile.html` | | ||
| `custom-aside` | 侧栏自定义块 | `layouts/posts/single.html` | | ||
| `custom-comment` | 评论系统自定义块 | `layouts/partials/single/comment.html` | | ||
| `custom-footer` | 页脚自定义块 | `layouts/partials/footer.html` | | ||
| `custom-widgets` | 小部件自定义块 | `layouts/partials/widgets.html` | | ||
| `custom-assets` | 资源自定义块 | `layouts/partials/assets.html` | | ||
| `custom-post__footer:before` | 文章页脚前自定义块 | `layouts/posts/single.html` | | ||
| `custom-post__footer:after` | 文章页脚后自定义块 | `layouts/posts/single.html` | | ||
|
||
## 有何意义 | ||
|
||
通过开放自定义块,FixIt 主题的可扩展性进一步提升。 | ||
|
||
之后,我们可以充分利用主题的基础特性,构建更多上层组件,从而使博客充满无限的想象空间和创意! | ||
|
||
![主题、组件、博客 Venn 图](/references/blocks/featured-image.webp "以 FixIt 主题为核心构建多个上层组件,最后在最上层的博客中使用。") | ||
|
||
## 如何使用 | ||
|
||
例如,FixIt 主题文档站点自定义了首页的 `custom-profile` 块。 | ||
|
||
首先,创建自定义模板入口文件: | ||
|
||
```bash | ||
cp themes/FixIt/layouts/partials/custom.html layouts/partials/custom.html | ||
``` | ||
|
||
然后,在自定义模板中定义 `custom-profile` 块: | ||
|
||
```go-html-template {title="layouts/partials/custom.html"} | ||
<!-- ... --> | ||
{{- define "custom-profile" -}} | ||
{{- partial "custom/profile.html" . -}} | ||
{{- end -}} | ||
<!-- ... --> | ||
``` | ||
|
||
<!-- link reference definition --> | ||
[custom-html]: https://github.com/hugo-fixit/FixIt/blob/master/layouts/partials/custom.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters