GetPublii / Publii

The most intuitive Static Site CMS designed for SEO-optimized and privacy-focused websites.
https://getpublii.com
GNU General Public License v3.0
6.06k stars 407 forks source link

Order by priority: &orderby=" @config.custom.position #1391

Closed georgkaser closed 4 months ago

georgkaser commented 4 months ago

Question

Hi, I am wonder if it's possible to sort the posts by priority adding a custom text field for give the posts a priority number:

{{#getPostsByTags (concatenate "count=10&allowed=published&tag_as=id" "&excluded_status=hidden" "&tags=" id "&orderby=" @config.custom.position "&ordering=asc")}}

It's not working, what I am doing wrong?

bobmitro commented 4 months ago

What value does the position option return? Note that the orderby param only supports the following values: publishedAt and modifiedAt.

georgkaser commented 4 months ago

It's a text value. Can be a number or alphabet (a,b,c..).

image

I am a web developer since 2005 and I know from my experience, that my customers are asking me to sort posts (articles) by their order priority. It must be possible. Maybe I can do it with this custom helpers?

bobmitro commented 4 months ago

Not now, but most likely, we'll add it in an upcoming Publii release (in a few days).

georgkaser commented 4 months ago

Wow, cool - thank you. Please add it as a number field.

I love your phantastic CMS - thank you for your great work. You will hear from me again with some money.

dziudek commented 4 months ago

In v.0.45 the syntax like orderby=customField&customField=xyz&compareLanguage=fr will be allowed in the {{getPostsByTags}}