Skip to content

For those who want to add extra items on index page(home page) #139

@YoobinLee

Description

@YoobinLee

Here I make an example of "links". You can see the final result in YoobinPage.

  1. Enter the theme folder.
  • open /layout/index.ejs, insert:
<% if (site.data.links) { %>
<section id="links">
  <span class="h1"><a href="<%- url_for(theme.links_url) %>"><%= __('index.links') %></a></span>
  <ul class="link-list">
    <% for(var obj in site.data.links){ %>
      <li class="link-item">
        <a href="<%= site.data.links[obj].url %>"><%= site.data.links[obj].name %></a>: <%- markdown(site.data.links[obj].desc) %>
      </li>
    <% } %>
  </ul>
</section>
<% } %>
  • open /source/css/_partial/index.styl, insert:
.link-list
  padding: 0
  list-style: none

  .link-item
    margin-bottom: 5px
    p
      display: inline
  • open /languages/en.yml (or any language file you are using), insert this line in the index item:

links: Friend Links

  1. Return to the root, build new source/_dada/links.json, insert:
[
    {
       "name":"",
       "url":"",
       "desc":""
    }
]
  1. If you want to add hyperlink to the title in the index page:
  • cd to root file, input command in the terminal:
    hexo new page links

  • open /cactus/_config.yml, insert:
    links_url = /links/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions