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

Content is not being indexed #18

Open
sameyepatch opened this issue Jan 14, 2019 · 4 comments
Open

Content is not being indexed #18

sameyepatch opened this issue Jan 14, 2019 · 4 comments

Comments

@sameyepatch
Copy link

sameyepatch commented Jan 14, 2019

I'm probably too stupid to figure this out but my content is not being shown in index.html.

This is what my built index file looks like:

<!DOCTYPE html>
<html lang="en">
    <head>
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">

      <!-- Enable responsiveness on mobile devices-->
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

      <title>Night Terrors</title>

      <!-- CSS -->
      <link rel="stylesheet" href="http:&#x2F;&#x2F;127.0.0.1:1111&#x2F;print.css" media="print">
      <link rel="stylesheet" href="http:&#x2F;&#x2F;127.0.0.1:1111&#x2F;poole.css">
      <link rel="stylesheet" href="http:&#x2F;&#x2F;127.0.0.1:1111&#x2F;hyde.css">
      <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">

      
        <link rel="alternate" type="application/rss+xml" title="RSS" href="http:&#x2F;&#x2F;127.0.0.1:1111&#x2F;rss.xml">
      

      
      
    </head>

    <body class="theme-base-sb ">
        
            <div class="sidebar">
                <div class="container sidebar-sticky">
                    <div class="sidebar-about">
                        
                            <a href="http:&#x2F;&#x2F;127.0.0.1:1111"><h1>Blog title</h1></a>
                            
                            <p class="lead">Blog description</p>
                            
                        
                    </div>

                    <ul class="sidebar-nav">
                        
                        
                        <li class="sidebar-nav-item"><a href="&#x2F;">Home</a></li>
                        
                        <li class="sidebar-nav-item"><a href="&#x2F;about">About</a></li>
                        
                        <li class="sidebar-nav-item"><a href="https:&#x2F;&#x2F;twitter.com">Twitter</a></li>
                        
                        <li class="sidebar-nav-item"><a href="https:&#x2F;&#x2F;t.me&#x2F;telegram">Telegram channel</a></li>
                        
                        
                    </ul>
                </div>
            </div>
        

        <div class="content container">
            
                <div class="posts">
                    
                </div>
            
        </div>

    <script src="/livereload.js?port=1024&mindelay=10"></script></body>

</html>

As you can see, the posts container doesn't show anything. I have:

  • Compared them to this repo's example posts, which only feature the title and date in their front-matter
  • Checked that my posts don't have a draft = true setting
  • Set the _index.md with template = "index.html" manually
  • Set each post with template = "page.html" manually
  • Copied the templates from the theme to the main template folder (which I don't think it's necessary, still didn't work)
  • Checked the post pages manually and they load correctly

Finally, the zola serve command acts like nothing is happening, it only warns me if I don't set the front-matter correctly.

This theme doesn't support sections (which the README file doesn't specify, by the way) and what is bugging me but I'm not sure is the root cause for this is that the index.html template have this {% for page in section.pages | reverse %} thing but, again, the theme doesn't support sections, so am I onto something or am I interpreting this wrong?

<div class="content container">
            {% block content %}
                <div class="posts">
                    {% for page in section.pages | reverse %}
                      <div class="post">
                        <h1 class="post-title">
                          <a href="{{ page.permalink }}">
                            {{ page.title }}
                          </a>
                        </h1>

                        <span class="post-date">{{ page.date | date(format="%Y-%m-%d") }}</span>
                      </div>
                    {% endfor %}
                </div>
            {% endblock content %}
</div>
@Keats
Copy link
Collaborator

Keats commented Jan 14, 2019

The index is a section, one that is automatically built even if you don't set a _index.md file at the root of the content folder.
It looks like it might be an issue with extending templates, can you show the full index.html?

@sameyepatch
Copy link
Author

sameyepatch commented Jan 14, 2019

You mean the full index template? Because above is the full index.html that zola build created. The one without content.

EDIT: Sorry for the delay, this is the full index.html template

<!DOCTYPE html>
<html lang="en">
    <head>
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">

      <!-- Enable responsiveness on mobile devices-->
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

      <title>{% block title %}{{ config.title }}{% endblock title %}</title>

      <!-- CSS -->
      <link rel="stylesheet" href="{{ get_url(path="print.css", trailing_slash=false) }}" media="print">
      <link rel="stylesheet" href="{{ get_url(path="poole.css", trailing_slash=false) }}">
      <link rel="stylesheet" href="{{ get_url(path="hyde.css", trailing_slash=false) }}">
      <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">

      {% if config.generate_rss %}
        <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml", trailing_slash=false) }}">
      {% endif %}

      {% block extra_head %}
      {% endblock extra_head %}
    </head>

    <body class="{{ config.extra.hyde_theme }} {% if config.extra.hyde_reverse %}layout-reverse{% endif %}">
        {% block sidebar %}
            <div class="sidebar">
                <div class="container {% if config.extra.hyde_sticky %}sidebar-sticky{% endif %}">
                    <div class="sidebar-about">
                        {% block sidebar_about %}
                            <a href="{{ config.base_url }}"><h1>{{ config.title }}</h1></a>
                            {% if config.description %}
                            <p class="lead">{{config.description}}</p>
                            {% endif %}
                        {% endblock sidebar_about %}
                    </div>

                    <ul class="sidebar-nav">
                        {% block sidebar_nav %}
                        {% for link in config.extra.hyde_links %}
                        <li class="sidebar-nav-item"><a href="{{link.url}}">{{link.name}}</a></li>
                        {% endfor %}
                        {% endblock sidebar_nav %}
                    </ul>
                </div>
            </div>
        {% endblock sidebar %}

        <div class="content container">
            {% block content %}
                <div class="posts">
                    {% for page in section.pages | reverse %}
                      <div class="post">
                        <h1 class="post-title">
                          <a href="{{ page.permalink }}">
                            {{ page.title }}
                          </a>
                        </h1>

                        <span class="post-date">{{ page.date | date(format="%Y-%m-%d") }}</span>
                      </div>
                    {% endfor %}
                </div>
            {% endblock content %}
        </div>

    </body>

</html>

@WaffleLapkin
Copy link

I've encountered a similar issue (no posts showing). After some testing, I've found out that it's caused by having paginate_by = 6 in the front matter of the _index.md.

@Keats
Copy link
Collaborator

Keats commented Jul 9, 2021

Paginated templates are different from non-paginated in terms of where the variables are yes: https://www.getzola.org/documentation/templates/pagination/

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

3 participants