Can I create new custom widget in sidebar ? #1288
-
Can I create new custom widget in sidebar without modifying the layout source theme ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Widget SortingJust configure aside:
...
card_recent_post:
sort_order: # Don't modify the setting unless you know how it works
card_categories:
sort_order: # Don't modify the setting unless you know how it works
card_tags:
sort_order: # Don't modify the setting unless you know how it works
card_archives:
sort_order: # Don't modify the setting unless you know how it works
card_webinfo:
sort_order: # Don't modify the setting unless you know how it works
newest_comments:
enable: true
sort_order: # Don't modify the setting unless you know how it works Custom WidgetsIf you want to add your own content to the sidebar, you can customize it. Create widget.ymlCreate a file Formattop:
- class_name:
id_name:
name:
icon:
html:
bottom:
- class_name:
id_name:
name:
icon:
order:
html:
top: The created widget will appear in the non-sticky area (that is, it will be displayed on all pages). bottom: The created widget will appear in the sticky area (except for the article page).
The generated code is <div class="card-widget The written class_name" id="The written id_name" style="order: The written order">
<div class="item-headline">
<i class="The written icon"></i>
<span>The written name</span>
</div>
<div class="item-content">
The written html
</div>
</div> If you need to adjust the UI of the added widget, please add css to inject by yourself. ExampleTake Visitor Map as an example.
|
Beta Was this translation helpful? Give feedback.
Widget Sorting
Just configure
sort_order
. (Using theorder
property ofFlex
layout, see mozilla documentation for details. In short, use numbers to sort. If not configured, the default is 0. The smaller the number, the higher the sorting.)