Exchange Homepage and About
To change the default site homepage as About, and the original paginator homepage as Blog. It may be difficult since pagination only works within index.html, see similar issue.
-
Modify the front matters with permalink:
- Create a new folder, e.g.
/blog/, and moveindex.htmlinside it. - Add
permalink: /in the front matter of/_tabs/about.md.
- Create a new folder, e.g.
-
Add
paginate_pathin/_config.ymlto point to the folder/blog/1 2 3 4
+ paginate_path: "/blog/page:num/" ... - permalink: /posts/:title/ + permalink: /blog/:title/
-
Add
BLOGas a new tab or navigation item, refer to this issue.-
Modify
/_includes/sidebar.html1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<!-- home --> - <li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}"> + <li class="nav-item{% if page.url == '/' | relative_url %}{{ " active" }}{% endif %}"> <a href="{{ '/' | relative_url }}" class="nav-link"> <i class="fa-fw fas fa-home"></i> <span>{{ site.data.locales[include.lang].tabs.home | upcase }}</span> </a> </li> + <!-- blog --> + <li class="nav-item{% if page.url == '/blog/' | relative_url %}{{ " active" }}{% endif %}"> + <a href="{{ '/blog/' | relative_url }}" class="nav-link"> + <i class="fa-fw fas fa-pen"></i> + <span>BLOG</span> + </a> + </li> <!-- the real tabs --> {% for tab in site.tabs %} + {% if tab.url == '/' | relative_url %}{% continue %}{% endif %}
-
Modify
/_includes/topbar.html1 2 3 4 5 6 7
- {% if paths.size == 0 or page.layout == 'home' %} - <!-- index page --> + {% if paths.size == 0 %} + <!-- home page --> ... - {% elsif page.layout == 'category' or page.layout == 'tag' %} + {% elsif page.layout == 'category' or page.layout == 'tag' or page.layout == 'home' %}
-
-
Replace
page.layout == 'home'withpage.url == '/' or page.url == site.baseurlif needed, including_layouts/page.html,_includes/head.html,/_includes/sidebar.html, and_includes/topbar.html. -
(Optional) Modify your style in
/_tabs/about.md. For example, this demo we disabletitle,post-metaandtailsin the homepage by assigning bool valueshas_title,has_metaandhas_tailto skip related part in_layouts/page.htmland_layouts/post.html.