Featured post (semi brute-force)

Hey guys,

I found a way to make pages to be “featured.” That is, post or groups of
post that will remain atop the rest. It’s a semi brute force approach
requires access to the DB; however an incremental step nonetheless.

  1. add a column to the pages table called featured. It should be of type
    TINYINT(1), UNSIGNED_ZERO_FILL, not null and zero as default.
  2. change the featured value to 1 to any of the posts (or the one you
    to feature).
  3. Go to your admin interface.
  4. In the pages listing click on the “root” page.
  5. change the tag that highlights the first post to read
    limit=“x” by=“featured” order=“desc”> where x is the number of featured
    pages you want.
  6. Then you can change the “rest” of page listings tag to read
    <r:children:each limit=“y” order=“desc”> where y is the number of
    non-featured pages you want.
  7. Save and then clear your page cache (if you’re in production mode).

Now, I’m well aware that it is a rather rudimentary solution…and it
to be added either as a behavior or as a checkbox in the admin
interface…not sure which one would be easier. Also, you might
choose to use rake DB migrations instead of using command
line/PhpMyAdmin to
modify your DB schema.

Any and all input/help is highly appreciated.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs