Pages

Friday, January 28, 2011

Drupal 7 Google Custom Search Engine

As of right now, the Google Custom Search Engine Module is not available for Drupal 7. Now in many people's opinion, Drupal's core search, well in one word, sucks. For me, I am impartial. I like both Drupal's core search and also like the auto-completions and better advertising of the Google Custom Search Engine(CSE). But for those who like using Google's CSE and have taken the plunge into Drupal 7 might have come across an issue with using the code directly from google.com/cse.

The problem that many people have faced with using Google CSE is that when using the iframe look and feel, the search box code uses GET and the variable q to transfer what the user is searching for to the custom page you create with the search results code on it. But the variable q is also used by Drupal, so when your search box redirects to your custom page with the q variable set to the search criteria, Drupal breaks usually saying the page does not exist. But there is a very easy way around this problem.

The solution to the Google CSE problem is to change q in the search box code to as_q. If you go here, you can see that q and as_q do exactly the same thing and Google parses them the same when using it's search. And since Drupal does not use the as_q variable via GET, the search page should work fine.

Here are the exact steps if needed:
1. Set up your Google Custom Search Engine at http://www.google.com/cse
2. In the "Look and Feel" section, select iframe
3. Create a page on your drupal site for the search box to go to, such as site.com/customsearch
4. Using PHP as the input mode, copy and paste the Search results code from the Get Code section
5. Create a new block and using the PHP input mode, copy and paste the Search box code from the Get Code section into the block.
6. Change the line that looks like this document.getElementById('q') to this document.getElementById('as_q')
7. Change the line that looks like this <input autocomplete="off" id="q" name="q" size="31" type="text" /> to this <input autocomplete="off" id="as_q" name="as_q" size="31" type="text" />

Saturday, January 22, 2011

Working with XML-Sitemap and Views

The newest development version of XML-sitemap for Drupal 6 and the released version of XML-sitemap for Drupal 7 both added an easy method to add views with a page display to your xml sitemap. The old method of adding custom links for each view page you create is over since the addition of the xml-sitemap menu module. Even if the view page display is not meant to be shown in any menu on your Drupal page, all you need to do is not show the menu. So it is pretty much a hidden menu, but since you can include the menu still in the xml-sitemap now, all view pages are now listed. So, to recap, here are the directions again:
  1. Create a menu, if you don't want it to show just don't display it on the Blocks admin page
  2. Enable the menu in the XML-sitemap options to be included in the XML sitemap it creates.
  3. When creating a view with a page display, simple add a menu entry to the hidden menu

Friday, January 14, 2011

Meta tags (Nodewords) for Drupal 7 Delayed

It has been some time since Drupal 7 has been officially released on the world but one of the major modules used by many, Nodewords, has been late to the release party. Nodewords has been turned into Meta tags for Drupal 7, which for me I never understood why it wasn't named meta tags in the first place. However, my ramblings about naming conventions still does not help the fact Meta Tags for Drupal 7 has still not been released and is giving webmasters headaches to this very moment.

Now, I know that search engines rarely care anymore for keywords and most meta tags, but that does not stop those who pay the bills for creating the sites wanting the comforting and pleasing feeling that they are there. I believe the only meta tag I really need right now is the description meta tag, as it is used by Google and many other search engines to show a summary of the content on the search page. Without it, search engines just take a random amount of text at the top of the page and that shows up on the search page, which for many articles is incoherent and would be better off changed by the author.

I hope the Meta Tags module comes out soon since for my paid sites I have no choice but to use Drupal 6 if they want to use drupal as that is a feature they all want.

Link: Meta Tags Module Project Page

XML sitemap module for Drupal 7

For all those who are braving the adventure into Drupal 7 and wish to use the xml sitemap module, make sure you use the 7.x-2.x-dev version as the recommended 7.x-2.0-beta1 version does not work. Hopefully, they will get their dev version to beta soon and recommend it because there are a lot of users who are confused as to why the recommended version of the xml sitemap module does not work and simple think that means all versions do not work with Drupal 7.

Link: XML Sitemap Module Project Page

Where to Find the Sitemap for Blogger

I just started this blogger as a way to share some knowledge I gain from developing websites in the hope of helping others. Already, I have found something for this setup as well. What I mean is for Blogger itself. I was trying to find a way in all the settings here on Blogger to set up a sitemap but for some reason its not easy to find, or should I say non-existent. It's funny because Blogger helps set up this site easily in your Google Webmaster Tools, but one of the main tools is submitting a sitemap there. Funny isn't it.

Well, I know that every site that I have set up I always include the sitemap in the robots.txt file of the site. So I thought, maybe Blogger did as well. Sure enough, there is a link to the sitemap in the robots.txt file of any blogger site. So if your like me and want to get your sitemap for your blogger site, go to  yoursite.blogspot.com/robots.txt . Look for Sitemap, and there you go. You now have the address to your sitemap for your blogger site.

Drupal 7 - The Early Days

Drupal 7 is turning out to be a CMS that I like a lot more than Drupal 6. The ease of updates and installs of modules, themes, and views is an amazing change from that of previous versions. In addition, one of my favorite modules in Drupal 6 was the CCK fields. Without them, I would never have used Drupal in the first place. Now, a form of the CCK fields has been implemented in the core version of Drupal 7, along with using those fields easily in views and arguments. In addition, no errors whatsoever from the Drupal 7 core.

However, it appears many module maintainers were blindsided a bit with the final release of Drupal 7. Certain modules like XML-Sitemap and even Views for a couple days were really buggy and had to push releases out it seems to not break. Weird enough, many modules "recommended" versions don't work with Drupal 7 while their older development and alpha versions do. Even to this day, module support is falling behind a bit but with time I believe they will catch up. But as it stands right now for those currently running Drupal 6 with a lot of module support, do not think of upgrading for a couple months.