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 order is inconsistent #32

Open
amrirasyidi opened this issue Jun 8, 2023 · 7 comments
Open

content order is inconsistent #32

amrirasyidi opened this issue Jun 8, 2023 · 7 comments

Comments

@amrirasyidi
Copy link

The ordering part of the index.html seems to be inconsistent in my end.

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

                          <span class="post-date">
                            {{ page.date | date(format="%Y-%m-%d") }}
                            {% if page.authors %}
                              by {% for author in page.authors %}{{ author }}{% if not loop.last %}, {% endif %}{% endfor %}
                            {% endif %}
                          </span>
                          {{ page.description }}
                        </div>
                      {% endif %}
                    {% endfor %}
                </div>
            {% endblock content %}
        </div>

Sometime when I add | reverse it actually sort the post descendingly by its date (which is I wanted to be), but the other time it is ascending. How to properly sort the posts by its date in descending order?

@Keats
Copy link
Collaborator

Keats commented Jun 8, 2023

How are you sorting the pages in the main section? Eg what's the front-matter of content/_index.md (which is not present in this repo, not great).

@amrirasyidi
Copy link
Author

Hmm. I didn't create a main section, the folder tree of content is almost identical from what I got in this repo.

I initially want to create 3 sections, blog, about, and categories, but it seems I got the same problem as this. That is why, currently I added a new front-matter in my posts, front_page (boolean) to decide which posts (page.md) to show in the landing page.

So in my web, now about is just another post instead of a dedicated section with a post inside it.

Do you have a suggestion how should I create sections (the foldering) and make it work? e.g. what script should I add/edit in which file.

And when you say "(which is not present in this repo, not great)", do you mean, my repo, or this hyde repo? 😅

And, thanks for the response btw 🥂

@Keats
Copy link
Collaborator

Keats commented Jun 9, 2023

this hyde repo

This repo, the hyde one. It should have a working example and an updated README, I'll do that tonight if I remember.

For this theme, all the articles in the content/ directory will be essentially the blog post and you can create the about section separately. Categories sound like taxonomies and you should probably use Zola itself rather than creating your own section.

The layout should be something like:

content/
  _index.md
  article.md
  article2.md
  about/
     _index.md

@amrirasyidi
Copy link
Author

I reorganize my web foldering in github, now use a *duplicated submodule to put the hyde folder under themes.

├───content
│   ├───about
│   │       index.md
│   └───blog
│       │   _index.md
│       ├───1_first_post
│       │       index.md
│       ├───2_second_post
│       │       index.md
├───sass
├───templates
│   │   about.html
│   └───shortcodes
│           image.html
└───themes
    ├───hyde1
    │   │   ...

I think the ordering issue is fixed now, I don't see the post ordering changes every time I update the file.

But I still have this issue where the index.html shows nothing.
As a side note, I know hyde theme from this website, I see it works just fine.

*I duplicated the original hyde repo, because I adjust some of the file and it requires me to push to the original repo in different branch, I'm not so familiar with submodule, I'm afraid this means a merge request to the hyde master branch, hence I opt for a safer way 🙃
maybe you have advice on this?

@Keats
Copy link
Collaborator

Keats commented Jun 12, 2023

Why are you nesting the blog in content? This theme expects all the articles to be in the root of the folder so it's normal that nothing is showing. Move all the files/folders from content/blog/ to content/ and it should work.
I've added some docs in #33

@amrirasyidi
Copy link
Author

amrirasyidi commented Jun 13, 2023

ah, I see. It's working now

But now the about is a section, now there will be an extra click to the about page.

├───content
│   └───about
│       │   _index.md
│       └───about
│               image.png
│               index.md

My workaround currently is to add this in the config.toml

[extra]
# Put all your custom variables here
hyde_links = [
    {url = "about/about", name = "About"},
]

I guess this is expected?

@amrirasyidi
Copy link
Author

amrirasyidi commented Jun 13, 2023

Also, I think it is good to add the expected folder tree in the documentation, just like what you said here

"This theme expects all the articles to be in the root of the folder"

probably like this(?)

├───content
│   │   _index.md
│   ├───content_1
│   │       index.md
│   ├───content_2
│   │       index.md
│   └───about
│       │   _index.md
│       └───about
│               index.md
├───sass
├───templates
└───themes
    ├───hyde
    │   │   ...

I opened a pull request for this if you don't mind.

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