diff --git a/README.md b/README.md index 6c90de84..ff2bc788 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,22 @@ You have two options for the list of blog posts on the home page: show_all_posts: true ``` + +### Category and Tag section on home page +You can show a category and tag section on the home page by editing the hexo ```_config.yml``` file. + + ```yml + # Show a Tags section on the home page + show_tags_section: true + + # Show a Category section on the home page + show_category_section: true + ``` +The theme has a provision to make separate tags and category pages. For this, you need to follow these steps: +- make a new hexo page. +- changing the layout to ```tags``` for a tags page or ```categories``` for a categories page. +- adding the relevant paths in your nav menu. + ### Projects list Create a projects file `source/_data/projects.json` to show a list of your projects on the index page. diff --git a/_config.yml b/_config.yml index 6cf87edc..69dbb65c 100644 --- a/_config.yml +++ b/_config.yml @@ -19,6 +19,11 @@ nav: articles: /archives/ projects: http://github.com/probberechts +# Show a Tags section on the home page +show_tags_section: true + +# Show a Category section on the home page +show_category_section: true # Links to your social media accounts. # The 'icon' keys should correspond to Fontawesome icon names diff --git a/layout/categories.ejs b/layout/categories.ejs new file mode 100644 index 00000000..d44761c0 --- /dev/null +++ b/layout/categories.ejs @@ -0,0 +1,26 @@ +<%- partial('_partial/head') %> +
+
+ Categories + a category wise display of posts + <% if (site.categories && site.categories.length > 0) { %> + + <% } else { %> +

No categories found.

+ <% } %> +
+
+<%- partial('_partial/footer') %> \ No newline at end of file diff --git a/layout/index.ejs b/layout/index.ejs index f2a38194..87042492 100644 --- a/layout/index.ejs +++ b/layout/index.ejs @@ -72,3 +72,37 @@ <% } %> + +<% if (theme.show_tags_section) { %> +
+ Tags + <% if (site.tags && site.tags.length > 0) { %> + + <% } else { %> +

No tags found.

+ <% } %> +
+<% } %> + +<% if (theme.show_category_section) { %> +
+ Categories + <% if (site.categories && site.categories.length > 0) { %> + + <% } else { %> +

No categories found.

+ <% } %> +
+ <% } %> \ No newline at end of file diff --git a/layout/tags.ejs b/layout/tags.ejs new file mode 100644 index 00000000..b4fe516f --- /dev/null +++ b/layout/tags.ejs @@ -0,0 +1,26 @@ +<%- partial('_partial/head') %> +
+
+ Tags + a tag wise display of posts + <% if (site.tags && site.tags.length > 0) { %> + + <% } else { %> +

No tags found.

+ <% } %> +
+
+<%- partial('_partial/footer') %> \ No newline at end of file