Another Site Update

Posted on

Well, recently I’ve been trying to learn how to use SASS for styling Web pages and have kind of fallen in love with it. So here is my first go at it in the form of a new site template. Not much has changed visually, but, trust me, there have been a ton of changes behind the scenes. I will post more about this and the trials of retrofitting a Drupal theme for SASS sometime in the near future. In the meantime, look at the neat comments buttons I made!

Drupal, Pathologic and Corrupted URLs

Posted on

I’ve been having some technincal issues with this site lately. Strange links to content within the site have been appearing at random. I would insert a hyperlink to an archived post and then, days later, I would come back to see that the URL has been rewritten with a random sub-domain prefix. My domain would appear as www.wqw.robertgomez.org or similar.

I am not entirely sure what was going on but I think bots and the Drupal Pathologic module are to blame. Pathologic is a great module that will convert any internal site link into a standardized absolute URL. In my code I would create a link with an href of “node/1098” and Pathologic would convert that href to “http://www.robertgomez.org/blog/2014/03/17/drupal-my-list-essential-modules”. However, I suspect that when various bots crawled my site they used weird sub-domain prefixes in hopes of doing… I don’t know what?! Occasionally, one of these bots must have triggered a cron job, and my links were rewritten with the phony sub-domain. Seems feasible, right? If there is a real reason why this was happening, let me know in the comments.

The bad links could be fixed by opening a node and re-saving them. I used the Resave Nodes module to bulk save everything again. However, by the next morning the bad links had returned. The phony sub-domains were still being crawled. The next step was to use a rewrite rule in my .htaccess file that would force all subdomain traffic to a non “www” prefixed URL of the site. I then re-resaved everything, an so far thing are back to normal. Again, if you know what’s going on, shoot me a comment.

Drupal: My List of Essential Modules

Posted on

Taking a break from my usual and completely unnecessary review posts, I thought I’d take a moment get a little technical. This site and many others I have developed use the Drupal open-sourced content management system. Drupal is great. It’s incredibly flexible, powerful and yet moderately easy to use if you have a little Web design experience.

Other systems I have used in the past, including Microsoft Sharepoint and WordPress, don’t hold a candle to Drupal. Sharepoint is an abomination and the only reason you should ever use it for a public facing Web site is if you work at Megacorp, Inc. and some idiot I.T. guy bought it as part of a multi-million dollar corporate enterprise package. Customizing Sharepoint is an exercise in futility and self-immolation. Just assume that your clean standards-compliant code with get destroyed and converted into a stew of redundant tags and impossible-to-style markup. WordPress is much better than that but it still falls short of Drupal when it comes to customizing your content types and controlling look and feel. You can hardly do anything custom in WordPress without having to hand code PHP. Simple tasks like adding an extra field to a post-type are just a pain and require some sort of third-party plugin (of which there are many and all of them do it differently). The only area where WordPress is better than Drupal is in installing and updating plugins and core systems. Drupal is getting better at this, but it still has a way to go to match the ease of use that WordPress offers.

For all my Drupal love, it still isn’t perfect right out of the box. Any Drupal install is going to require also installing a number of add-on modules to get your site fully reach its potential. So here is a list of the modules that I will include in every Drupal site that I create.

Views

Views is the reason you are using Drupal. It allows you to build custom pages, feeds, blocks, etc. based on specific database queries. There is nothing like this for WordPress. You want a page of only posts created in June with the word summer in the body? A list of recent comments? A slideshow of art from posts tagged NSFW? Boom, Views can do that and sort it, make it filterable, restrict access… almost anything you can think of. Views puts you in control of your database. Installing views in Drupal 7 also requires the Chaos Tools Suite, so consider that an essential module too.

Administration Menu

This module puts a thin flyout-menu at the top of all pages that will quickly allow editors and admins to perform tasks without having to click down through multiple pages of admin content. The default Drupal 7 toolbar plus shortcuts is pretty close to providing this functionality but Admin Menu just does it so much better.

Module Filter

Module Filter is like Admin Menu in that it takes a core system interface and makes it just a bit more user friendly. In this case it tames the often over-long list of add on modules. During the development stage of any Drupal site, this saves you a ton of time scrolling and searching that page.

Backup and Migrate

This module has saved me many-a-time. It provides a way to backup your site’s data via a simple Web interface. You can also set schedules for daily backups and you automatically backup to the cloud if you so desire. It is also the easy way to get a site from a test environment to the live server.

Wysiwyg

The main thing that turned me off about Drupal when I first started using it was the lack of any sort of visual text editor when creating content. You still needed to know HTML to style anything. This problem is easily solved with the Wysiwyg module and another third-party visual editing library (in my case I use TinyMCE). The need for a library kinda makes this module a pain to install, but, once you get it up and running, composing posts becomes much easier especially for non-technical users.

IMCE

IMCE also fulfills a very basic editing need that the Drupal core lacks. It allows users to upload and embed images into the body area of their posts via a pop-up file browser. It integrates smoothly into your visual Wysiwyg editor by also installing the IMCE Wysiwyg bridge module.

Read More Control

A final basic Web design flaw with the Drupal core is that it places a truncated post’s Read More link way below where a user might actually notice it. Read More Control brings it back where it should be, within the text of the post’s teaser content.

Menu Block

The default main menu of Drupal is okay, but it is limited in that doesn’t easily let you create CSS flyouts or create sub menus in the sidebar as you dig deeper into the site. Menu block provides you with a highly customizable way to display menus whereever you want.

Pathauto

Pathauto is one of those modules (like views) that really just needs to be part of the core. It gives developers a way to create custom URL aliases based on all sorts of variables (using Tokens… see below). I typically use it to fake an organized directory structure to my sites. And, unlike WordPress’s path customization, it can be as general or specific as you like and doesn’t need to be based on dates or content IDs. 

Menu Position

This module is the second half of my strategy to get my sites to follow a psuedo-directory structure. It allows you to create rules that will make a particular set of content nodes appear as though they exist within a menu structure without having to individually assign each item to the menu tree.

Token

Token is a behind the scenes module that provides a way for Drupal and other modules to use simple placeholders to output small bits of text like post titles, fields, tags, dates, etc.

Honorable Mentions

There are a few more modules which I install most of the time but are not really essential in the way I believe the proceeding are. These include: DateField GroupCaptchaWebformColorboxEntity and Libraries. Follow the links for more information.

Upgrading to Drupal 7

Posted on

Well, I’ve finally decided to upgrade this site to the latest verison of Drupal. The actual process of migrating to version 7 wasn’t too bad. The majority of issues came from Views and fields not being named or typed the same way they were in Drupal 6. Changing all the views by hand was not that difficult and it allowed me to do a bit of how cleaning withing views. Views in Drupal 7 is sooooo much better!

The biggest challenge has been recreating the site’s theme. Although the general look and feel is more or less the same as before, I have made some visual tweaks here and there. The biggest change has been the fly-out menu and the switch to a responsive, mobile-friendly layout. I’m still working on getting that finished, but for the most part the site looks good on just about any size viewport.

The only downside to the switch to Drupal 7 is that my host, MediaTemple’s Gridserver, has performance issues with the new system. There are a couple of tweaks that help, mainly changing references within the database file from “Innodb” to “MyISAM.” I have no idea what this does, but it helps keep the database from freezing up and timing out on the Gridserver.

Dummy Image Bookmarklet

Posted on

This afternoon I came up with a handy little bookmarklet (or favlet) that uses the site dummyimage.com to create a place holder graphic. Simply drag the following link to the button bar of your browser:

Dummy Image

Here’s the code:

<a href="javascript:var q=window.prompt('Dimensions XxY (for example 640x480)');if(q){void(window.open('http://dummyimage.com/'+q))}else{void(0);};">Dummy Image</a>

When you click the bookmark it will prompt you to input image dimensions. Use the format, WIDTHxHEIGHT (for example 640×480) and a new window should open up with a downloadable GIF with those exact dimensions.

Adobe Contribute Is No Longer My Friend

Posted on

I have a bit of a love/hate relationship with Adobe. Some of their products are great’Photoshop is a verb these days for good reason’but, they have also released some of the most disappointing software I have ever used. Encore, their DVD authoring program, will crash anytime you try to do anything with even a moderate degree of complexity. Dreamweaver will give you cryptic JavaScript errors out of the blue, when you are not actively editing anything. Heck, everyone knows Acrobat is a bloated resource hog.

Back in the early 00’s, Macromedia Contribute was a great idea. Give web developers a cheap (Contribute 1 & 2 sold for around $60-$80 bucks) WYSIWYG web editor to give to their clients who may not be comfortable with the destructive power of Dreamweaver. Sure, it didn’t quite render CSS right, but nothing really did at the time. Contribute just worked and filled a niche.

Fast forward to 2010. Macromedia is no more. Adobe has been trying to integrate all of their products into interoperable “creative suites” of programs. In theory this seems good. I like being able to dump files from one application to another without any hassles. Unfortunately, this makes the world of Adobe a bit like Melrose Place, where you don’t know who’s sleeping with who and Acrobat has given half the cast an embarrasing, throbbing rash.

These days, my clients who are using Contribute to edit sites I created for them are plagued with cryptic errors and equally cryptic workarounds. For example, one of my sites will not allow users to center text of all things. Another site gives you errors when you try to type in a repeating region. Other users have connection issues all the time. On top of all this pain, Adobe now charges something like $190 bucks for a single license. Sorry, Contribute. But friends we can be no more.