Since the default Drupal home page is actually hard-coded as is in Drupal, it will have to be replaced before preceding. Fortunately Views module makes this extremely simple: it comes with a premade “Frontpage” view, which exactly duplicates the default Drupal front page (except with Views, it is completely flexible and simple to customize).
Note: this technique can also be used to manually reorder the content of “any” View, including custom Views you create yourself, and on any page (not just the front page).
Optional (for enhanced Rules version):
Set up a Front nodequeue
- Begin by going to Administer > Content management > Nodequeue (admin/content/nodequeue), and create a new Nodequeue called
Front(you can choose another name if you prefer). Set the Queue size to 0 (infinite), and check the
Reverse in admin viewoption.
- Choose the Content Types you want to be able to include in the Nodequeue (this would include all types you want it to be possible to have shown on the front page). Click the “Submit” button to proceed.
Choose between Triggers/Actions or the Rules module
Important: the default Trigger/Actions module that comes with Drupal 6 core is relatively basic and while it can specify and execute a a variety of Triggers and Actions, it is limited in how specific they can be and what actions they can perform. For more complex functionality, you will need the Rules module. Before proceeding, you should decide ahead of time which to use, based on the functionality you need.
In general, Trigger module cannot specify which Content types it will act on (it acts on “all nodes” of every type), however in this case the fact that the “Front” Nodequeue will only accept nodes from the type(s) you selected when you made it, will effectively filter it to only the Content type(s) you want included (the Action will try to add nodes of all Content types to the queue, but only those types you specified in the Nodequeue will be accepted). In other cases (when Nodequeue is not involved) you may not have this benefit to rely on, and will have to use Rules module. Also Rules module offers substantially more options and functionality if you need it.
If Trigger/Actions is sufficient then proceed with the next step. If not, then skip on to the Rules method.
Method using Trigger/Actions
Use this method if Trigger/Actions is powerful enough for your needs. Unless you have more advanced requirements, this method should be fine.
Set up an Action
- Go to Administer > Site configuration > Actions (admin/settings/actions). Click the “Make a new advanced action available” select box near the bottom and choose
Add to nodequeues. Click the “Create” button.
- Change the Description field to
Add to the Front nodequeue(it’s best to customize the Action name so you can easily identify the Action later on). Choose the
Frontnodequeue from the Queue option.
Create a Trigger
- Go to Administer > Site building > Triggers (admin/build/trigger). In the Trigger: After saving a new post fieldset, click the Choose an action select box, and choose the
Add to Front nodequeueoption.
- Click the “Assign” button to create the Trigger.
Create sample content
Now create one more more sample nodes of the Content type(s) that are included in the Front Nodequeue. You can also try making a node of a different type to confirm that it does “not” get added to the queue. You can look at the content of the queue, and adjust the order of nodes in the queue by going to Administer > Content management > Nodequeue (admin/content/nodequeue) and clicking the “View” link next to the Front queue.
Next skip ahead past the Rules method step below, to learn how to set up the Frontpage view.
Method using (more powerful) Rules module
Set up the Frontpage view
- Go to Administer > Site building > Views (admin/build/views) and scroll down the list to find the frontpage default view. Click the “Enable” link, and after the page reloads, again locate the frontpage view in the list. Now however it is no longer grayed out and includes an options to Edit, Export, and Clone the view. Click the “Edit” link.
- Click the + icon on the Relationships settings box. From the Groups select box, choose
Nodequeueto filter the list down. Check the
Nodequeue: Queueoption, and click “Add”.
- For the Label, enter
Front queue. Check the
Require this relationshipoption and the
Limit to one or more queuesoption. In the Queues option that appears, choose the
Frontnodequeue. Click the “Update” button.
- Proceed to the Sort criteria settings box. Click on the “Node: Post date” link and click the “Remove” button (since the list will no longer be sorted by date but rather by the order you’ve set in the Front nodequeue). If you’d like you can also remove the “Node: Sticky” sort criteria as well.
- Still in the Sort criteria settings box, click the + icon. From the Groups select box, choose
Nodequeueto filter the list down. Check the
Nodequeue: Positionoption, and click “Add”. Ensure that the
Front queueis selected for the Relationship, set Sort order to
Descending, and click “Update”.
- Since you are deciding what goes on the Front page based on its presence in the Nodequeue and not the Promoted to front page setting (which is the default way to send nodes to the front page), you may want to remove this filter (which otherwise might cause an unwanted side-effect of filtering out nodes you wanted added to the queue, if their Promoted to front page setting was not checked). Go to the Filters settings box, and click on “Node: Promoted to front page”. Click the “Remove” button to remove this filter from the View.
- Click the “Save” button at the bottom of the Views UI to save your customizations to the View.
Set the frontpage view as your site’s front page
- Go to Administer > Site configuration > Site information (admin/settings/site-information) and in the Default front page option, enter
frontpage(which is the URL of the frontpage View). Click “Save configuration”.
- Visit your site’s front page, and you will see that is has been swapped with the one you set up in Views, now fully under the power of your Front Nodequeue to sort and reorder in any way you prefer.
- Your Front Nodequeue won’t include anything yet other than your test nodes, though all future content (of the appropriate types) will be added automatically. If you need to add many pre-existing nodes to the queue, Views Bulk Operations module should be able to help. Install the module, then edit the admin_content View which it creates. In the Basic settings box, click the “gear” icon next to Style: Bulk Operations. Under Selected operations, you will be presented with a list of bulk operations to include. A specific option is already available by default for your own Nodequeues: check the box for
Add to the Front nodequeue, and click the “Update” button.
You may also want to adjust the Items per page option to a higher number so you can process more results at a time. Save the View and the proceed to the URL admin/content/node2. The option to add selected nodes to the Front nodequeue is now available. Set the Promoted filter option to Yes and you will get a list of nodes that have their Promoted to front page option checked. Click the top left checkbox to select them all, and then add them all to the Front nodequeue.
Manually add content or rearrange your Front nodequeue
- Though your new content will automatically appear in the queue now, at any time you can visit Administer > Content management > Nodequeue (admin/content/nodequeue) and click the “View” link next to the Front nodequeue, to manually add more nodes to the queue (using the Select title to add autocomplete field). You can also add content to the Front nodequeue at any time while viewing a node on your site and clicking the Nodequeue tab, which now shows above nodes that belong to the Content types you’ve approved for inclusion in the queue.
- Here you can also rearrange the order of the queue’s content by clicking the arrow icons next to each item in the queue. Remember to click “Save” after adjusting the order to your preference.