Skip to content

Commit

Permalink
Fixed Share buttons to use Package-specific URL instead of
Browse files Browse the repository at this point in the history
Version-specific URLs.
  • Loading branch information
analogrelay authored and Tim Lovell-Smith committed Nov 7, 2012
1 parent 50e311f commit 7149573
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
10 changes: 0 additions & 10 deletions Website/UrlExtensions.cs
Expand Up @@ -11,16 +11,6 @@ public static string Current(this UrlHelper url)
return url.RequestContext.HttpContext.Request.RawUrl;
}

/// <summary>
/// Gets the "canonical" (as in fully-qualified, without "www") version of the current URL
/// </summary>
/// <param name="url">A UrlHelper object</param>
/// <returns>The canonical URL</returns>
public static string CanonicalCurrent(this UrlHelper url)
{
return GetCanonicalUrl(url).Uri.AbsoluteUri;
}

public static string Absolute(this UrlHelper url, string path)
{
UriBuilder builder = GetCanonicalUrl(url);
Expand Down
7 changes: 4 additions & 3 deletions Website/Views/Packages/DisplayPackage.cshtml
Expand Up @@ -4,14 +4,15 @@
ViewBag.Title = Model.Title + " " + Model.Version;
ViewBag.Tab = "Packages";
Layout = "~/Views/Shared/TwoColumnLayout.cshtml";
var absolutePackageUrl = Url.Absolute(Url.Package(Model.Id));
}
@section OpenGraph {
@if(!String.IsNullOrWhiteSpace(ViewBag.FacebookAppID)) {
<meta property="fb:app_id" content="@ViewBag.FacebookAppID" />
}
<meta property="og:title" content="@Model.Title" />
<meta property="og:type" content="nugetgallery:package" />
<meta property="og:url" content="@Url.CanonicalCurrent()" />
<meta property="og:url" content="@absolutePackageUrl" />
<meta property="og:description" content="@Model.Description" />
<meta property="og:determiner" content="a" />
<meta property="og:image" content="@(Model.IconUrl ?? Url.Absolute(Links.Content.Images.packageDefaultIcon_png))" />
Expand Down Expand Up @@ -133,8 +134,8 @@
}</code></p>
</div>

<div><a href="https://twitter.com/share" class="twitter-share-button" data-url="@Url.CanonicalCurrent()" data-text="Check out this cool #nuget package!" data-via="nuget">Tweet</a></div>
<div class="fb-like" data-href="@Url.CanonicalCurrent()" data-send="false" data-width="450" data-show-faces="true"></div>
<div><a href="https://twitter.com/share" class="twitter-share-button" data-url="@absolutePackageUrl" data-text="Check out this cool #nuget package!" data-via="nuget">Tweet</a></div>
<div class="fb-like" data-href="@absolutePackageUrl" data-send="false" data-width="450" data-show-faces="true"></div>

@if (!String.IsNullOrWhiteSpace(Model.ReleaseNotes))
{
Expand Down

0 comments on commit 7149573

Please sign in to comment.