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

Sections are displayed sorted on title #40

Closed
le4ker opened this issue Nov 2, 2015 · 9 comments
Closed

Sections are displayed sorted on title #40

le4ker opened this issue Nov 2, 2015 · 9 comments
Assignees
Labels
Milestone

Comments

@le4ker
Copy link
Owner

le4ker commented Nov 2, 2015

Reported by @chipset95 .

@le4ker le4ker added the bug label Nov 2, 2015
@le4ker le4ker self-assigned this Nov 3, 2015
@le4ker
Copy link
Owner Author

le4ker commented Nov 9, 2015

@chipset95 actually I had a look at the code and the sections are hardcoded, and the navigation bar is not sorted on section tile (I fixed that actually after I forked the timeline repository).

So if someone wants to change the order of the section, he/she has to edit the includes/index.html, which is reasonable given that this the intention is by definition a hard change in the theme 😄

I'm closing this issue.

@le4ker le4ker closed this as completed Nov 9, 2015
@kartikarora
Copy link
Contributor

I didn't get it. There is no index.html in includes. Also, where are the sections being hardcoded?

@le4ker
Copy link
Owner Author

le4ker commented Nov 9, 2015

My bad, it's the index.html layout 😄

@kartikarora
Copy link
Contributor

I've tried changing the order in _layouts/index.html But the order remains to be About, Blog, Career, Contact.

Just tried it again.

@le4ker
Copy link
Owner Author

le4ker commented Nov 9, 2015

You mean that the order in the navigation bard remained the same?

The navigation bar is ordered based on the order that the list in the _config.yml is declared.

@kartikarora
Copy link
Contributor

I'm able to change the order in the navigation bar from _config.yml, but I want to change the order in index.html to match the order in navigation bar.

I have this in index.html under layouts right now

<!-- Index Layout Start -->

<!DOCTYPE html>
<html lang="{{ site.lang }}">

  {% include head.html %}

  <body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">

    {% include navigation.html %}

    {% include header.html %}

    {% for page in site.pages %}

      {% if page.section-type == "about" %}

        {% include about.html %}

      {% elsif page.section-type == "work" %}

        {% include work.html %}

      {% elsif page.section-type == "contact" %}

        {% include contact.html %}

      {% elsif page.section-type == "latest-post" %}

        {% include latest-post.html %}

      {% endif %}

    {% endfor %}

    {% include footer.html %}

    {% include js.html %}

  </body>
</html>

<!-- Index Layout End -->

And the result of this can be seen here

@le4ker
Copy link
Owner Author

le4ker commented Nov 10, 2015

I see. Yes it makes sense, given that they are being rendered based on the order that they exist in the site.pages.

We should be smarter, I think we should iterate over the navigation items, given that each section should anyway be listed in the navigation bar 😄

Re-opening the issue as a bug.

@le4ker le4ker reopened this Nov 10, 2015
@joariasl
Copy link
Collaborator

Exists a problem obtain each page if not use {% for page in site.pages %}
I intent obtain the _include file using:

    {% for p in site.pages_list %}
      {% if p == "blog" %}
        {% include latest-post.html %}
      {% else %}
        {% include about.html %}
      {% endif %}
    {% endfor %}

But I do not know as obtain the specific content for the page (for example in about.html in the root path).

The Blogs item is different to the file name, because I added an exeption:

Pages in Home:
'about' => about.html
'blog' => latest-post.html (X)
'career' => career.html
'contact' => contact.html

I don't know many YAML. ¿Any idea for solve this?

joariasl added a commit to joariasl/jorgearias.cl that referenced this issue Nov 13, 2015
The content in index.html is now sorted in _config.yml pages_list order.

* Close le4ker#40 issue
* Moved latest-posts to latest-post.html for conflict with blog.html
* Changed the ID in sections for page.section-type
* Subtracted 50 in offset Scrollspy
@joariasl
Copy link
Collaborator

Fixed in my latest pull request #56 with:

    {% for p in site.pages_list %}
      {% for page in site.pages %}
        {% if p[1] == page.section-type%}
          {% include {{ page.path }} %}
        {% endif %}
      {% endfor %}
    {% endfor %}

It is optimizable if the page is directly obtained back to repeat each time. But it works.

I refactored some problems.
The test run: https://www.livecoding.tv/video/personal-jekyll-theme-27/

@le4ker le4ker closed this as completed in d7203ac Nov 14, 2015
le4ker pushed a commit that referenced this issue Nov 14, 2015
Complete refactorization for css/grayscale.scss and sorted sections in index.html Fixes #40 #48 #57
@le4ker le4ker added this to the Version 4.0.0 milestone Nov 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants