diff --git a/src/plugin/document.coffee b/src/plugin/document.coffee index 299e43541..bb19589b1 100644 --- a/src/plugin/document.coffee +++ b/src/plugin/document.coffee @@ -108,7 +108,7 @@ class Annotator.Plugin.Document extends Annotator.Plugin type = l.prop('type') lang = l.prop('hreflang') - if rel not in ["alternate", "canonical", "bookmark"] then continue + if rel not in ["alternate", "canonical", "bookmark", "shortlink"] then continue if rel is 'alternate' # Ignore feeds resources diff --git a/test/spec/plugin/document_spec.coffee b/test/spec/plugin/document_spec.coffee index 5dc4310de..5efee30ee 100644 --- a/test/spec/plugin/document_spec.coffee +++ b/test/spec/plugin/document_spec.coffee @@ -22,6 +22,7 @@ describe 'Annotator.Plugin.Document', -> head.append('') head.append('') head.append('') + head.append('') head.append('') head.append('') head.append('') @@ -52,7 +53,7 @@ describe 'Annotator.Plugin.Document', -> it 'should have links with absoulte hrefs and types', -> assert.ok(annotation.document.link) - assert.equal(annotation.document.link.length, 7) + assert.equal(annotation.document.link.length, 8) assert.match(annotation.document.link[0].href, /^.+runner.html(\?.*)?$/) assert.equal(annotation.document.link[1].rel, "alternate") assert.match(annotation.document.link[1].href, /^.+foo\.pdf$/) @@ -62,13 +63,15 @@ describe 'Annotator.Plugin.Document', -> assert.equal(annotation.document.link[2].type, "application/msword") assert.equal(annotation.document.link[3].rel, "bookmark") assert.equal(annotation.document.link[3].href, "http://example.com/bookmark") - assert.equal(annotation.document.link[4].href, "doi:10.1175/JCLI-D-11-00015.1") - assert.match(annotation.document.link[5].href, /.+foo\.pdf$/) - assert.equal(annotation.document.link[5].type, "application/pdf") - assert.equal(annotation.document.link[6].href, "doi:10.1175/JCLI-D-11-00015.1") + assert.equal(annotation.document.link[4].rel, "shortlink") + assert.equal(annotation.document.link[4].href, "http://example.com/bookmark/short") + assert.equal(annotation.document.link[5].href, "doi:10.1175/JCLI-D-11-00015.1") + assert.match(annotation.document.link[6].href, /.+foo\.pdf$/) + assert.equal(annotation.document.link[6].type, "application/pdf") + assert.equal(annotation.document.link[7].href, "doi:10.1175/JCLI-D-11-00015.1") it 'should ignore atom and RSS feeds and alternate languages', -> - assert.equal(annotation.document.link.length, 7) + assert.equal(annotation.document.link.length, 8) it 'should have highwire metadata', -> assert.ok(annotation.document.highwire) @@ -99,7 +102,7 @@ describe 'Annotator.Plugin.Document', -> it 'should have unique uris', -> uris = annotator.plugins.Document.uris() - assert.equal(uris.length, 5) + assert.equal(uris.length, 6) it 'should have a favicon', -> assert.equal(