The MLS Digital dev team is in Portland this week to attend DrupalCon 2013. We are very excited to be involved with the Drupal community and plan on helping to tackle issues during the code sprints on Friday.

We have made it a priority to start contributing more back to the open source community. Specifically, we want to release some of the custom modules that we use to build our MLS platform. Today, we are announcing the release of our first three releases on

Custom Meta

Custom Meta module on

While Nodewords (D6) and Metatags (D7) work well for adding things like Abstract, Description, Keywords, Robots, Copyright and even OpenGraph meta tags to your content, we continually found ourselves backed into a situation where we would have to release a tpl.php update or write a custom module to inject meta tag elements onto our platform.

A good example is the Smart App Banner from Apple. We received the info to add the tag to our site for early adoption of the feature but had to deploy code to implement. After adding one too many contrib modules or writing yet another custom module to add small or bulk custom meta tags to our system, we came up with the idea for Custom Meta.

The module allows you to define and manage custom meta tags.

  • Select the “Meta Attribute” (Property, Name, or http-equiv)
  • Set the “Attribute value”
  • Set the “Content Value”
  • Module will add meta tags to all Non-Admin content for your site.
<meta [Meta Attribute]="[Attribute Value]" content="[Content value]">

Custom Meta

Gigya Top Comments

Gigya Top Comments module on

We utilize Gigya for our user management, comments, and social infrastructure.

To determine “popular” content, Gigya provides metadata about content via their REST API. We implemented the getTopStreams method to acquire a list of popular content based on comment counts. Unfortunately, the getTopStreams algorithm did not really factor “velocity” into its ranking. This created a fan experience that was a bit jarring, as almost all of our front page content, each with hundreds of comments, could be dropped off the popular list suddenly when they hit the maximum age of three days, even though their were active discussions.

To make the aging of popular content a bit more natural, we decided to implement our own ranking algorithm. We reviewed a few different publicly available aglorithms and ultimately decided to implement the algorithm that powers Hacker News as described in this blog post

Our implementation of the algorithm weighs the comment count against the age of the first comment on a piece of content. We aim to keep fresh content in the Top Discussions block by rewarding content that generates a high volume of comments over a shorter period of time, but slowly making time a heavier penalty. For an item to stay on the front page, it has to continously generate more traffic than the fresher content. By default the getTopStreams call to Gigya’s API returns 100 streams that we then rank using the algorithm. We have found that our default parameters for comments (1) and time (1.5), have done a good job displaying engaging content on, but the parameters can be tweaked for particular implementations through the module’s admin UI.

The code below demonstrates how the parameters alter the behavior of the alogrithm:

1 function mls_gigya_top_content_rank($item, $age) {
2   $time_modifier = variable_get('mls_gigya_top_content_time_modifier', '');
3   $comment_modifier = variable_get('mls_gigya_top_content_comment_modifier', '');
4   $item_rank = pow($item->commentCount-1, $comment_modifier)/pow($age+2,$time_modifier);
5   return intval($item_rank*1000);
6 }

Tweet Block

Tweet Block module on

We were very excited when Twitter introduced Embedded Timelines and Embeddable Tweets. It gave our editors a new way to integrate tweets about our league and create editorial around them. Our editors wanted the ability to generate blocks that showed a specified tweet via a Tweet ID in a few different layouts. This would allow us to feature tweet blocks in our site layout via Context.

Here are the layouts we chose (of course all of these are customizable via theme overrides of the tpl.php files found in the theme directory of the module).

Tweet Block

The module uses the oEmbed endpoint call to generate static pre-formatted blocks to your site to be used via blocks where ever you like. It allows for an unlimited amount of embedded timelines to be created. There is a limit to the number of API requests you can do per hour (currently 150), so this module stashes the response in the database and only makes requests when you save the settings form. Content is not written into the block unless an tweet ID is specified and the Twitter response is valid.

This module generates the following blocks.

  • Block 1 - The proper response from the Twitter API formatted by Twitter. The twitter JavaScript embed is required and is an option in the admin UI for this block.
  • Block 2 - A custom single line representation of the Tweet. You can override the styles and theme yourself.
  • Block 3 - A stylized version of the tweet that you can skin yourself.
  • Block 4[n] - Unlimited amount of embedded timelines.

This module is definitely customized to our use case, but we feel that it can be refined for more widespread adoption. We would love to hear what you think and what you would want in a future version. Tweet BEAN blocks for Drupal 7, indefinite custom block definitions, etc.. Please let us know in the Issue Queue what you would like to see.

Our team is committed to ensuring that these modules are activley maintained. Please feel free to open issues on the project pages for any enhancements and bugs you might have.


Hans Gutknecht - @HansyG , Louis Jimenez - @LouisAJimenez

Past Contributions

New MLS Mobile App for 2015

January 12, 2015

Open beta for new

December 04, 2014 Hans Gutknecht

Standings Visualizations

October 30, 2014 Tom Youds