@@ -118,7 +118,7 @@ Some linting rules return warnings or errors based on HTML comments that you can
|
|||||||
|
|
||||||
#### Syntax for expiring and expired content
|
#### Syntax for expiring and expired content
|
||||||
|
|
||||||
Rules `GHD038` and `GHD039` check for content that has been manually given an expiration date. Fourteen days before the specified date, the content linter will return a warning that the content is expiring soon. Starting on the specified date, the content linter will return an error and flag the content for remediation.
|
Rules `GHD038` and `GHD039` check for content that has been manually given an expiration date. Fourteen days before the specified date, the content linter will return a warning that the content is expiring soon. Starting on the specified date, the content linter will return a warning and flag the content for remediation.
|
||||||
|
|
||||||
You can add an expiration date to content by wrapping it in HTML tags that contain an expiration date in the format: `<!-- expires yyyy-mm-dd --> <!-- end expires yyyy-mm-dd -->`
|
You can add an expiration date to content by wrapping it in HTML tags that contain an expiration date in the format: `<!-- expires yyyy-mm-dd --> <!-- end expires yyyy-mm-dd -->`
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
| GHD022 | liquid-ifversion-versions | Liquid `ifversion`, `elsif`, and `else` tags should be valid and not contain unsupported versions. | error | liquid, versioning |
|
| GHD022 | liquid-ifversion-versions | Liquid `ifversion`, `elsif`, and `else` tags should be valid and not contain unsupported versions. | error | liquid, versioning |
|
||||||
| GHD035 | rai-reusable-usage | RAI articles and reusables can only reference reusable content in the data/reusables/rai directory | error | feature, rai |
|
| GHD035 | rai-reusable-usage | RAI articles and reusables can only reference reusable content in the data/reusables/rai directory | error | feature, rai |
|
||||||
| GHD036 | image-no-gif | Image must not be a gif, styleguide reference: contributing/style-guide-and-content-model/style-guide.md#images | error | images |
|
| GHD036 | image-no-gif | Image must not be a gif, styleguide reference: contributing/style-guide-and-content-model/style-guide.md#images | error | images |
|
||||||
| GHD038 | expired-content | Expired content must be remediated. | error | expired |
|
| GHD038 | expired-content | Expired content must be remediated. | warning | expired |
|
||||||
| GHD039 | expiring-soon | Content that expires soon should be proactively addressed. | warning | expired |
|
| GHD039 | expiring-soon | Content that expires soon should be proactively addressed. | warning | expired |
|
||||||
| [GHD040](https://github.com/github/docs/blob/main/src/content-linter/README.md) | table-liquid-versioning | Tables must use the correct liquid versioning format | error | tables |
|
| [GHD040](https://github.com/github/docs/blob/main/src/content-linter/README.md) | table-liquid-versioning | Tables must use the correct liquid versioning format | error | tables |
|
||||||
| GHD041 | third-party-action-pinning | Code examples that use third-party actions must always pin to a full length commit SHA | error | feature, actions |
|
| GHD041 | third-party-action-pinning | Code examples that use third-party actions must always pin to a full length commit SHA | error | feature, actions |
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ const githubDocsConfig = {
|
|||||||
},
|
},
|
||||||
'expired-content': {
|
'expired-content': {
|
||||||
// GHD038
|
// GHD038
|
||||||
severity: 'error',
|
severity: 'warning',
|
||||||
'partial-markdown-files': true,
|
'partial-markdown-files': true,
|
||||||
},
|
},
|
||||||
'expiring-soon': {
|
'expiring-soon': {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ describe.skip('category pages', () => {
|
|||||||
let publishedArticlePaths: string[] = []
|
let publishedArticlePaths: string[] = []
|
||||||
let availableArticlePaths: string[] = []
|
let availableArticlePaths: string[] = []
|
||||||
let categoryVersions: string[] = []
|
let categoryVersions: string[] = []
|
||||||
let categoryChildTypes: string[] = []
|
|
||||||
let allowTitleToDifferFromFilename: boolean | undefined = false
|
let allowTitleToDifferFromFilename: boolean | undefined = false
|
||||||
let indexTitle: string = ''
|
let indexTitle: string = ''
|
||||||
let indexShortTitle: string = ''
|
let indexShortTitle: string = ''
|
||||||
@@ -101,23 +101,9 @@ describe.skip('category pages', () => {
|
|||||||
const data = parsed.data as MarkdownFrontmatter
|
const data = parsed.data as MarkdownFrontmatter
|
||||||
categoryVersions = getApplicableVersions(data.versions, indexAbsPath)
|
categoryVersions = getApplicableVersions(data.versions, indexAbsPath)
|
||||||
allowTitleToDifferFromFilename = data.allowTitleToDifferFromFilename
|
allowTitleToDifferFromFilename = data.allowTitleToDifferFromFilename
|
||||||
categoryChildTypes = []
|
|
||||||
const articleLinks = data.children.filter((child) => {
|
const articleLinks = data.children.filter((child) => {
|
||||||
const mdPath = getPath(productDir, indexLink, child)
|
const mdPath = getPath(productDir, indexLink, child)
|
||||||
|
|
||||||
const fileExists = fs.existsSync(mdPath)
|
const fileExists = fs.existsSync(mdPath)
|
||||||
|
|
||||||
// We're checking each item in the category's 'children' frontmatter
|
|
||||||
// to see if the child is an article by tacking on `.md` to it. If
|
|
||||||
// that file exists it's an article, otherwise it's a map topic. A
|
|
||||||
// category needs to have all the same type of children so we track
|
|
||||||
// that here so we can test to make sure all the types are the same.
|
|
||||||
if (fileExists) {
|
|
||||||
categoryChildTypes.push('article')
|
|
||||||
} else {
|
|
||||||
categoryChildTypes.push('mapTopic')
|
|
||||||
}
|
|
||||||
|
|
||||||
return fileExists && fs.statSync(mdPath).isFile()
|
return fileExists && fs.statSync(mdPath).isFile()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -217,19 +203,6 @@ describe.skip('category pages', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('categories contain all the same type of children', () => {
|
|
||||||
let errorType = ''
|
|
||||||
expect(
|
|
||||||
categoryChildTypes.every((categoryChildType) => {
|
|
||||||
errorType = categoryChildType
|
|
||||||
return categoryChildType === categoryChildTypes[0]
|
|
||||||
}),
|
|
||||||
`${indexRelPath.replace('index.md', '')} contains a mix of ${errorType}s and ${
|
|
||||||
categoryChildTypes[0]
|
|
||||||
}s, category children must be of the same type`,
|
|
||||||
).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('slugified title matches parent directory name', () => {
|
test('slugified title matches parent directory name', () => {
|
||||||
if (allowTitleToDifferFromFilename) return
|
if (allowTitleToDifferFromFilename) return
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ export function SearchResultsAggregations({ aggregations }: Props) {
|
|||||||
} else {
|
} else {
|
||||||
params.append('toplevel', toplevel)
|
params.append('toplevel', toplevel)
|
||||||
}
|
}
|
||||||
|
// Reset pagination when filters change to prevent showing 0 results
|
||||||
|
params.delete('page')
|
||||||
return `/${locale}${asPathRoot}?${params}`
|
return `/${locale}${asPathRoot}?${params}`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +39,8 @@ export function SearchResultsAggregations({ aggregations }: Props) {
|
|||||||
const [asPathRoot, asPathQuery = ''] = asPath.split('#')[0].split('?')
|
const [asPathRoot, asPathQuery = ''] = asPath.split('#')[0].split('?')
|
||||||
const params = new URLSearchParams(asPathQuery)
|
const params = new URLSearchParams(asPathQuery)
|
||||||
params.delete('toplevel')
|
params.delete('toplevel')
|
||||||
|
// Reset pagination when clearing filters
|
||||||
|
params.delete('page')
|
||||||
return `/${locale}${asPathRoot}?${params}`
|
return `/${locale}${asPathRoot}?${params}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user