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?

3
  • 2
    You want to go from CC to GPLv3? Blecch. In any case, the GPL includes detailed instructions on its use and application; see gnu.org/licenses/gpl-howto.en.html Commented May 27, 2015 at 22:54
  • 1
    I don't want to go from CC to GPLv3, I'm just trying to find the proper way for a blog to display the 2 licences involved, one for the blog content like text, etc. (released under CC) and the other one for the code snippets it contains (which could be released under GPLv3). That's because I can't release everything with the same licence.
    – mguassa
    Commented May 28, 2015 at 8:18
  • What about the other way around? How would you use a code snippet that misses a license? Only mention the source? I guess it is highly dependent on your project legal status (commercial/oss/academic etc)
    – robi
    Commented Jul 16, 2017 at 4:21

3 Answers 3

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 <[email protected]>
     * 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
  • Thank you, that's exactly what I was looking for. Could you please suggest a few other licences I could use for such code (snippets), instead of GPL?
    – mguassa
    Commented May 29, 2015 at 6:55
  • 2
    @mguassa: you may be interested by opensource.org/licenses website. BSD-2 and BSD-3, Apache License 2.0 and MIT license, for instance, are fine, since they make it possible to use the code within proprietary and/or closed source products. If you're unsure which license is the best for you, for your particular case, please consult a lawyer. Commented May 29, 2015 at 7:42
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.

1
  • Thank you, I appreciate your suggestion, it's also something I can consider. Upvoted.
    – mguassa
    Commented May 29, 2015 at 7:03
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.