You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+56-16
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@
20
20
21
21
We welcome contributions to the documentation site! Here's how to do it:
22
22
23
-
1. Follow our [styleguide](https://github.com/aws-amplify/docs/blob/main/STYLEGUIDE.md), especially if writing longer pieces.
23
+
1. Follow our [style guide](https://github.com/aws-amplify/docs/blob/main/STYLEGUIDE.md), especially if writing longer pieces.
24
24
2. Verify your changes locally.
25
25
3. Make a PR to our `main` branch.
26
26
1. Please include any [issues](https://github.com/aws-amplify/docs/issues) your PR addresses.
@@ -33,22 +33,60 @@ We welcome contributions to the documentation site! Here's how to do it:
33
33
### Branches
34
34
35
35
-**main** - at parity with our production site [docs.amplify.aws](https://docs.amplify.aws/)
36
-
-**gh-pages** - DO NOT DELETE! Handle redirects from v1 of the documentation site.
36
+
-**gh-pages** - DO NOT DELETE!
37
37
38
38
## Authoring pages
39
39
40
40
Our docs are generated using [Next.js](https://nextjs.org/). Refer to their docs on [how to create pages](https://nextjs.org/docs/basic-features/pages) as a primer.
41
41
42
-
The pages' source are in **src**. This folder is the only directory you need to touch to edit or create pages.
42
+
The source for each page is in **src**. This folder is the only directory you need to touch to edit or create pages.
43
43
44
-
Within this folder exists a **pages/index.tsx** file. This will be rendered as a page at the route **/**. Within the **pages/lib/q/platform/** folder is a **[platform].mdx** file, which will be rendered as a page at the route **/lib**.
44
+
The **pages/index.tsx** file located inside this folder will be rendered as a page at the route **/**. The **pages/**/index.mdx** filewill be rendered as a page at the route **/[platform]\*\*.
45
45
46
-
To have the page render properly and display in the sidebar, place your page and its route in **src/directory/directory.js**.
46
+
To have the page render properly and display in the sidebar, place your page and its route in **src/directory/directory.mjs**.
47
47
48
-
IMPORTANT: Every page has to have a `title` and `description` meta field.
48
+
IMPORTANT: Every page has to have a `title`, `description`, and `platforms` meta field and must import the `getCustomStaticPaths` util and export `getStaticPaths` and `getStaticProps` as shown in the example below:
49
+
50
+
```
51
+
import { getCustomStaticPath } from '@/utils/getCustomStaticPath';
52
+
53
+
export const meta = {
54
+
title: 'Add social provider sign-in',
55
+
description:
56
+
'Learn how to set up social sign-in providers like Facebook, Google, Amazon, or Sign in with Apple.',
57
+
platforms: [
58
+
'javascript',
59
+
'react-native',
60
+
'flutter',
61
+
'swift',
62
+
'android',
63
+
'angular',
64
+
'nextjs',
65
+
'react',
66
+
'vue'
67
+
]
68
+
};
69
+
70
+
export const getStaticPaths = async () => {
71
+
return getCustomStaticPath(meta.platforms);
72
+
};
73
+
74
+
export function getStaticProps(context) {
75
+
return {
76
+
props: {
77
+
platform: context.params.platform,
78
+
meta
79
+
}
80
+
};
81
+
}
82
+
```
49
83
50
84
The markdown body is parsed as [MDX](https://mdxjs.com/) and can include any valid HTML or JSX.
51
85
86
+
### Internal links
87
+
88
+
When linking to other pages within the docs.amplify.aws site, do not use relative links. For example, instead of `[here is my link](../manage-mfa/)`, use `[here is my link](/[platform]/build-a-backend/auth/manage-mfa/)`. Please note that when linking to a page with a pathname beginning with a platform—[platform] in the link—the URL will render conditionally based off the user's selected platform as a condition of the MDXLink component.
89
+
52
90
### Fragments
53
91
54
92
To incorporate new platform-specific content within a page, please use [Inline Filters](https://github.com/aws-amplify/docs/blob/main/Readme.md#inline-filters).
@@ -58,19 +96,21 @@ When editing content that hasn't been migrated, you may see the following patter
This pattern incorporates fragment files into a page and conditionally renders content based off selected platform added as a condition to the `Fragments` tag.
65
105
66
-
This fragment would exist in: `pages/src/fragments/lib/datastore/js/conflict.mdx`
106
+
This fragment would exist in: `src/fragments/lib/datastore/js/conflict.mdx`
67
107
68
108
### Inline Filters
69
109
70
110
We are incorporating the use of `<InlineFilters>` to add platform-specific content within the context of one page rather than in fragments. These filters allow you to still specify content by platform and they reference platforms using the same naming convention as our fragments. You can enclose your platform-specific content by updating the opening tag:
@@ -79,7 +119,7 @@ If you are updating content on a page, please note any inline filter tags which
79
119
80
120
### Accordion
81
121
82
-
`Accordion` This single-use accordion hides peripheral content until the reader selects to expand the section. This helps you keep your pages focused on the need-to-know information upfront, while also providing readers an option to dive deeper when they choose. These accordions can provide peripheral content such as additional context for beginners, advanced deep dives for those who want to off-road, and troubleshooting guidance for errors users may encounter.
122
+
`Accordion`– This single-use accordion hides peripheral content until the reader selects to expand the section. This helps you keep your pages focused on the need-to-know information upfront, while also providing readers an option to dive deeper when they choose. These accordions can provide peripheral content such as additional context for beginners, advanced deep dives for those who want to off-road, and troubleshooting guidance for errors users may encounter.
83
123
84
124
Here is an example of its usage:
85
125
@@ -88,9 +128,9 @@ Here is an example of its usage:
88
128
89
129
- Title – Make your title descriptive to help readers know what the accordion contains before they click.
90
130
- Eyebrow – Update this text to reflect the purpose of the accordion. We recommend:
91
-
- Learn more – used to add additional context that is not needed upfront but is useful for users to review when they choose.
92
-
- Troubleshooting – used when adding details to troubleshoot specific errors within context.
93
-
- Walkthrough – used when adding a step-by-step example for those who need more direct guidance.
131
+
- Learn more – Used to add additional context that is not needed upfront but is useful for users to review when they choose.
132
+
- Troubleshooting – Used when adding details to troubleshoot specific errors within context.
133
+
- Walkthrough – Used when adding a step-by-step example for those who need more direct guidance.
94
134
95
135
</Accordion>
96
136
```
@@ -143,15 +183,15 @@ let mut a = String::from("a");
143
183
2. On your localhost page, go to the page with the React component you want to debug and open up the developer tools.
144
184
3. To know which source file to breakpoint on, we need to find the name of the component first.
145
185
146
-
- Open up the dev tools and use the react dev tools to find the component. Do this by using the "Select an element on the page to inspect it" tool under the "Components" tab.
186
+
- Open up the dev tools and use the React dev tools to find the component. Do this by using the "Select an element on the page to inspect it" tool under the "Components" tab.
147
187
148
188
- Search for the variable/component name inside the source code to find the file you want to debug.
149
189
150
190
- Place the breakpoint inside the file under the "Sources" tab in the browser's dev tools.
151
-
- Note that since the Amplify Docs site is built with nextjs, file paths will start with "`webpack://_N_E/./`"
191
+
- Note that since the Amplify Docs site is built with Next.js, file paths will start with "`webpack://_N_E/./`"
152
192
153
193
4. Refresh your localhost site and the breakpoint should hit in the browser's dev tools. You should be able to debug the code.
154
194
155
-
Another way to find which file you want to debug is to search for strings/paragraphs seen in Amplify docs site. Search for the strings in your code editor and you'll find that they will be in a `.mdx` file. You should see the components that are being rendered and be able to find the file name you want to debug.
195
+
Another way to find which file you want to debug is to search for strings/paragraphs seen in the Amplify docs site. Search for the strings in your code editor and you'll find that they will be in a `.mdx` file. You should see the components that are being rendered and be able to find the file name you want to debug.
156
196
157
197
More info on debugging can be found here: https://nextjs.org/docs/advanced-features/debugging
0 commit comments