step: code
./_include/modules/ - write the html code of modules../_sass/modules/ - write the scss code of modules. (first, you should @import(...) the new sass file in ./_sass/modules/modules-list.scss)./assets/js/modules/ - write the js code of modules.step: use
if you plan to use the html of the module, you should just use {%- include your_module.html -%}.
if you alse plan to use js/css, you should add a front matter with the name equals layout name and the value equals the name that the module name that you plan to use append _modules. And then add the layout name into _data/layout.yml.
e.g.
you can take the module post_table as an example.
the module post_table is used in home layout
---
.... other front matter ....
home_modules: ["post_table"]
.... other front matter ....
---
.... other content ....
{%- include modules/post_table.html -%}
.... other content ....
and add home into _data/layout.yml
name:
...........other
- home
...........other