Skip to content
This repository has been archived by the owner on Nov 21, 2021. It is now read-only.

Commit

Permalink
haacked#20 - Fix numerous issues with pingback functionality in Subtext:
Browse files Browse the repository at this point in the history
- Error in PROD (i.e. "System.Web.HttpException: The file '/blog/jjameson/Services/Pingback.aspx' does not exist.")
- The "pingback" URL specified in the <link> head element should be an absolute URL (not a relative URL) according to the Pingback 1.0 specification (http://www.hixie.ch/specs/pingback/pingback)
- According to the current Subtext routing functionality, the "pingback" URL needs to include the ID of the post (e.g. "http://www.technologytoolbox.com/blog/jjameson/Services/Pingback/315.aspx")
  • Loading branch information
jeremy-jameson committed Jan 31, 2012
1 parent 24fb641 commit 300650f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/Subtext.Framework/Tracking/Notification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#endregion

using System;
using Subtext.Framework.Components;
using Subtext.Framework.Configuration;
using Subtext.Framework.Routing;
Expand Down Expand Up @@ -64,9 +65,12 @@ public static void Run(Entry entry, Blog blog, BlogUrlHelper urlHelper)

if (entry != null)
{
VirtualPath blogUrl = urlHelper.BlogUrl();
Uri fullyQualifiedUrl = blogUrl.ToFullyQualifiedUrl(blog);

var notify = new Notifier
{
FullyQualifiedUrl = urlHelper.BlogUrl(),
FullyQualifiedUrl = fullyQualifiedUrl.AbsoluteUri,
BlogName = blog.Title,
Title = entry.Title,
PostUrl = urlHelper.EntryUrl(entry).ToFullyQualifiedUrl(blog),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static bool TrackBackPing(string pageText, Uri url, string title, Uri lin
return SendPing(trackBackUrl, parameters);
}
}
return true;
return false;
}

private static bool SendPing(Uri trackBackItem, string parameters)
Expand Down
12 changes: 8 additions & 4 deletions src/Subtext.Framework/Tracking/TrackHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ namespace Subtext.Framework.Tracking
/// </summary>
public static class TrackHelpers
{
//Text to insert into a file with pinkback service location
public static string GetPingPackTag(BlogUrlHelper urlHelper)
//Text to insert into a file with pingback service location
public static string GetPingbackTag(BlogUrlHelper urlHelper, Entry entry)
{
VirtualPath blogUrl = urlHelper.BlogUrl();
Uri absoluteUrl = blogUrl.ToFullyQualifiedUrl(entry.Blog);

return string.Format(CultureInfo.InvariantCulture,
"<link rel=\"pingback\" href=\"{0}Services/Pingback.aspx\"></link>",
urlHelper.BlogUrl());
"<link rel=\"pingback\" href=\"{0}Services/Pingback/{1}.aspx\"></link>",
absoluteUrl.AbsoluteUri,
entry.Id);
}

//Body of text to insert into a post with Trackback
Expand Down
2 changes: 1 addition & 1 deletion src/Subtext.Web/UI/Controls/ViewPost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected override void OnLoad(EventArgs e)

if (PingBack != null)
{
PingBack.Text = TrackHelpers.GetPingPackTag(Url);
PingBack.Text = TrackHelpers.GetPingbackTag(Url, Entry);
}

if (TrackBack != null)
Expand Down

0 comments on commit 300650f

Please sign in to comment.