Category Archives: Dynamic Media

Homepage – What does it mean?

Homepage. Home page. Home Page. In every variant of the spelling it is a singular noun. If one must go to the homepage of a corporation or institution you visit the homepage. However, for those of us that work day to day with websites, we often say something along the lines of, “that content is on the homepage.” The thing is, we don’t mean that it is literally on the homepage. We mean it is within the site that has a front door at ***.com.

There must be a better phrase, but those I’ve tried don’t seem to have traction. Home site, the collection of pages and posts, the company site. I believe that homepage is an anachronism of the early web and a better term is needed.

Now, I realize this position is rather thin, especially for small websites. However, as sites grow more complex or there are sites within sites within sites, this becomes important. I work at a university and if a department has a website, they refer to their homepage. That gets confusing as the department site is usually within a college site and homepage which is within the university homepage.

This has certainly been kicking around in my head for several months. Surprisingly, even Wikipedia has a lightweight discussion around the term. I don’t know what the answer is, maybe I just need to accept that homepage can mean many things but I am grasping for a concrete word or phrase that captures the idea of a main web property that exists for a brand.

Pico; WordPress alternative?

My website is powered by Concrete5 and WordPress. I develop professionally sites in Drupal. Now, I am considering migrating my blog and site to Pico. It is an interesting landscape, these “flat-file” CMS systems.  There are a few very exciting looking pay-to-play products, Statamic and Kirby. However, Pico is free, uses an MIT license, and is built by the folks at Dev7 who seem to make nice products, and frankly it looks good out of the box as well.

I am a happy vi user so using a product name pico has a bit of an internal dig built into it. There are several other free flat-file systems out there as well. What I find intriguing about Pico is that it uses the twig template system. The twig system is what powers the themes in Drupal 8 so there is a good chance what I learn in Pico will be applicable to my D8 theme modifications and vice-versa.

What all of these systems use for text entry is Markdown. I am slowly beginning to see the convenience of it though HTML isn’t difficult for me, learning Markdown has been a process. Making lists with an * or headings with ## is quite cool. I’ll be able to adapt.

Pico’s code seems to be fairly stable too. The github issue page is fairly active and folks are making pull requests. This is what makes choosing a new system difficult, trying to answer the question of will it be around in the future? One way to make sure it sticks around is to take the plunge and give it a try.

Deliberating still…

 

Aural interfaces for the masses: What would it look like?

Recently I have been using my Siri like voice command capabilities on my phone. I have an Android based device and I have no idea what it is called but it does the same thing. If I ask, “Where is the nearest restaurant,” it fires up Google Maps and shows me without me having to type that into Google Maps. I know other apps can be context aware but I am curious about how an aural interface would work if you didn’t need to pull up a screen reader, it would just be always on.

When you have a full desktop browser and a mouse this still wouldn’t serve much purpose but if you are on a device without a mouse and you could just say “follow, link title” the browser would find the link titled as such and go there. Another example would be when you are on the page reading text you could say, “scroll down one page,” and the screen would scroll automatically for you. Dragon Naturally Speaking apparently can accommodate much of this.

CSS 3 already has a speech spec that is recommended. That spec is really geared towards implementing an enhanced experience for screen readers but I suspect that if you improve the markup for screen readers it would open up a doorway for use without screen readers as well. This is the classic progressive enhancement win that has been exemplified with each iteration of HTML, CSS, and JS.

Pairing this with future enhancements in eye tracking technology one day we might be able to look at the page and then dictate what we want to do. I think that would be very liberating as a user that is on a computer for 8+ hours a day. Beyond the CSS 3 spec, pages are now often built with ARIA regions that make it very straight-forward to make very robust identification/function for each HTML element.

If anyone is aware of a JS library, technology or stack that accommodates any of the above please let me know. It would be lots of fun to experiment further with this idea.

Zurb responsive tables within Drupal

Responsive tables are a big challenge. Tabular data is often very important and you don’t want to hide the data just to keep the nice responsive design in shape. Currently within Drupal I am not aware of any defacto solutions. I experimented with jQuery Mobile’s technique table reflow, the footable module, and lastly Zurb’s responsive tables.

I had one criteria for a successful solution; my users should not have to do anything to make their table responsive. I did not want them to right click on the table and add a class, I didn’t want them to have to build all of their tables with views, just plop in a ckEditor table and hit save.

A secondary criteria was that the solution should be lightweight since it is primarily to be used by users on mobile devices and we don’t all have 4G LTE in our offices and living rooms as of yet. All of the solutions mentioned above use some sort of CSS hook to indicate that the table needs to become responsive at certain breakpoints. The lightest weight solution for me turned out to be Zurb’s approach.

To automate the insertion in the HTML of a CSS class I turned to the Flexifilter module. Not enough people use this module but what it allows you to do is to create a Drupal input filter, so really an output filter, on anything that is formatted, like your WYSIWYG output.

After enabling the module you need to go to Structure -> Flexifilters -> Add New Flexifilter.

Setting up a flexifilter in Drupal 7.
Configuring a filter.

Inside of a filter you have several options but the Pattern Based Text Replacement widget works with regex. Once a filter is configured, you have to enable it. Once enabled, head over to your text format configuration screen and enable your new filter.

Configuration -> Content Authoring -> Text Formats -> Full HTML. I put the filter as the last item to be ran so that I can ensure the class I want added is actually added.

Enabling a text filter in Drupal 7.
Enable the text filter and place it as the last filter to run.

So now we have a class called responsive being added to tables folks create. How does this help us? We need to leverage Zurb’s great work to answer that. You can grab the source from their GitHub project page. We want two of the files, responsive-tables.css and  responsive-tables.js. You can discard the rest. Place the css file in your theme/css directory and the js file in your theme/js directory.

Open up your theme.info file and tell Drupal about these two new files. In a Zen sub-theme it looks like this:

stylesheets[all][] = css/responsive-tables.css
; Optionally add some JavaScripts to your theme.
scripts[] = js/responsive-tables.js

Next, open up the responsive-tables.js file as we need to wrap it in a Drupal safe closure. At the very top of the file add

(function ($, Drupal, window, document, undefined) {

and at the very bottom add

})(jQuery, Drupal, this, this.document);

This allows the code that the Zurb folks wrote to run without conflict with the other jQuery that Drupal executes. That is pretty much it. Save those files. Go to Structure -> Appearance to reload the info file and your table should now be responsive at small window sizes.

Zurb style responsive table rendered in Drupal 7.20.
Zurb style responsive table in Drupal 7.20.

Image Captions in Drupal 7 – A method

Image captions are supposed are a fairly standard item in a web developer’s toolkit. In a modern CMS they seem to be a given. However, Drupal leaves this to the contrib space, as it should, since each site has different needs. However, the lack of an adopted contrib method for achieving image captions was a bit surprising.

With Drupal 7 the media module is used to handle media. No problem, however it doesn’t do anything to allow for automatic captions to appear. However, it does allow us to show users when they upload an image that an alt tag is a good idea and a title tag can be used. Most auto-caption techniques rely on that title tag to be used as the caption and you show it with a bit of javascript and CSS.

My goal for the end user was to have them get captions for free but have the ability to turn them off. I do not want them to assign a special class for a caption to appear because in my use case, the majority of folks want the captions. However, to disable a caption I want a fairly straight forward method that can be accomplished in the WYSIWYG editor.

To make this work I leveraged several contrib modules and now have it working except it still will not automatically show in the WYSIWYG editor. That last issue seems to be somewhere that improvements can still be made.

Ingredients (List of Modules):

  • Media Module 7-x.1.2
  • Insert
  • Image Caption
  • WYSIWYG with the CKeditor Library
  • HTML Purifier (Not needed if you allow full HTML)
  • Any dependencies of the above modules, i.e. ctools, views, etc…

Configuration:

Go ahead and download the modules and install them on your site whatever your preferred method. You can enable them as well.

Now, most of these modules auto-configure themselves. For this example we will use the basic page content type but add an image field.

Basic Page content type
Basic page content type configuration screen.

Notice that we use the image widget which is augmented via the media module. The next screen we need to edit is the images field. Make sure to check the Enable Alt field and Enable Title field.

The alt and title field checkboxes are checked.
Don’t forget to enable the alt and title fields.

Right below those check boxes, if you have the Insert module enabled you will see a collapsed field labeled insert. Expand it. Check the Enable Insert button check box. Choose the styles you want to make available to your users. Add the word “caption” without the quotes to the Additional CSS Classes text field. This will add the caption class to every image inserted into your nodes. This makes the caption magic happen automatically, as long as you fill out the title field with each image, because the image caption module looks for the class caption on all images.

The insert configuration screen.
Enable the insert button, choose some styles, and add caption to the classes field.

Make sure you have the image caption module enabled and let’s make a new test node.

Go to Content -> Add Content -> Basic Page and title your new node to test the image caption.

Then go down to your image field and upload a new image or graphic. Fill in the alt field and the in the title field add the text you want for your caption. Click the insert button near the style dropdown menu and the image appears in your post.

An image field being configured in Drupal 7.

Now, click the preview button and you will see the caption appear beneath your image. Styling the caption class is up to you.

 

A picture of the author with a caption below.
Look ma’ a caption!

Fairly awesome.

Why this approach:

OK, so why did I decide to do it this way? There are a few other modules, notably jCaption. You could also make each image a node and then attach a caption field to the image. That approach seemed unrealistic as then I would have to easily allow authors to import nodes, into their post in an easy manner. However, the author would have to create at a minimum two nodes/entities just to create a page with one image. That doesn’t entice many people.

jCaption looks interesting except that you cannot turn off captions. Anything with a title attribute gets a caption. Sometimes, captions are not appropriate but people still want the contents of the title attribute to appear on mouseover. With the image caption module because the caption is controlled by a class, the user can edit the image in their WYSIWYG editor and remove the class. In the next image you can see the caption class has been removed, meaning no caption will appear. This gives control to the page creators which is a fundamental goal of CMS.

The advanced property screen of the CKeditor image window.
No caption class means no caption accompanying the image.

Improvements:

I am happy with this approach except for the fact that users cannot see the captions directly in the WYSIWYG. It would be fantastic if that were possible and it will require more research. Since the caption appears because of jQuery we would have to utilize a drupal behavior to fire whenever an image is inserted and then with ajax save the state of the page and add in the caption. It sounds messy.

I wish there was an easier way for users to disable the caption as well. It is not hard to go into the properties of an image but it would be great if they could just click the image and remove the caption class via a dropdown menu or contextual editor.

Overall:

This seems to be a robust approach that helps the user by minimizing the knowledge and time needed to add captions. I need to find a good way to alert them of how to remove a caption, but I am hopeful for the use of this technique.