If you have read my post on Misconceptions on JavaScript Plugins and SEO, you know that search engines don't do JavaScript. Though these plugins and libraries (such as one for pulling your latest Twitter Updates) are nice for adding dynamic content for your users, they are just end-user flare and add nothing to your SEO rankings. They also put an unnecessary tax on your users, as each client browser is responsible for independently retrieving the external content; the time for your page to render is extended by a few seconds as the client must first download the JS library then make the JSON/AJAX request for your content.
In response to this, I have created dasControls, a library of custom macros for dasBlog (the blogging engine that powers www.cptloadtest.com). I have started with content that is driven by custom JavaScript libraries and convert the content and data retrieval into server-side controls. For now, dasControls contains only a Twitter Status macro, but I intend to add more controls in the coming months.
dasControls [Build 1.0.0.0] : Download | Project Page
dasControls TwitterStatus Macro
The TwitterStatus macro uses server-side retrieval of your Twitter data, eliminating all client-side JavaScript calls for your tweets. By placing the Twitter request on the server, the data is also available to any search engines that index your page. Additionally, data is cached on the server, and new updates are retrieved based on the polling interval you specify. When using real-time client-side JavaScript calls, there is a 2-5 second delay for your end-users while the data is retrieved from Twitter; by caching the data on the local server, this delay is eliminated, and the content for each user is delivered from the local cache, lightening the load for the end-user while avoiding an undue burden for high-traffic sites.
Macro Name: TwitterStatus
Macro Syntax: <% TwitterStatus("user name"[, number of tweets[, polling interval]])|dasControls %>
- User Name : String. Your Twitter handle.
- Number of Tweets : Integer. The number of tweets to retrieve and display. [default: 10]
- Polling Interval : Integer. The number of minutes between each Twitter retrieval. [default: 5]
Relevant CSS:
- TwitterStatusItem : CSS class given to each Tweet, rendered as a DIV.
- TwitterStatusTimestamp : CSS class given to each Tweet's timestamp ("32 minutes ago"), rendered as an inline SPAN within each Tweet element.
Using the Macro within a dasBlog Template
This macro is for use in the dasBlog HomeTemplate. The macro works just like any out-of-the box macro, except that you must also include the alias specified within dasControls entry the web.config (the value of the "macro" attribute). Your twitter handle is required, though you can also optionally include the number of Tweets to pull from Twitter (default: 10) and the number of minutes between each Twitter data request (default: 5). Because everything happens on the server, there is no need to include any of the Twitter JSON JavaScript libraries or HTML markup.
<% TwitterStatus("jayharris", 6, 5)|dasControls %>
Installation and Setup of dasControls
Download dasControls, extract the assembly into your dasBlog 'bin' directory.
dasControls [Build 1.0.0.0] : Download | Project Page
Enable Custom Macros within your dasBlog installation, and add the Twitter macro to your list of Custom Macros.
First, ensure that the <newtelligence.DasBlog.Macros> section exists within your web.config:
<newtelligence.DasBlog.Macros>
<!-- Other Macro Libraries -->
</newtelligence.DasBlog.Macros>
Second, ensure that the Macros Configuration Section is defined in to your web.config <configSections>:
<configSections>
<!—Other Configuration Sections -->
<section requirePermission="false" name="newtelligence.DasBlog.Macros"
type="newtelligence.DasBlog.Web.Core.MacroSectionHandler,
newtelligence.DasBlog.Web.Core" />
</configSections>
Third, add the dasControls library entry to the dasBlog Macros section:
<newtelligence.DasBlog.Macros>
<add macro="dasControls"
type="HarrisDesigns.Controls.dasBlogControls.Macros,
HarrisDesigns.Controls.dasBlogControls"/>
</newtelligence.DasBlog.Macros>
Roadmap for dasControls
In the upcoming weeks and months, I plan on adding additional macros to the dasControls library, including Delicious, Google Reader's Shared Items, and Facebook. If you're interested in any others, or have any ideas, please let me know.