Open Custom Blocks

Contents

To enhance the extensibility of the FixIt theme, we provide some custom blocks that you can use in your project to achieve more functionality.

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
Build multiple upper-level components based on the FixIt theme, and finally use them in the top-level blog.

Entry File

FixIt 0.3.7 | NEW

The FixIt theme opens a unified custom template entry file layouts/_partials/custom.html.

In this file, the FixIt theme has defined all open custom blocks. If you want to further customize, you can copy it from the theme to your project and override it.

1
cp themes/FixIt/layouts/_partials/custom.html layouts/_partials/custom.html

Custom Blocks

You can implement these blocks through define.

Block NameDescriptionLocation
custom-headHead custom blocklayouts/baseof.html
custom-menu:desktopDesktop menu custom blocklayouts/_partials/layouts/header.html
custom-menu:mobileMobile menu custom blocklayouts/_partials/layouts/header.html
custom-profileProfile custom blocklayouts/_partials/home/profile.html
custom-commentComment system custom blocklayouts/_partials/layouts/comment.html
custom-asideSidebar custom blocklayouts/posts/single.html
custom-footerFooter custom blocklayouts/_partials/layouts/footer.html
custom-widgetsWidgets custom blocklayouts/_partials/layouts/widgets.html
custom-assetsAssets custom blocklayouts/_partials/layouts/assets.html
custom-post__toc:beforeCustom block before post toclayouts/posts/single.html
custom-post__toc:afterCustom block after post toclayouts/posts/single.html
custom-post__content:beforeCustom block before post contentlayouts/posts/single.html
custom-post__content:afterCustom block after post contentlayouts/posts/single.html
custom-post__footer:beforeCustom block before post footerlayouts/posts/single.html
custom-post__footer:afterCustom block after post footerlayouts/posts/single.html

Theme Configuration

FixIt 0.3.12 | NEW

To facilitate the management of introducing custom templates, you can specify the path of custom templates through the params.custom_partials parameter.

Custom partials must be stored in the /layouts/_partials/ directory.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
[params.custom_partials]
head = []
menu_desktop = []
menu_mobile = []
profile = []
aside = []
comment = []
footer = []
widgets = []
assets = []
post_toc_before = []
post_toc_after = []
post_content_before = []
post_content_after = []
post_footer_before = []
post_footer_after = []

How to Use

Now let’s take the custom home page custom-profile block as an example to demonstrate how to use custom blocks.

At first, create a custom file in the layouts/_partials/ directory, such as layouts/_partials/custom/profile.html.

Write any content:

1
The quick brown fox jumps over the lazy dog.

Then specify the path of the custom template in the configuration file.

1
2
[params.custom_partials]
profile = [ "custom/profile.html" ]

Visit the homepage, and you will see the custom content in the profile area.


Related Content

Buy me a coffee
Lruihao AlipayAlipay
Lruihao WeChat PayWeChat Pay

Update Available

A new version of this site is available.