fossasia/loklak_webclient

View on GitHub
iframely/plugins/meta/canonical.js

Summary

Maintainability
A
55 mins
Test Coverage
var urlLib = require('url');

module.exports = {

    highestPriority: true,

    getMeta: function(url, meta) {

        var canonical = (meta.canonical && meta.canonical.href || meta.canonical) || (meta.og && meta.og.url) || (meta.twitter && meta.twitter.url);

        if (canonical) {

            canonical = urlLib.resolve(url, canonical);

            return {
                canonical: canonical
            };
        }
    }
};