Do you blog about PowerShell? If so, consider adding your blog site to Planet PowerShell which is an aggregator of content from PowerShell Community members. There are some guidelines for submission on their GitHub page so be sure to take a look at it before continuing. Instructions for adding your blog also exists on that page, but I’ve recently seen a number of tweets about it being too difficult or too much work. To be honest with you, if everything in IT was as easy as adding my blog to Planet PowerShell, I probably wouldn’t have a job. I decided to try to make the process a little easier, regardless (I’m not affiliated with Planet PowerShell other than having added my blog to it).
First, you need to fork the Planet PowerShell repository on GitHub:
Forking a repository creates your own personal copy of it underneath your GitHub account as denoted by #1 in the following image:
Go to your copy of the Planet PowerShell repository on GitHub. Click on the “Clone or download” button (#2) and then click on the “Copy to clipboard” button (#3).
Clone your copy of the repository to your computer. Be sure to change the source path to match your copy of the Planet PowerShell repository (use the path that you copied to your clipboard in the previous step). Change the destination path if needed. I’ll store the destination path in a variable named $LocalPath since I’ll be using it again later in this blog article.
1 2 | $LocalPath = 'U:\GitHub\planetpowershell' git clone https://github.com/mikefrobbins/planetpowershell.git $LocalPath |
If you don’t already have Git installed (which is used in the previous example) or if you’re not familiar with Git, you can find more information about it in my blog article titled “Getting Started with the Git Version Control System“.
I’ll store my first and last name in variables since they’ll be used throughout this blog article. Your name should be in proper case.
1 2 | $FirstName = 'Mike' $LastName = 'Robbins' |
I wrote a PowerShell function to create your author file for Planet PowerShell. This function is part of my MrToolkit module which can be found in my PowerShell repository on GitHub. It uses some of the other functions found in that module as well as my MrGeo module which can be found in my ScriptingGames repository on GitHub.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | #Requires -Version 3.0 -Modules MrGeo function New-MrPlanetPowerShellAuthor { <# .SYNOPSIS Creates the author information required to add your PowerShell related blog to Planet PowerShell. .DESCRIPTION New-MrPlanetPowerShellAuthor is an advanced function that creates the author information required to add your PowerShell related blog to Planet PowerShell (http://www.planetpowershell.com/). Planet PowerShell is an aggregator of content from PowerShell Community members. .PARAMETER FirstName Author's first name. .PARAMETER LastName Author's last name. .PARAMETER Bio Short bio about the author. .PARAMETER StateOrRegion Your geographical location, i.e.: Holland, New York, etc. .PARAMETER EmailAddress Email address. Only enter if you want your email address to be publicly available. .PARAMETER TwitterHandle Twitter handle without the leading @. .PARAMETER GravatarEmailAddress The email address you use at gravatar.com. Entering this causes the picture used at Gravatar.com to be used as your author picture on Planet PowerShell. The email address is converted to the MD5 hash of the email address string. .PARAMETER GitHubHandle GitHub handle without the leading @. .PARAMETER BlogUri URL of your blog site. .PARAMETER RssUri URL for the RSS feed to your blog site. .PARAMETER MicrosoftMVP Switch parameter. Specify if you're a Microsoft MVP. .PARAMETER FilterToPowerShell Switch parameter. Specify if you blog on more than just PowerShell. .EXAMPLE New-MrPlanetPowerShellAuthor -FirstName Mike -LastName Robbins -Bio 'Microsoft PowerShell MVP and SAPIEN Technologies MVP. Leader & Co-founder of MSPSUG' -StateOrRegion 'Mississippi, USA' -TwitterHandle mikefrobbins -GravatarEmailAddress mikefrobbins@users.noreply.github.com -GitHubHandle mikefrobbins -BlogUri mikefrobbins.com -RssUri mikefrobbins.com/feed -MicrosoftMVP -FilterToPowerShell | New-Item -Path C:\GitHub\planetpowershell\src\Firehose.Web\Authors\MikeRobbins.cs .INPUTS None .OUTPUTS System.String .NOTES Author: Mike F Robbins Website: http://mikefrobbins.com Twitter: @mikefrobbins #> [CmdletBinding()] param ( [Parameter(Mandatory)] [string]$FirstName, [Parameter(Mandatory)] [string]$LastName, [string]$Bio, [string]$StateOrRegion, [string]$EmailAddress, [string]$TwitterHandle, [string]$GravatarEmailAddress, [string]$GitHubHandle, [Parameter(Mandatory)] [string]$BlogUri, [string]$RssUri, [switch]$MicrosoftMVP, [switch]$FilterToPowerShell ) $BlogUrl = (Test-MrURL -Uri $BlogUri -Detailed).ResponseUri if ($PSBoundParameters.RssUri) { $RssUrl = (Test-MrURL -Uri $RssUri -Detailed).ResponseUri } $GravatarHash = (Get-MrHash -String $GravatarEmailAddress).ToLower() $Location = Get-MrGeoInformation $GeoLocation = -join ($Location.Latitude, ', ', $Location.Longitude) if ($MicrosoftMVP) { $Interface = 'IAmAMicrosoftMVP' } else { $Interface = 'IAmACommunityMember' } if ($FilterToPowerShell) { $Interface = "$Interface, IFilterMyBlogPosts" $SyndicationItem = @' public bool Filter(SyndicationItem item) { return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell")); } '@ } @" using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class $FirstName$LastName : $Interface { public string FirstName => `"$FirstName`"; public string LastName => `"$LastName`"; public string ShortBioOrTagLine => `"$Bio`"; public string StateOrRegion => `"$StateOrRegion`"; public string EmailAddress => `"$EmailAddress`"; public string TwitterHandle => `"$TwitterHandle`"; public string GitHubHandle => `"$GitHubHandle`"; public string GravatarHash => `"$GravatarHash`"; public GeoPosition Position => new GeoPosition($GeoLocation); public Uri WebSite => new Uri(`"$BlogUrl`"); public IEnumerable<Uri> FeedUris { get { yield return new Uri(`"$RssUrl`"); } } $SyndicationItem } } "@ } |
Simply run the function and provide your information via parameter input.
The output can be used to create the necessary .cs file:
1 2 | New-MrPlanetPowerShellAuthor -FirstName $FirstName -LastName $LastName -Bio 'Microsoft PowerShell MVP and SAPIEN Technologies MVP. Leader & Co-founder of MSPSUG' -StateOrRegion 'Mississippi, USA' -TwitterHandle mikefrobbins -GravatarEmailAddress mikefrobbins@users.noreply.github.com -GitHubHandle mikefrobbins -BlogUri mikefrobbins.com -RssUri mikefrobbins.com/feed -MicrosoftMVP -FilterToPowerShell | New-Item -Path $LocalPath\src\Firehose.Web\Authors\$FirstName$LastName.cs |
Verify that the contents of the .cs file looks correct:
1 | Get-Content -Path $LocalPath\src\Firehose.Web\Authors\$FirstName$LastName.cs |
Add the class to the .csproj file:
1 2 3 4 5 6 | $xml = [xml](Get-Content -Path "$LocalPath\src\Firehose.Web\Firehose.Web.csproj") $element = $xml.CreateElement('Compile') $element.SetAttribute('Include',"Authors\$FirstName$LastName.cs") $xml.Project.ItemGroup[2].AppendChild($element) $xml = [xml]$xml.OuterXml.Replace(" xmlns=`"`"", "") $xml.Save("$LocalPath\src\Firehose.Web\Firehose.Web.csproj") |
Verify the class has been added:
1 2 | ([xml](Get-Content -Path "$LocalPath\src\Firehose.Web\Firehose.Web.csproj")).Project.ItemGroup[2].Compile | Where-Object Include -like *authors* |
I can see that one file has been added and one file has been modified in my local copy of my Planet PowerShell repo:
1 | git status |
Do you like how my PowerShell prompt changes automatically when I’m in a directory that’s part of a Git repository? If so, be sure to see my blog article on “Configuring the PowerShell ISE for use with Git and GitHub“.
Add any new or modified files, commit them to the local copy of the repository, and push the changes to your copy of the repository on GitHub:
1 2 3 | git add . git commit -m 'Added author information for Mike Robbins' git push |
Submit a pull request:
Click the “Create pull request button”:
The pull request has to be reviewed and approved by the owners of Planet PowerShell. Once that occurs, it may take a few days for your blog articles to start showing up in their RSS feed.
Update 3/30/2017 – I’ve added the one function in the MrGeo module to the MrToolkit module so only one module is required. I’ve also updated my MrToolkit module on the PowerShell Gallery so you can simply run Install-Module -Name MrToolkit -Force to install the module on a computer with PowerShell version 5.0 or higher or one that has installed the package management MSI for down-level versions.
µ
Mike,
Thanks for this write-up, well done.
Hi Mike. Thanks for the suggestion. I do have a blog site where I write about PowerShell mainly, but don’t think it is ready yet to be added. So I will write a bit more and then apply. Thanks for a very good guide.
Thanks for this post and the accompanying module. The module made it very easy to add my author information.