13

Let's say I have a blog available under one of the Creative Commons licences. Such type of licence would be displayed at the bottom of each page with a link to the actual licence, etc..

However, apparently, the Creative Commons licences are not really suitable for software nor for distribution of source code, so, what about any code (e.g. snippet/fragment or even full programs) that can be part of a blog post?

If I would choose to release this code as GPLv3, would it be acceptable and clear enough to say, at the bottom of the page, something like: "This website by Mr. Foo is released under a Creative Commons blah blah, except for any source code in the form of code snippets/fragments/samples, which are released under GPLv3"?

Or are there better/different/more formal ways to clarify such situation?

gnat
  • 20,543
  • 29
  • 115
  • 306
mguassa
  • 707

3 Answers3

13

In general, there are three types of content on a development-oriented web page which may be covered by different licenses:

  • The textual content itself, that is the text of the blog,

  • The source code,

  • The visual design (the design itself and the graphical elements, such as the logo).

What I used on many sites (example) and which can be used for a blog as well is the header similar to:

Copyright © 2015 Example Corp. All Rights Reserved, except for the parts enumerated below:

which actually means that:

  • Content and code are covered by two different licenses,
  • Everything else that wasn't explicitly mentioned has all rights reserved.

Note that:

  • If the piece of code on your blog is small, chances are that there is no need for a specific license (and even if there is, it will be dismissed by the readers and you won't be able to enforce its terms anyway in a court).

    For instance, snippets such as in this MSDN article can hardly be covered by a license: anybody who have never read the article could be writing the exact same pieces of code by themselves, and it would be practically impossible to prove to a judge that the code was actually copy-pasted.

  • If the piece of code on your blog is large, the license may be included in the header. Not the full text (please, don't; licenses in the header of the file, written in all capitals, are terribly ugly), but just the mention with eventually the link. This has a benefit compared to mentioning the license in the footer of the page: if the code is copy-pasted, the license has better chance to remain.

    /**
     * Author: Somebody <somebody@example.com>
     * Original source: http://blog.example.com/123/
     * License: BSD 3-Clause License (http://opensource.org/licenses/BSD-3-Clause)
     **/
    // Code goes here.
    

Also, if you want your code to actually be used, consider a license different from GPL. Since GPL is a very restrictive license, this may not be suited for pieces of code put in your blog.

2

You could keep your code snippets in an online repository somewhere with its own LICENSE file, so people know how they may reuse it. You can also write your code snippets as Github Gists, and then embed them into your blog posts: since each Gist can have multiple files and you can embed them separately (as described in this SO answer), you could add a separate license file into each Gist, or have a single large Gist with multiple code snippets.

Gaurav
  • 557
  • 5
  • 14
1

Unless you want to forbid it, there is no harm in licensing your code under a Creative Commons license. This would, for example, allow users to include the code in Stack Exchange posts (e.g., when giving an answer on Stack Overflow).

In addition, you may license all code snippets under one or more different (software) licenses, like the GPLv3.

Users that make use of your code snippets could then choose which single license (of those that you’ve granted) they want to follow.

How you communicate/show which licenses are available is up to you. It mostly depends on how eye-catching you want to state it. For example, you could add the info

  • on the "About" page of your site, and/or
  • in the footer of each page, and/or
  • underneath each code snippet, and/or
  • in the markup (making it machine-readable) using RDFa.
unor
  • 1,112