Skip to content

New latest post list aproach.#23

Closed
carlosdelfino wants to merge 3 commits intomicro-os-plus:masterfrom
carlosdelfino:latest-articles
Closed

New latest post list aproach.#23
carlosdelfino wants to merge 3 commits intomicro-os-plus:masterfrom
carlosdelfino:latest-articles

Conversation

@carlosdelfino
Copy link
Contributor

@carlosdelfino carlosdelfino commented Nov 11, 2016

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 %}

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
Copy link
Contributor

ilg-ul commented Nov 11, 2016

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
Copy link
Contributor Author

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
Copy link
Contributor

ilg-ul commented Nov 11, 2016

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
Copy link
Contributor Author

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
Copy link
Contributor

ilg-ul commented Nov 11, 2016

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
Copy link
Contributor Author

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
Copy link
Contributor

ilg-ul commented Nov 11, 2016

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
Copy link
Contributor Author

only in lists of posts, no?

@carlosdelfino
Copy link
Contributor Author

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
Copy link
Contributor Author

for page work fine, is need put the parameter:

---
layout: article
hidden: true
---

@ilg-ul
Copy link
Contributor

ilg-ul commented Nov 11, 2016

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
Copy link
Contributor Author

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
Copy link
Contributor Author

@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
Copy link
Contributor

ilg-ul commented Nov 12, 2016

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
Copy link
Contributor Author

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.

The advantage of this approach is the automatic listing on the
respective page when adding new articles. In using the previous model
you had to manually add the list.

Articles that were previously treated as pages are now treated as post,
to differentiate them, the "post" and "articles" layout should be used
respectively.

The old folder "/ page / articles" now only contains the file that
generates an index for listing articles published with the layout of the
same name. The files that were there were moved to the folder "_post /
articles" which are now adjusted for use in this format of posts but
with the aforementioned remarks.

To prevent articles from being listed in the default paigning and on the
/ blog / (old / news /) page, they must be marked with the hidden
parameter that is observed by the pager to prevent publications that
have it as true non-matching.

All other posts should be made as default using the "post" layout.

The files that were in the folder "_post / articles" were moved to
"_post / news" and had the "article" category removed to be used only in
posts that fall into this category.

The file that generates the index page of the blog is now in / pages /
blog to keep the same pattern of page creation.

An algorithm has been added that prevents the news frame from being
displayed when displaying the post listings on the link / blog /.

The parameters in the _config.yml file that change the number of posts
(news) listed have been changed so that you can group by layout used.

Layout articles were created which is nothing more than a default
wrapper.

Also added were two icons with flags of the current languages ​​for
future use and other small changes.
@carlosdelfino
Copy link
Contributor Author

I will make a new branch set for each suggestion.

@carlosdelfino carlosdelfino deleted the latest-articles branch November 29, 2016 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants