Skip to content

Commit

Permalink
docs: change docs as per new API for subdomains
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh Sahasrabhojanee committed Oct 9, 2020
1 parent 6261575 commit af1ebe7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
28 changes: 18 additions & 10 deletions docs-src/tutorials/hamburger-menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Assume you are publisher `www.example.com` and have configured a subdomain `worl
Which menu group items are shown inside the hamburger menu on the subdomain is decided based on the following logic:

- 1st priority is given to featureConfig, just like before. So pass the following opts:

```js
const exampleOptsObj = {
// main domain opts
Expand All @@ -21,29 +22,36 @@ Which menu group items are shown inside the hamburger menu on the subdomain is d
menuGroupSlug: "general-links"
}
},
"world-news": {
// opts for "world-news" subdomain
featureConfig: {
sidebarMenu: {
menuGroupSlug: "world-links"
domains: {
"world-news": {
// opts for "world-news" subdomain
featureConfig: {
sidebarMenu: {
menuGroupSlug: "world-links"
}
}
}
}
};
```

your main domain will now show items from menu group having slug `general-links` and your subdomain `https://world-news.example.com` will show items from menu group having slug `world-links`. In this example, you don't _have_ to pass featureConfig for the main domain. Following will also work just fine.

```js
const exampleOptsObj = {
"world-news": {
// opts for "world-news" subdomain
featureConfig: {
sidebarMenu: {
menuGroupSlug: "world-links"
domains: {
"world-news": {
// opts for "world-news" subdomain
featureConfig: {
sidebarMenu: {
menuGroupSlug: "world-links"
}
}
}
}
};
```

- else, if you've created a menu group having slug `amp-sidebar-menu-world-news` and added items to it, it'll pick those items
- else, if you've created a menu group having slug `sidebar-menu-world-news` and added items to it, it'll pick those items
- else it'll pick items from the `default` menu group
Expand Down
2 changes: 1 addition & 1 deletion docs-src/tutorials/opts.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Feature config is an object that can be used to configure different features of
- accepts an object. Key `sketches-host` and value is the lang attribute that you wish to provide.
5. sidebarMenu
- Optional. To tell amplib from where to pick items for the sidebar (Hamburger) menu, pass the slug of that menu group to `opts.featureConfig.sidebarMenu.menuGroupSlug`
- This can be extended to subdomains as well. For example if you have a subdomain called `world-news`, set `opts["world-news"].featureConfig.sidebarMenu.menuGroupSlug`. Now the sidebar menu on the subdomain `world-news` will pick items from whatever menu group you've set
- This can be extended to subdomains as well. For example if you have a subdomain called `world-news`, set `opts.domains["world-news"].featureConfig.sidebarMenu.menuGroupSlug`. Now the sidebar menu on the subdomain `world-news` will pick items from whatever menu group you've set
- go to {@tutorial hamburger-menu} for more info

```jsx
Expand Down

0 comments on commit af1ebe7

Please sign in to comment.