import { DOCUMENT } from '@angular/common';
import * as i0 from '@angular/core';
import { Injectable, Inject } from '@angular/core';

class CanonicalLinkTagService {
    constructor(doc) {
        this.doc = doc;
    }
    createLinkTag(href) {
        const head = this.doc.getElementsByTagName('head')[0];
        var element = this.doc.querySelector(`link[rel='canonical']`) || null;
        if (element == null) {
            element = this.doc.createElement('link');
            head.appendChild(element);
        }
        element.setAttribute('rel', 'canonical');
        element.setAttribute('href', href);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CanonicalLinkTagService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CanonicalLinkTagService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CanonicalLinkTagService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: function () { return [{ type: Document, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }]; } });

/**
 * Generated bundle index. Do not edit.
 */

export { CanonicalLinkTagService };
//# sourceMappingURL=testlocallibrary-shared-kernel-services-canonical.mjs.map
