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.html
inside it. - Add
permalink: /
in the front matter of/_tabs/about.md
.
- Create a new folder, e.g.
Add
paginate_path
in/_config.yml
to point to the folder/blog/
1 2 3 4
+ paginate_path: "/blog/page:num/" ... - permalink: /posts/:title/ + permalink: /blog/:title/
Add
BLOG
as a new tab or navigation item, refer to this issue.Modify
/_includes/sidebar.html
1 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.html
1 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.baseurl
if 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-meta
andtails
in the homepage by assigning bool valueshas_title
,has_meta
andhas_tail
to skip related part in_layouts/page.html
and_layouts/post.html
.