-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--------- Co-authored-by: Maciej Daniłowicz <[email protected]>
- Loading branch information
1 parent
e13d3d9
commit e71cc78
Showing
24 changed files
with
333 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
"@shopware-pwa/nuxt3-module": minor | ||
--- | ||
|
||
**BREAKING**: Remove default config and use Nuxt runtime config | ||
|
||
change your `nuxt.config.js` from: | ||
|
||
```ts | ||
export default defineNuxtConfig({ | ||
///... | ||
shopware: { | ||
shopwareEndpoint: "http://localhost:8000", | ||
shopwareAccessToken: "your-access-token", | ||
}, | ||
///... | ||
}); | ||
``` | ||
|
||
to | ||
|
||
```ts | ||
export default defineNuxtConfig({ | ||
///... | ||
runtimeConfig: { | ||
public: { | ||
shopware: { | ||
shopwareEndpoint: "http://localhost:8000", | ||
shopwareAccessToken: "your-access-token", | ||
}, | ||
}, | ||
}, | ||
///... | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"vue-demo-store": minor | ||
--- | ||
|
||
Add merged sitemap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@shopware-pwa/api-client": minor | ||
--- | ||
|
||
Add sitemap service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
BASE_E2E_URL="https://frontends-demo.vercel.app/" | ||
BASE_E2E_URL="https://frontends-demo.vercel.app/" | ||
NUXT_PUBLIC_SHOPWARE_SHOPWARE_ENDPOINT="https://demo-frontends.shopware.store" | ||
NUXT_PUBLIC_SHOPWARE_SHOPWARE_ACCESS_TOKEN="SWSCBHFSNTVMAWNZDNFKSHLAYW" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
head: | ||
- - meta | ||
- name: og:title | ||
content: "Sitemap" | ||
- - meta | ||
- name: og:description | ||
content: "Understand sitemap generated by Shopware Frontends" | ||
- - meta | ||
- name: og:image | ||
content: "https://frontends-og-image.vercel.app/Sitemap.png?fontSize=150px" | ||
--- | ||
|
||
# Sitemap | ||
|
||
Sitemap is generated by combining two sitemaps, Frontends app and Shopware backend | ||
|
||
Link: | ||
|
||
``` | ||
http://<your_domain>/sitemap.xml | ||
``` | ||
|
||
## Backend sitemap | ||
|
||
``` | ||
/server/routes/sitemap.xml.ts | ||
``` | ||
|
||
This sitemap contains links to pages like: | ||
|
||
- Product pages | ||
- Category pages | ||
- CMS pages | ||
|
||
More about backend sitemap can be found [here](https://docs.shopware.com/en/shopware-6-en/settings/sitemap) | ||
|
||
## Frontends sitemap | ||
|
||
``` | ||
/server/routes/sitemap-local.xml.ts | ||
``` | ||
|
||
This sitemap contains static page that are declared in the Frontends app | ||
|
||
Each static page that comes from the Frontneds app, should be added manually to the `/server/sitemap.ts` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/api-client/src/services/SitemapServiceTests/getSitemap.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { getSitemap } from "../sitemapService"; | ||
import { defaultInstance } from "../../apiService"; | ||
import { describe, expect, it, beforeEach, vi } from "vitest"; | ||
|
||
vi.mock("../../../src/apiService"); | ||
const mockedApiInstance = defaultInstance; | ||
|
||
describe("SitemapService - getSitemap", () => { | ||
const mockedGet = vi.fn(); | ||
beforeEach(() => { | ||
vi.resetAllMocks(); | ||
mockedApiInstance.invoke = { | ||
get: mockedGet, | ||
} as any; | ||
}); | ||
|
||
it("should return sitemap links", async () => { | ||
mockedGet.mockResolvedValueOnce({ data: { data: {} } }); | ||
const result = await getSitemap(); | ||
expect(mockedGet).toBeCalledTimes(1); | ||
expect(mockedGet).toBeCalledWith(`/store-api/sitemap`); | ||
expect(result).toMatchObject({}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { getSitemapEndpoint } from "../endpoints"; | ||
import { defaultInstance, ShopwareApiInstance } from "../apiService"; | ||
import { SitemapResult } from "@shopware-pwa/types"; | ||
|
||
/** | ||
* Get sitemap | ||
* | ||
* @throws ClientApiError | ||
* @public | ||
*/ | ||
export async function getSitemap( | ||
contextInstance: ShopwareApiInstance = defaultInstance | ||
): Promise<SitemapResult[]> { | ||
const resp = await contextInstance.invoke.get(`${getSitemapEndpoint()}`); | ||
return resp.data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
e71cc78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
shopware-frontends-docs – ./
shopware-frontends-docs.vercel.app
shopware-frontends-docs-git-main-shopware-frontends.vercel.app
shopware-frontends-docs-shopware-frontends.vercel.app
e71cc78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
frontends-demo – ./templates/vue-demo-store
frontends-demo-shopware-frontends.vercel.app
frontends-demo.vercel.app
frontends-demo-git-main-shopware-frontends.vercel.app