Disable particular views in Dynamic Views Blogs

Or: So, how do I hide some views from the dropdown in Dynamic Views blogs?

Dynamic Views templates on Blogger are rendered client-side and designed to allow the user to select the way in which they want to view the blog. Some views are more appropriate than others though, so it would be good if there was a setting for which views to enable.

Alas, we can hack in a little workaround in a couple of ways.

Hide menu items with custom CSS

Custom CSS can be added to your blog under Template => Customise => Advanced => Add CSS.

Dialog for adding custom CSS to your blog

In this dialog, add a display: none!important; style for any items you want to hide.

li.Magazine {
  display: none!important;
Custom CSS for hiding the 'Magazine' view menu item.

Comma separate the li.ItemName CSS selectors for all the items you want; the class names all match the text of the menu item.

Hide menu items with template CSS

The alternative option is to paste the same CSS in a <style class='singleton-element'> element in the head of your template. Dynamic Views doesn't strip out any CSS which lives in a style element with the class 'singleton-element'.

<style class='singleton-element'>
  li.Timeslide {
    display: none!important;
Template style element for hiding the 'Magazine' view menu item

You can modify your templates HTML in the menu Template => Edit HTML.

Set the default view

In your template, there's a variable in the <b:skin> element which defines the default view loaded by Dynamic Views blogs. Search for "blitzview" and you should see something similar to this:

<Variable name="blitzview" description="Initial view type"
          type="automatic" default="sidebar" value="sidebar"/>

Change the 'value' attribute to the view you want (e.g. magazine, timeslide) and it should load that view first!

Happy Blogging!



Post a comment

Popular posts from this blog

Add syntax highlighting to my Blog

Change my post timestamps to a custom format

Add snippets to the Emporio theme