I have a setup with Spartacus v2 (Hybris 2005) in a CCv2 enviroment.
I'm currently facing the issue that the content of the metatag <meta name="occ-backend-base-url" content="OCC_BACKEND_BASE_URL_VALUE" />
isn't replaced in any of my enviroments.
This happens because I need to set occ prefix in my app.module.ts to with hybris 2005:
backend: {
occ: {
prefix: '/occ/v2/'
}
}
Is there a frontend only solution for this issue or do we need to change the prefix back to /rest/v2 in the backend?
Is there a reason that the meta tag is ignored even if no url is defined in the backend.occ data object, but only the prefix?
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Spartacusstore</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="manifest" href="manifest.webmanifest">
<meta name="theme-color" content="#1976d2">
<meta name="occ-backend-base-url" content="OCC_BACKEND_BASE_URL_VALUE" />
</head>
<body>
<app-root></app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
</body>
</html>
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { translations, translationChunksConfig } from '@spartacus/assets';
import { B2cStorefrontModule } from '@spartacus/storefront';
import { OccConfig, I18nModule, TranslatePipe } from '@spartacus/core';
const occConfig: OccConfig = { backend: { occ: {} } };
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
B2cStorefrontModule.withConfig({
backend: {
occ: {
prefix: '/occ/v2/'
}
},
checkout: {
guest: true
},
context: {
currency: ['USD'],
language: ['en'],
baseSite: ['electronics-spa']
},
i18n: {
resources: translations,
chunks: translationChunksConfig,
fallbackLang: 'en'
},
features: {
level: '2.0'
},
}),
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
question from:
https://stackoverflow.com/questions/65835035/spartacus-metatag-overwritten-by-config-even-if-no-url-is-set 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…