mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[CST-5729] Method to remove Link tags from Head when switched page
This commit is contained in:
@@ -64,6 +64,11 @@ const tagsInUseSelector =
|
|||||||
(state: MetaTagState) => state.tagsInUse,
|
(state: MetaTagState) => state.tagsInUse,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link elements added on Item Page
|
||||||
|
*/
|
||||||
|
let linkTags = [];
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MetadataService {
|
export class MetadataService {
|
||||||
|
|
||||||
@@ -119,6 +124,7 @@ export class MetadataService {
|
|||||||
|
|
||||||
private processRouteChange(routeInfo: any): void {
|
private processRouteChange(routeInfo: any): void {
|
||||||
this.clearMetaTags();
|
this.clearMetaTags();
|
||||||
|
this.clearLinkTags();
|
||||||
|
|
||||||
if (hasValue(routeInfo.data.value.dso) && hasValue(routeInfo.data.value.dso.payload)) {
|
if (hasValue(routeInfo.data.value.dso) && hasValue(routeInfo.data.value.dso.payload)) {
|
||||||
this.currentObject.next(routeInfo.data.value.dso.payload);
|
this.currentObject.next(routeInfo.data.value.dso.payload);
|
||||||
@@ -207,27 +213,14 @@ export class MetadataService {
|
|||||||
link.rel = rel;
|
link.rel = rel;
|
||||||
link.type = type;
|
link.type = type;
|
||||||
document.head.appendChild(link);
|
document.head.appendChild(link);
|
||||||
console.log(link);
|
linkTags.push(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public setSignpostingLinksets(itemId: string) {
|
public clearLinkTags(){
|
||||||
// let linkSet: string;
|
linkTags.forEach(link => {
|
||||||
|
link.parentNode.removeChild(link);
|
||||||
// const value = this.signpostginDataService.getLinksets(itemId);
|
});
|
||||||
|
}
|
||||||
// value.subscribe(linksets => {
|
|
||||||
// linkSet = linksets.payload.body;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return linkSet;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// setLinkAttribute(linksets){
|
|
||||||
// console.log('ANDREA', linksets);
|
|
||||||
// const linkAttribute = `Link: ${linksets.payload.body}`;
|
|
||||||
// const textNode = document.createTextNode(linkAttribute);
|
|
||||||
// document.head.appendChild(textNode);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add <meta name="title" ... > to the <head>
|
* Add <meta name="title" ... > to the <head>
|
||||||
|
Reference in New Issue
Block a user