micro-os-plus / web-jekyll

The complete Jekyll source for the µOS++ IIIe web site
http://micro-os-plus.github.io
2 stars 7 forks source link

New latest post list aproach. #23

Closed carlosdelfino closed 7 years ago

carlosdelfino commented 7 years ago

What/why?

New latest post list aproach.

Like news list, de post can be listed with a loop.

The ideal is check with post is for list on idex with this code:

{% for post in site.posts limit:latest-articles-pages %}
  {% if post.index %}   
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
  {% endif %}
{% endfor %}
ilg-ul commented 7 years ago

you are right, the latest posts can be listed with your code, but the list of articles is not the latest posts, it is limited to posts in the articles folder.

carlosdelfino commented 7 years ago

Well, we can use Jekyll in our favor in this topic, creating a category "articles" instead of a separate folder.

And use the permalink directive to lock the link.

What do you think?

ilg-ul commented 7 years ago

creating a category "articles" instead of a separate folder

yes, the articles are already in the "articles" category, if you know how to select the latest n, you can experiment and suggest a solution.

carlosdelfino commented 7 years ago

First of all you need to move them from the /pages/articles folder to /_post/article and set the "article" category to be the first in the list, or define a property in yaml header to identify this post diferently. .

I'll do it here and put it on the Branch and I'll send it to you to havaliar when you can.

ilg-ul commented 7 years ago

First of all you need to move them from the /pages/articles folder to /_post/article and set the "article" category to be the first in the list

hmmm... this makes them blog posts, and I would not do it, then we have to take special measures for them not to appear in the list of posts.

we need a method to enumerate pages tagged with the article category, not blog posts.

one possible solution would be a custom liquid tag, implemented in a ruby plug-in, similar to the ones already in use.

but, considering there will be very few articles in the site, I doubt it is worth implementing.

carlosdelfino commented 7 years ago

only a parameter like

article: true

and a if on list blog.post for not list article == true and in article list list article == true

I can care of this.

ilg-ul commented 7 years ago

and a if on list blog.post for not list article

exactly this if is the reason why this solution is not ok, because all references to posts will need it.

carlosdelfino commented 7 years ago

only in lists of posts, no?

carlosdelfino commented 7 years ago

We can take advantage of the layout parameter to use a layout with name article, when it is used, it adopts article behavior and is only list in their places.

If it's a post layout, list it as a plog post.

---
Layout: post
---

or

---
Layout: article
---

And the article layout will be an extension of the page layout.

carlosdelfino commented 7 years ago

for page work fine, is need put the parameter:

---
layout: article
hidden: true
---
ilg-ul commented 7 years ago

I'm no longer able to follow you. please keep in mind that articles are pages, not posts, and should not interfere with posts in any way.

carlosdelfino commented 7 years ago

I understand your point of view, I am considering just that.

I'll give you an example, if it is not in the format that you think is appropriate, it's like an experiment.

I'll release this branch with the example in a moment.

The advantage will be automation simply by creating new articles and they will be listed in the right place. And in the future they can be translated and automatically listed when the site consolidates the translations.

carlosdelfino commented 7 years ago

@ilg-ul When I can please check the suggestion. I made small changes, if you think you need some adjustment, do not forget to tell me what I codify here.

Thanks for the opportunity to contribute.

ilg-ul commented 7 years ago

I checked your patches. I don't know where the flags are displayed, but please use the British flag, not the US one, since my text uses British English.

as for moving articles to posts, I don't understand why we should do it.

generally better submit separate requests for separate issues, to increase the chance of merging them.

carlosdelfino commented 7 years ago

I removed the flags since they will not be used now.

I'll be looking for better flags that have the same format for more languages if other translators emerge.

I justified in the new commit the reason that I see as being appropriate in this change.

I see the articles as a dynamic collection that tends to grow, so the use of posts is better and facilitates your listing and automatic referrals. And I see as a good practice the file lists adopt the post as a template, being categorized and identified by the chosen layout. This gives great possibilities, even for use for example in the User Manual that can be better adapted if in the future do not opt for a tool like GitBook.

carlosdelfino commented 7 years ago

I will make a new branch set for each suggestion.