core: {
                         templates: {{serialized_templates|safe}},
                         metadata: [
-                            {key: 'audience', values: [
-                                '3-6', '6-9', '9-12', '12-18', '18+', 'Adults'
-                            ]},
+                            {% for category in tag_categories %}
+                                {key: '{{ category.dc_tag }}', values: [
+                                    {% for tag in category.tag_set.all %}
+                                        '{{ tag.dc_value }}'{% if not forloop.last %},{% endif %}
+                                    {% endfor %}
+                                ]},
+                            {% endfor %}
                             {key: 'creator'},
                             {key: 'description'},
                             {key: 'publisher'},
-                            {key: 'language'},
-                            {key: 'rights'},
                             {key: 'relation.coverimage.url', isFile: true}
                         ]
                     }
 
 from django.views.decorators.http import require_POST
 from django.shortcuts import get_object_or_404, render
 
-from catalogue.models import Document, Template
+from catalogue.models import Document, Template, Category
 from dvcs.models import Revision
 import nice_diff
 from wiki import forms
             "text_revert": forms.DocumentTextRevertForm(prefix="textrevert"),
             "text_publish": forms.DocumentTextPublishForm(prefix="textpublish"),
         },
+        'tag_categories': Category.objects.all(),
         'pk': doc.pk,
     })
 
 
             }
         });
 
-        $('.chosen-select').chosen().each(function() {
-            var widget = $(this.nextSibling), $t = $(this);
-            $.each($.merge([], this.attributes), function() {
-                if (this.name.substr(0, 5) === 'data-') {
-                    $t.removeAttr(this.name);
-                    widget.attr(this.name, this.value);
-                }
+        if ($.isFunction($.fn.chosen)) {
+            $('.chosen-select').chosen().each(function () {
+                var widget = $(this.nextSibling), $t = $(this);
+                $.each($.merge([], this.attributes), function () {
+                    if (this.name.substr(0, 5) === 'data-') {
+                        $t.removeAttr(this.name);
+                        widget.attr(this.name, this.value);
+                    }
+                });
             });
-        });
-
+        }
 
 
         // tutorial mode