Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
YoobinLee opened this issue Oct 13, 2023 · 1 comment
Open

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

YoobinLee opened this issue Oct 13, 2023 · 1 comment

Comments

@YoobinLee
Copy link

YoobinLee commented Oct 13, 2023

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/

@ei5uke
Copy link

ei5uke commented Mar 26, 2024

Correct me if I'm wrong, but looking into your github-pages source code, this should be an implementation for hexo-theme-cactus, not hugo-theme-cactus. Either way, cool addition!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants