Essential Visual studio plugins

https://visualstudiogallery.msdn.microsoft.com/E721D830-7664-4E02-8D03-933C3F1477F2 – ankh SVN

https://visualstudiogallery.msdn.microsoft.com/e792686d-542b-474a-8c55-630980e72c30 – indent guides

https://visualstudiogallery.msdn.microsoft.com/8cccc206-b9de-42ef-8f5a-160ad0f017ae – ReAttach

https://visualstudiogallery.msdn.microsoft.com/05bb50e3-c971-4613-9379-acae2cfe6f9e – slow cheetah

https://visualstudiogallery.msdn.microsoft.com/a23de100-31a1-405c-b4b7-d6be40c3dfff – spell checker

https://visualstudiogallery.msdn.microsoft.com/ca0ea1f3-e824-4586-a73e-c8e4a65323d8 – waka time

https://visualstudiogallery.msdn.microsoft.com/ee6e6d8c-c837-41fb-886a-6b50ae2d06a2 – web essentials

Advertisements

Related Links!

If you need to combine internal links and external links in the same Umbraco picker, you will need to use the related links picker.

This will generate a JSON array. This is how you extract the links on the other end.

 

var obj = JsonConvert.DeserializeObject<JArray>(test);

foreach (var a in obj)
{
var type = a.Value<string>(“type”);

var newWindow = a.Value<bool>(“newWindow”);
var title = a.Value<string>(“title”);

if (type.IsNullOrWhiteSpace() == false)
{
if (type == “internal”)
{
var linkId = a.Value<int>(“internal”);
var link = Umbraco.NiceUrl(linkId);
<li><a href=”@link” @(newWindow ? “target=_blank” : “”)>@title</a></li>
}

if(type == “external”)
{
var linkTitle = a.Value<string>(“caption”);
var link = a.Value<string>(“link”);
<li><a href=”@link” @(newWindow ? “target=_blank” : “”)>@title</a></li>
}
}
}

or

public static MvcHtmlString RelatedLinksGenerator(this JToken source, string urlCSS)
{
var helper = new UmbracoHelper(UmbracoContext.Current);
var type = source.Value(“type”);
var newWindow = source.Value(“newWindow”);
var title = source.Value(“title”);

var anchor = new TagBuilder(“a”);
string link = string.Empty;

if(type.Equals(“internal”))
{
var linkId = source.Value(“internal”);
link = helper.NiceUrlWithDomain(linkId);
}

if(type.Equals(“external”))
{
var linkTitle = source.Value(“caption”);
link = source.Value(“link”);
}

anchor.MergeAttribute(“href”, link);
anchor.MergeAttribute(“class”, urlCSS);
anchor.SetInnerText(title);

return MvcHtmlString.Create(anchor.ToString(TagRenderMode.Normal));
}

Umbracoarmus! Casting your current page object

Imagine this, You have a IPublished content object that you’re using in your view. It is set up like this

var currentPage = Umbraco.CurrentPage();

You can access your property values like so

@currentPage.MyProperty

But when you call any other methods on myProperty such as .HasValue you get an exception as the value throws an exception. Annoying right.
You just need to cast the property as follows

((Umbraco.Web.Models.DynamicPublishedContent)CurrentPage).GetProperty(“MyProperty”).HasValue

Then you can gain access to the property.

ALL the Shares!!

Customizing the content that you need your users to share on social media couldn’t be easier. I have integrated this with the Umbraco CMS to allow for web administrators to tailor the content that is shared.

Add the following code to your project page and amend accordingly. Once the code is deployed to a publicly accessible URL (This will not work on your localhost!), you will need to run the URL through the following validators to ensure that your content is being found correctly.

https://developers.facebook.com/tools/debug/og/object/

https://dev.twitter.com/cards/types/summary-large-image
https://cards-dev.twitter.com/validator

Place the following in the head of your page

<meta property=”og:url” content=”@Umbraco.NiceUrlWithDomain(CurrentPage.Id)” />
<meta property=”og:type” content=”article” />
<meta property=”og:title” content=”@CurrentPage.facebook_title” />
<meta property=”og:description” content=”@CurrentPage.facebook_summary” />
<meta property=”og:image” content=”@CurrentPage.MediaFile(“facebook_thumbnail_image”).Replace(“https”, “http”)” />
<meta property=”og:image:secure_url” content=”@CurrentPage.MediaFile(“facebook_thumbnail_image”)” />

<meta name=”twitter:card” content=”photo” />
<meta name=”twitter:site” content=”@Umbraco.NiceUrlWithDomain(CurrentPage.Id)” />
<meta name=”twitter:title” content=”@CurrentPage.Twitter_Title” />
<meta name=”twitter:description” content=”@CurrentPage.twitter_summary” />
<meta name=”twitter:image” content=”@CurrentPage.MediaFile(“twitter_thumbnail_image”)” />
<meta name=”twitter:url” content=”@Umbraco.NiceUrlWithDomain(CurrentPage.Id)” />

Place the links in the body content.

<a href=”@String.Format(“https://www.facebook.com/sharer/sharer.php?u={0}”, Umbraco.NiceUrlWithDomain(CurrentPage.Id))” >Facebook</a>

<a href=”@String.Format(“http://pinterest.com/pin/create/link/?url={0}&media={1}&description={2}”, Umbraco.NiceUrlWithDomain(CurrentPage.Id), CurrentPage.MediaFile(“pintrest_thumbnail_image”), CurrentPage.pintrest_summary)”></a>

<a href=”@String.Format(“http://twitter.com/intent/tweet?status={0}”, Umbraco.NiceUrlWithDomain(CurrentPage.Id))”>Twitter></a>