This method is better than checking the URL, because this code does nor rely on a specific context, which can change. Also, the author server can be switched to a publish mode by setting parameter "Show" to 1 in the request. So, the request to /author/somepage.html?Show=1 renders as publish. Therefore, relying on the context is not a reliable solution.

Twitter™ and Facebook posts are not covered under the terms of Creative Commons.