Override Date Controls on Homepage Using "Sticky" Functionality


Complexity Level: Advanced

This is an advanced topic. You will need to possess a good understanding of HTML, and have significant experience with Drupal content editing.

Permission Level

Overview

If you want to tell your website to let you designate certain content has more important than others, and the functionality isn't currently there, this document will show you how set that up using the "sticky at the top of lists" checkbox and views/displays.

What is this "sticky" functionality, who can use it and change it

All pieces of content on all of our sites have the "Sticky at the top of lists" checkbox, but in most cases, we aren't making use of it

This document shows you how to make use of this "sticky" checkbox to prioritize content by editing existing lists of content, which are called views and displays. 

Table of Contents


 Understanding Content

Understanding How Content Displays on Your Site

It is important to understand how your site displays content before you set up this functionality. 

Articles as They Appear on News Displays

In this example, I'm going to work with content made with the "Article" content type that appears in News displays.

Let's take a look at how Articles appear on the front page of my site. Your site may be a little different.

Front Page News Areas

The News Spotlight and optional Latest News area (triptych) are two separate blocks designed display Article content.

NEWS SPOTLIGHT
Pulls most recently published, or "authored," Article content. Designated above with a purple "1."

LATEST NEWS (optional)
Optional list of content that shows the three most recently authored news items, starting with the more recent.

Sometimes it begins with the same Article that appears in the Spotlight above, but most of the time we've told it to skip that first item, to avoid redundancy. This is why I've assigned a 2, 3, and 4 to these items.

So total there are four Articles showing on the front page of my site. 

Other Displays Shown

UPCOMING EVENT
Pulls most imminent Event content.

FACULTY SPOTLIGHT
Randomly pulls from Personnel content, usually Faculty. May have additional specificity such as "only pull Faculty who are tagged as 'Core Faculty'"

 Why would I do this?

Make an Article or Event Persistent on the Homepage

Let's say you have a really exciting News Article that you want to remain at the top of your News displays-- maybe the Spotlight, the triptych (collection of three news articles on front page) or the News page itself.

In our example below highlighted in purple, I have just created an Article about a new lecture series featuring important faculty composers/musicians called "New lecture series coming soon." It is appearing in the News Spotlight, which is great. 


Then my well-intentioned colleague came along and published another news Article about Fanny Bullock-Workman's latest book. 

Because her content is newer than mine, and the News Spotlight is designed to show the most recently authored news item, it pushed my Article about the new lecture series out of the News Spotlight.

It still appears in the Latest News block, but I wanted to keep it in the News Spotlight. So how do I make sure it stays there?

Before I show you how to create a developer's solution for this problem, I want you to know that the simplest solution is actually to edit the "authored by" date of my lecture series article.

 Is there an easier way to achieve this desired function?

Read First: The Quick Fix to Keep Article Content at the Top

In the case of an Article, which is always sorted by published date, the quick fix for this is to edit the Article and change the "authored by" date to make it more recent than any other article published.

And that will restore it to the News Spotlight.


But if you don't want to do this all the time, you can configure "sticky at the top of lists" to work for you. So read on.

Warning: Don't test this on a live version of your site

I strongly recommend trying this on a development version of your site first and backing up your live site once you are confident in your ability to implement these changes. Then follow our instructions for backing up your live site on Pantheon.

 What does "sticky" mean?

What is "Sticky" and How Can it Work For You?

In Drupal, "sticky" is a checkbox that allows us prioritize certain content over other content, if the functionality has been set up. 

There are two parts: making content "sticky," and telling the list-- called a view and display-- prioritize the content tagged as "sticky" first.

The ability to set up this functionality is not available to content editors of Franklin sites. You'll have to put in a helpdesk ticket so the web team can set this up for you. It is currently only available to non-Franklin sites using our web service.

Because this requires you to edit the way your site handles content, it is an advanced topic for folks who are not developers. We strongly recommend implementing this on a development version of your site first before you put it on the live production site. As I said, we also recommend you follow our instructions for backing up your live site on Pantheon.

Step 1: Set Your Content as "Sticky"

Let's go ahead and edit our Article about the lecture series so that it has this "sticky" designation.

A. Edit the Article

To the right under the "Published" heading is a series of dropdown options for this content.

B. Expand "Promotion Options"

Look at the bottom for the one called "Promotion Options," and click to expand this.

C. Click "Sticky at the top of lists"

Click "sticky at the top of lists." This won't do anything right now. The steps to make it matter are coming up next.

D. Save

Save your content.

Why not use "promoted to front page"

"Promoted to front page" works just like "sticky at the top of lists" - it has to be set up to work.

Because "sticky" can prioritize any content anywhere, not just the front page, it is my preference as a developer to use "sticky."

Step 2: Prioritize Display of "Sticky" Content

For our example, we want to tell the News Spotlight to prioritize Articles that have "sticky at the top of lists" checked, so our exciting Article "New lecture series coming soon" will remain in the News Spotlight.

A. Find the Display and Click "Edit View"

Go to the front page of your site and find the News Spotlight.

Look for the grey pencil and click it. 

If you have the right permissions, you'll see an "Edit view" option. Click this.

This takes me to a collection of all the News displays on the site. News displays are set to work with the "Article" content type.

Each of the ovals represents a different way Articles are displayed throughout the site.

"News Spotlight 1" is darkened because this is the one that we have selected to work with. On your site, it might simply read "News Spotlight."

Always make sure you are working with the display you expect to be working with. You could end up working on the wrong display, or applying changes to all of the displays very easily. Again, I recommend trying this on a development or test version of your site first.

B. Add to the Sort Criteria

In the left column, look for the "Sort Criteria" heading.

Notice that the only Sort Criteria is "authored on." 

We're going to add "sticky" as a criteria by clicking the "Add" button.

Now we have an "Add sort criteria" screen.

Let's search for "sticky."

Check the one that says "sticky at the top of lists" under the category of content.

Important: Before we apply, we need to make sure we are applying this only to our current display, and not all the other displays also.

In the top left, under "For," change the dropdown from "All displays (except overridden)" to "This block (override)."

Now we are ready to apply this new sort criteria of "sticky at the top of lists."

How hit "Apply (this display)."

If you accidentally "Apply to All Displays..."

If you accidentally "Apply to All Displays," hit cancel on the prompt screen, then hit cancel again at the bottom of the view, and begin again with adding your sort criteria. 

C. Set "Sticky" to Descending

Now we have an additional configuration screen.

Notice the helpful tip about setting the sort order to "descending."

So I'm going to set the order to "descending."

Now I can hit "Apply (this display)."

And my "sticky" sort criteria has been added-- great!

One more thing to do to make sure our "sticky" content appears first.

We need to change the order of the sort criteria and put "sticky" on top.

D. Change the Sort Order

If you click the arrow next to the "Add" button, you'll see an option to rearrange.

Click "rearrange."

By clicking on the plus sign, I can drag to rearrange the order of the sort criteria.

Let's put "sticky at the top of lists" on top so it is the first criteria.

Click "Apply (this display)." Again, make sure you are only applying your changes to the display you are working on. 

Now "sticky at the top of lists" is the first sort criteria, followed by the authored on date.

If I scroll down to the preview area, I see that my special Article, "New lecture series coming soon," once again appears in the News Spotlight. 

E. Save the View

Click "Save" on the News view to make put your changes into effect.

And once again, my article appears in the News Spotlight. 

Another option: "Sticky" as a filter criteria instead of as a sort criteria

Instead of adding "sticky" as a "sort criteria," you could add it as a "filter criteria," indicated in the purple region above.

This means that the News Spotlight will only show Articles that are tagged as "sticky."

The downside of this is you must remember to keep something sticky, or your Spotlight will be empty

So using "sort criteria" instead means that even if there's not a "sticky" Article, it will just show the most recently posted one. 

To add "sticky" as a "filter criteria," Follow the same steps as your would for "Sort criteria", beginning with "Add" under the "filter criteria."

Final thoughts

 Slippery slope: problems that arise when we change the way something works

When you change the functionality of one area of your site, you may find yourself on a path of having to tweak other parts in response to the changes you have made. 

This happens to me all the time, whether I am theming or editing the structure and function of a site. This is why I must think carefully about every change I make as a developer.

Let's take a look at the broader impacts of what we've done in making the News Spotlight show "sticky" items first.

We designated the News Spotlight to show "sticky" content first. This did not effect the filter or sort criteria of the other news display only site, the one that says "Latest News."

It is still showing Articles in the order they are posted, starting with the second most recent, which was the "New lecture series coming soon" story.  

So where was the story that my colleague posted about Fanny Bullock-Workman's new book?

It no longer appears because now none of the News displays are designed to show it. The Latest News block doesn't show it because it used to be redundant to show the most recently posted news Article when it also appeared in the Spotlight. So it only shows recently posted articles 2, 3, and 4.

Now, on the News "page"-- really, it's another view display-- at /news/all, the Fanny Bullock-Workman Article still appears at the top of the list.

Providing additional instructions is beyond the scope of this how-to.

 "Sticky" functionality and other content types

Before you add "sticky" functionality elsewhere, it might be helpful to know how I've sorted other content around the site. 

Personnel

On the spotlight, it is usually random. On pages, alphabetically by last name. 

Events

In all displays, Events appear sorted by imminence; in other words, what is coming up soonest. (Except the "past events" page.) You can choose to filter or sort by "sticky" for the Events spotlight too. 

Courses

Sorted by course number first (like "1101"), then course name (the four digit code, like "ENGL"). 

Research Areas and Labs

Alphabetical by title. 

Slides

I've gone back and forth on this over the years, but as the time of writing this documentation, the slide show randomly chooses 3 slides that are published. So if you don't want a slide to appear, you would unpublish it. 

 A final note: the price of more control

We've designed our sites to do a lot of things automatically, in hopes of keeping your site looking fresh with minimal duplication of effort. The downside is it takes control out of content editors hands. By adding back that control, such as via "sticky," you are giving yourself more work to do as a content editor. You have to remember to check or uncheck "sticky" content. If there are other content editors who share responsibility, you have to communicate with them both your work and intentions to avoid confusion.  

I recommend working with the site's functionality as-is, and focusing on quality of content instead: so accuracy, relevance, clarity. 


Login Assistance

To manage any part of your web site, you will have to be logged into the Drupal CMS.

If you need help logging in, please review this login help document. 


Contact the Franklin OIT Help Desk

Hours of Operation

Monday - Friday

8:00 a.m. - 5:00 p.m.

Website Information

Homepage

http://oit.franklin.uga.edu

Directory

http://oit.franklin.uga.edu/

Service Offerings

IT Services

Systems Status Information

Franklin OIT Status

http://status.franklin.uga.edu/

Receive or Discontinue Status and Service Updates from Franklin OIT

UGA/EITS Systems Status Pages

http://status.uga.edu

https://twitter.com/uga_eits

https://www.facebook.com/uga.eits

USG Systems Status Page

http://status.usg.edu