Skip to content

Commit 4727433

Browse files
authored
Community redirect update to camel case and adding documentation (github#21979)
* update to camel case * add documentation on communityRedirect
1 parent b9a3683 commit 4727433

File tree

9 files changed

+18
-14
lines changed

9 files changed

+18
-14
lines changed

components/context/MainContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export type MainContextT = {
6262
article?: BreadcrumbT
6363
}
6464
activeProducts: Array<ProductT>
65-
community_redirect: {
65+
communityRedirect: {
6666
name: string
6767
href: string
6868
}
@@ -114,7 +114,7 @@ export const getMainContext = (req: any, res: any): MainContextT => {
114114
return {
115115
breadcrumbs: req.context.breadcrumbs || {},
116116
activeProducts: req.context.activeProducts,
117-
community_redirect: req.context.page?.community_redirect || {},
117+
communityRedirect: req.context.page?.communityRedirect || {},
118118
currentProduct: req.context.productMap[req.context.currentProduct] || null,
119119
currentLayoutName: req.context.currentLayoutName,
120120
isHomepageVersion: req.context.page?.documentType === 'homepage',

components/page-footer/Support.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,19 @@ import { useMainContext } from 'components/context/MainContext'
77
export const Support = () => {
88
const { isEnterprise } = useVersion()
99
const { t } = useTranslation('support')
10-
const { community_redirect } = useMainContext()
10+
const { communityRedirect } = useMainContext()
1111

1212
return (
1313
<div>
1414
<h2 className="mb-3 f4">{t`still_need_help`}</h2>
1515
<div className="mb-2">
1616
<a
1717
id="ask-community"
18-
href={community_redirect.href || 'https://github.community/'}
18+
href={communityRedirect.href || 'https://github.community/'}
1919
className="Link—secondary text-bold"
2020
>
2121
<PeopleIcon size="small" className="octicon mr-1" />
22-
{Object.keys(community_redirect).length === 0
23-
? t`ask_community`
24-
: community_redirect.name}
22+
{Object.keys(communityRedirect).length === 0 ? t`ask_community` : communityRedirect.name}
2523
</a>
2624
</div>
2725
<div>

content/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ See the [contributing docs](/CONTRIBUTING.md) for general information about work
2828
- [`type`](#type)
2929
- [`topics`](#topics)
3030
- [`contributor`](#contributor)
31+
- [`communityRedirect`](#communityRedirect)
3132
- [Escaping single quotes](#escaping-single-quotes)
3233
- [Autogenerated mini TOCs](#autogenerated-mini-tocs)
3334
- [Versioning](#versioning)
@@ -264,6 +265,11 @@ includeGuides:
264265
- Type: `Object`. Properties are `name` and `URL`.
265266
- Optional.
266267

268+
### `communityRedirect`
269+
- Purpose: Set a custom link and link name for `Ask the GitHub community` link in the footer.
270+
- Type: `Object`. Properties are `name` and `href`.
271+
- Optional.
272+
267273
Example:
268274

269275
```yaml

content/codespaces/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ featuredLinks:
2424
- /codespaces/setting-up-your-codespace/personalizing-codespaces-for-your-account
2525
popularHeading: Set up your project
2626
product_video: 'https://www.youtube-nocookie.com/embed/_W9B7qc9lVc'
27-
community_redirect:
27+
communityRedirect:
2828
name: 'Provide GitHub Feedback'
2929
href: 'https://github.com/github/feedback/discussions/categories/codespaces-feedback'
3030
redirect_from:

content/discussions/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ product_video: 'https://www.youtube-nocookie.com/embed/IpBw2SJkFyk'
2828
layout: product-landing
2929
versions:
3030
fpt: '*'
31-
community_redirect:
31+
communityRedirect:
3232
name: 'Provide GitHub Feedback'
3333
href: 'https://github.com/github/feedback/discussions/categories/discussions-feedback'
3434
children:

content/repositories/releasing-projects-on-github/automatically-generated-release-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ versions:
77
topics:
88
- Repositories
99
shortTitle: Automated release notes
10-
community_redirect:
10+
communityRedirect:
1111
name: 'Provide GitHub Feedback'
1212
href: 'https://github.com/github/feedback/discussions/categories/releases-feedback'
1313
---

content/sponsors/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ featuredLinks:
2828
layout: product-landing
2929
versions:
3030
fpt: '*'
31-
community_redirect:
31+
communityRedirect:
3232
name: 'Provide GitHub Feedback'
3333
href: 'https://github.com/github/feedback/discussions/categories/sponsors-feedback'
3434
children:

lib/frontmatter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export const schema = {
149149
interactive: {
150150
type: 'boolean',
151151
},
152-
community_redirect: {
152+
communityRedirect: {
153153
type: 'object',
154154
properties: {
155155
name: 'string',

lib/page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ class Page {
195195
context.relativePath = this.relativePath
196196
const html = await renderContent(this.markdown, context)
197197

198-
// Adding community_redirect for Discussions, Sponsors, and Codespaces - request from Product
198+
// Adding communityRedirect for Discussions, Sponsors, and Codespaces - request from Product
199199
if (
200200
this.parentProduct &&
201201
(this.parentProduct.id === 'discussions' ||
202202
this.parentProduct.id === 'sponsors' ||
203203
this.parentProduct.id === 'codespaces')
204204
) {
205-
this.community_redirect = {
205+
this.communityRedirect = {
206206
name: 'Provide GitHub Feedback',
207207
href: `https://github.com/github/feedback/discussions/categories/${this.parentProduct.id}-feedback`,
208208
}

0 commit comments

Comments
 (0)