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

About rendering ejs page #1453

Closed
xinyuwang opened this issue Aug 17, 2015 · 2 comments
Closed

About rendering ejs page #1453

xinyuwang opened this issue Aug 17, 2015 · 2 comments
Labels
bug Something isn't working theme

Comments

@xinyuwang
Copy link

I want to add some static page to show my personal information in my blog. To keep the style consistent, I want to use the layout.ejs just like the index.ejs in my theme. So, I write some ejs file in theme/layout/ but it doesn't work.
If I write some ejs in /theme/layout, should this file be rendered? is that only the special name(e.g. index.ejs, post.ejs) will be rendered? Can I rendering my own ejs file (combined with layout.ejs) by setting some configuration?
I try to use script and Hexo API to render my ejs file, however, it can not combine the layout.ejs.
I am a freshman with Hexo.
Thanks for replying. Wish you a nice day.

@morris821028
Copy link

I not sure what you need.

For example, on default theme landscape without tags.ejs. You can't visited https://hexo.io/hexo-theme-landscape/tags/, but https://hexo.io/hexo-theme-landscape/tags/Bar/ can.

modify theme/landscape/layout/layout.ejs and add page.layout == 'tags'

        <% if (page.layout == '404') { %>
          <%- partial('404') %>
        <% } else if(page.layout == 'page' || page.layout == 'tags') { %>
          <section id="main" style="width: 95%"><%- body %></section>
        <% } else { %>
          <section id="main"><%- body %></section>
          <% if (theme.sidebar && theme.sidebar !== 'bottom'){ %>
            <%- partial('_partial/sidebar', null, {cache: !config.relative_link}) %>
          <% } %>
        <% } %>

also build new file theme/landscape/layout/tags.ejs, maybe like this

<article class="article article-type-post" itemscope="" itemprop="blogPost">
    <div class="article-inner">     
    <header class="article-header">
    <h1 itemprop="name">
      <a class="article-title" href="">Tag Cloud</a>
    </h1>
    </header>   
    <footer class="article-footer"></footer>
        <div class="widget tagcloud">
          <%- tagcloud({'amount': '1024', 'orderby': 'name', 'order': '1', min_font: 14, max_font: 48}) %>
        </div>
    </div>
</article>

then, make new dictionary blog/source/tags/index.md

title: Tags
layout: tags
---

good luck.

@xinyuwang
Copy link
Author

@morris821028 Thanks a lot .

@xinyuwang xinyuwang reopened this Oct 9, 2015
@leesei leesei added bug Something isn't working theme labels Feb 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working theme
Projects
None yet
Development

No branches or pull requests

3 participants