Skip to content

Commit

Permalink
Community redirect update to camel case and adding documentation (git…
Browse files Browse the repository at this point in the history
…hub#21979)

* update to camel case

* add documentation on communityRedirect
  • Loading branch information
gracepark authored Oct 7, 2021
1 parent b9a3683 commit 4727433
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions components/context/MainContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export type MainContextT = {
article?: BreadcrumbT
}
activeProducts: Array<ProductT>
community_redirect: {
communityRedirect: {
name: string
href: string
}
Expand Down Expand Up @@ -114,7 +114,7 @@ export const getMainContext = (req: any, res: any): MainContextT => {
return {
breadcrumbs: req.context.breadcrumbs || {},
activeProducts: req.context.activeProducts,
community_redirect: req.context.page?.community_redirect || {},
communityRedirect: req.context.page?.communityRedirect || {},
currentProduct: req.context.productMap[req.context.currentProduct] || null,
currentLayoutName: req.context.currentLayoutName,
isHomepageVersion: req.context.page?.documentType === 'homepage',
Expand Down
8 changes: 3 additions & 5 deletions components/page-footer/Support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@ import { useMainContext } from 'components/context/MainContext'
export const Support = () => {
const { isEnterprise } = useVersion()
const { t } = useTranslation('support')
const { community_redirect } = useMainContext()
const { communityRedirect } = useMainContext()

return (
<div>
<h2 className="mb-3 f4">{t`still_need_help`}</h2>
<div className="mb-2">
<a
id="ask-community"
href={community_redirect.href || 'https://github.community/'}
href={communityRedirect.href || 'https://github.community/'}
className="Link—secondary text-bold"
>
<PeopleIcon size="small" className="octicon mr-1" />
{Object.keys(community_redirect).length === 0
? t`ask_community`
: community_redirect.name}
{Object.keys(communityRedirect).length === 0 ? t`ask_community` : communityRedirect.name}
</a>
</div>
<div>
Expand Down
6 changes: 6 additions & 0 deletions content/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ See the [contributing docs](/CONTRIBUTING.md) for general information about work
- [`type`](#type)
- [`topics`](#topics)
- [`contributor`](#contributor)
- [`communityRedirect`](#communityRedirect)
- [Escaping single quotes](#escaping-single-quotes)
- [Autogenerated mini TOCs](#autogenerated-mini-tocs)
- [Versioning](#versioning)
Expand Down Expand Up @@ -264,6 +265,11 @@ includeGuides:
- Type: `Object`. Properties are `name` and `URL`.
- Optional.

### `communityRedirect`
- Purpose: Set a custom link and link name for `Ask the GitHub community` link in the footer.
- Type: `Object`. Properties are `name` and `href`.
- Optional.

Example:

```yaml
Expand Down
2 changes: 1 addition & 1 deletion content/codespaces/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ featuredLinks:
- /codespaces/setting-up-your-codespace/personalizing-codespaces-for-your-account
popularHeading: Set up your project
product_video: 'https://www.youtube-nocookie.com/embed/_W9B7qc9lVc'
community_redirect:
communityRedirect:
name: 'Provide GitHub Feedback'
href: 'https://github.com/github/feedback/discussions/categories/codespaces-feedback'
redirect_from:
Expand Down
2 changes: 1 addition & 1 deletion content/discussions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ product_video: 'https://www.youtube-nocookie.com/embed/IpBw2SJkFyk'
layout: product-landing
versions:
fpt: '*'
community_redirect:
communityRedirect:
name: 'Provide GitHub Feedback'
href: 'https://github.com/github/feedback/discussions/categories/discussions-feedback'
children:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ versions:
topics:
- Repositories
shortTitle: Automated release notes
community_redirect:
communityRedirect:
name: 'Provide GitHub Feedback'
href: 'https://github.com/github/feedback/discussions/categories/releases-feedback'
---
Expand Down
2 changes: 1 addition & 1 deletion content/sponsors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ featuredLinks:
layout: product-landing
versions:
fpt: '*'
community_redirect:
communityRedirect:
name: 'Provide GitHub Feedback'
href: 'https://github.com/github/feedback/discussions/categories/sponsors-feedback'
children:
Expand Down
2 changes: 1 addition & 1 deletion lib/frontmatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const schema = {
interactive: {
type: 'boolean',
},
community_redirect: {
communityRedirect: {
type: 'object',
properties: {
name: 'string',
Expand Down
4 changes: 2 additions & 2 deletions lib/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ class Page {
context.relativePath = this.relativePath
const html = await renderContent(this.markdown, context)

// Adding community_redirect for Discussions, Sponsors, and Codespaces - request from Product
// Adding communityRedirect for Discussions, Sponsors, and Codespaces - request from Product
if (
this.parentProduct &&
(this.parentProduct.id === 'discussions' ||
this.parentProduct.id === 'sponsors' ||
this.parentProduct.id === 'codespaces')
) {
this.community_redirect = {
this.communityRedirect = {
name: 'Provide GitHub Feedback',
href: `https://github.com/github/feedback/discussions/categories/${this.parentProduct.id}-feedback`,
}
Expand Down

0 comments on commit 4727433

Please sign in to comment.