seaQwa.com | Gay news -- logo
Welcome to seaQwa.com. Sign in | Join | Help
in Search
Partners
QueerFilter.com RSS feeds 1zone.net social gay news aggregator
Activism Blogs - Blog Catalog Blog Directory
Add Qnews to Netvibes
Technorati Blog Finder
Seattle blogs
Gay blogs
Now in Q
Northwest gay news
Anglican schism
Marriage equality
Saturday, March 22

Nerd notes: Site-wide tags headlines from external blogs now link directly

Another step toward getting things where I'd like them to be.

A few weeks ago, I added direct links to the source blogs on blog-specific tag pages, like the tag pages for QTicker World, QTicker Seattle, and GaySeattle.

But there's a different way to access site-wide tags and I couldn't figure out how to do the direct link for technical reasons that I'll explain below. While looking for something else, I found a post on the Community Server forum that tells me exactly how to make those links.

The problem arises because the page showing sitewide tags uses CSControl:IndexPostData instead of CSBlog:WeblogPostData  The trick, as explained by Kevin Harder in the forum post is to check for a property available through IndexPostData.

WeblogPostData (and List, I believe) have a property -- AuthorUrl -- that holds the link to the external source post and also expose the property IsExternal that is true for a mirrored blog. (IndexPostData doesn't expose those properties.)

Those properties allowed me to use this code to point the blog headline directly to the external source blog:

<CSBlog:WeblogPostData ID="WeblogPostData3" runat="server" Property="Subject" LinkTo="Post" Tag="h3" CssClass="BlogPostTitle" >
   <DisplayConditions>
         <CSControl:Conditions ID="Conditions1" Operator="Not" runat="server">
             <CSBlog:WeblogPostPropertyValueComparison ID="WeblogPostPropertyValueComparison1" runat="server" ComparisonProperty="IsExternal" Operator="IsSetOrTrue" />
         </CSControl:Conditions>
     </DisplayConditions>
</CSBlog:WeblogPostData>
<CSBlog:WeblogPostData ID="WeblogPostData2" Property="Subject" LinkTo="AuthorUrl" Tag="h3" CssClass="BlogPostTitle" runat="server" >
     <DisplayConditions>
         <CSBlog:WeblogPostPropertyValueComparison ID="WeblogPostPropertyValueComparison2" runat="server" ComparisonProperty="IsExternal" Operator="IsSetOrTrue" />
     </DisplayConditions>
</CSBlog:WeblogPostData>

That method doesn't work, however, on a sitewide listing that depends on IndexPostData, since the IndexPost methods don't have the IsExternal property.

The elegant (for this kind of thing) offered by Dave is to pull data from WeblogPostData after checking that the listing is, indeed, for a blog post. Harder explains:

Blog Mirroring does however set an extended property called "SubmittedUserName" to the blog post that is the name of the feed that it came from. So if you want to display that instead of the username, we'll need to modify the search results page.

It's a complicated round of checking in the two sets of <DisplayConditions>, but it works like a charm.

This is the code he offers for replacing the default "Anonymous" in the site-wide tagslist with the name of the source blog:

<CSControl:IndexPostData Property="UserName" LinkTo="Author" runat="server">
  <DisplayConditions>
    <CSControl:ControlVisibilityCondition ControlId="BlogSubmittedUserName" ControlVisiblilityEquals="false" runat="server" />
  </DisplayConditions>
</CSControl:IndexPostData>
<CSBlog:WeblogPostData Property="SubmittedUserName" LinkTo="authorUrl" ID="BlogSubmittedUserName" runat="server">
  <DisplayConditions>
    <CSControl:IndexPostPropertyValueComparison ComparisonProperty="ApplicationType" ComparisonValue="Weblog" Operator="EqualTo" runat="server" />
    <CSBlog:WeblogPostPropertyValueComparison ComparisonProperty="SubmittedUserName" Operator="issetortrue" runat="server" />
  </DisplayConditions>
</CSBlog:WeblogPostData>

I used that to do exactly what he's suggesting, but also used it to make a direct link for the post title with this:

<CSControl:IndexPostData runat="server" LinkTo="Post" Property="Title" Tag="H5" CssClass="CommonSearchResultName" >
  <DisplayConditions runat="server">
    <CSControl:ControlVisibilityCondition ControlId="BlogSubmittedUserName1" ControlVisiblilityEquals="false" runat="server" />
  </DisplayConditions>
</CSControl:IndexPostData>
<CSBlog:WeblogPostData Property="Subject" LinkTo="authorUrl" Tag="H5" CssClass="CommonSearchResultName" ID="BlogSubmittedUserName1" runat="server">
  <DisplayConditions>
    <CSControl:IndexPostPropertyValueComparison ComparisonProperty="ApplicationType" ComparisonValue="Weblog" Operator="EqualTo" runat="server" />
    <CSBlog:WeblogPostPropertyValueComparison ComparisonProperty="SubmittedUserName" Operator="issetortrue" runat="server" />
  </DisplayConditions>
</CSBlog:WeblogPostData>

The other great thing about this bit of code is that it shows how to use values from WeblogPostData even when most of the list is running from IndexPostData. The trick is to do the double comparison that verifies WeblogPostData will be used only if the ApplicationType is "weblog".

What surprised me is that it also shows how to use a value -- in this case the controlID "BlogSubmittedUserName1" from a control that appears later on the page as a condition.

Since I was up late doing that (and other things related to the new photo pages), I'm not sure I understand why that works, but it strikes me as somehow significant that it works.

Now, back to working on the photos sidebar.

Posted by Robin Evans on Mar 22 2008, 05:10 PM [Permalink]


About this blog Background notes about the site and the issues that arise in making it happen. Includes technical notes when that is the focus of our 'webwrangler' but will also occasionally include background on Qblog or Qnews posts.
Syndication