Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Content Manager #64

Merged
merged 68 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d95342a
remove plugin-pwa
ghostrider-05 Oct 31, 2021
80aae7d
Update package-lock.json
ghostrider-05 Nov 5, 2021
e77db31
Squashed commit of the following:
ghostrider-05 Nov 26, 2021
69ae88b
Merge branch 'RocketLeagueMapmaking:master' into master
ghostrider-05 Nov 26, 2021
74546a5
Merge branch 'RocketLeagueMapmaking:master' into master
ghostrider-05 Dec 3, 2021
f8df077
Update .gitattributes
ghostrider-05 Feb 9, 2022
abb8ddf
Merge branch 'master' of https://github.com/ghostrider-05/RL-docs
ghostrider-05 Oct 19, 2023
817f9ff
install dependencies
ghostrider-05 Aug 8, 2024
5a4a798
Add missing title in frontmatter
ghostrider-05 Aug 8, 2024
55b0b4a
Use constants in configuration
ghostrider-05 Aug 8, 2024
2679493
Add configuration for CMS
ghostrider-05 Aug 8, 2024
ad3e2ed
lint: fix warnings
ghostrider-05 Aug 8, 2024
e1faec2
Configure github auth
ghostrider-05 Aug 8, 2024
604b88f
fix: use workers domain
ghostrider-05 Aug 8, 2024
8a59e26
switch to default branch for now
ghostrider-05 Aug 8, 2024
b6b9ced
Update contributing workflow for cms
ghostrider-05 Aug 9, 2024
4b9bd7f
Add code owners
ghostrider-05 Aug 9, 2024
d3455a8
Update publish options
ghostrider-05 Aug 9, 2024
01f7dc6
Update contributing wording
ghostrider-05 Aug 9, 2024
fe7e490
update config for improved media folders
ghostrider-05 Aug 9, 2024
8cdf05c
Add advanced frontmatter key
ghostrider-05 Aug 9, 2024
46754f1
fix lint warnings
ghostrider-05 Aug 9, 2024
3dd85ba
refactor collection paths and text configuration
ghostrider-05 Aug 12, 2024
df13c04
Update CODEOWNERS
ghostrider-05 Aug 12, 2024
2796505
fix lint errors
ghostrider-05 Aug 12, 2024
65449ce
move external link plugin to cms config
ghostrider-05 Aug 12, 2024
b6a8194
feat: switch to custom theme and Vue 3 (#59)
ghostrider-05 May 15, 2024
c2f3ccf
Update about and events (#60)
ghostrider-05 Jul 10, 2024
b8fc9ba
ci: bring back deploy action (#61)
ghostrider-05 Jul 10, 2024
b430d16
ci: add checkout action step
ghostrider-05 Jul 11, 2024
62431d3
ci: fix docker image tag
ghostrider-05 Jul 11, 2024
c7cc970
ci: add inputs for building only and Discord webhook
ghostrider-05 Jul 11, 2024
fcbe04b
install dependencies
ghostrider-05 Aug 8, 2024
2b02ee3
Add missing title in frontmatter
ghostrider-05 Aug 8, 2024
538b125
Use constants in configuration
ghostrider-05 Aug 8, 2024
acbf173
Add configuration for CMS
ghostrider-05 Aug 8, 2024
55617e8
lint: fix warnings
ghostrider-05 Aug 8, 2024
de7adac
Configure github auth
ghostrider-05 Aug 8, 2024
121f03e
fix: use workers domain
ghostrider-05 Aug 8, 2024
120aff6
switch to default branch for now
ghostrider-05 Aug 8, 2024
9f0bf46
Update contributing workflow for cms
ghostrider-05 Aug 9, 2024
55d0eec
Add code owners
ghostrider-05 Aug 9, 2024
b329b24
Update publish options
ghostrider-05 Aug 9, 2024
51e5497
Update contributing wording
ghostrider-05 Aug 9, 2024
c89d65d
update config for improved media folders
ghostrider-05 Aug 9, 2024
44ffb06
Add advanced frontmatter key
ghostrider-05 Aug 9, 2024
5cb077e
fix lint warnings
ghostrider-05 Aug 9, 2024
eec2f63
refactor collection paths and text configuration
ghostrider-05 Aug 12, 2024
5c3bbfd
Update CODEOWNERS
ghostrider-05 Aug 12, 2024
e9e210f
Merge remote-tracking branch 'upstream/master' into feat/cms
ghostrider-05 Aug 29, 2024
161d1bf
Merge branch 'feat/cms' of https://github.com/ghostrider-05/RL-docs i…
ghostrider-05 Aug 29, 2024
03b2182
Merge remote-tracking branch 'upstream/master' into feat/cms
ghostrider-05 Aug 29, 2024
b8a8a35
update dependencies
ghostrider-05 Aug 29, 2024
04afb55
Update config
ghostrider-05 Aug 29, 2024
c67b9fd
Update head.ts
ghostrider-05 Aug 29, 2024
105153f
update cms config
ghostrider-05 Aug 30, 2024
2c4a45c
update config
ghostrider-05 Aug 30, 2024
74d6e44
expose filter in cms options
ghostrider-05 Aug 30, 2024
8599f52
add custom container to editor
ghostrider-05 Aug 30, 2024
6139868
Update steam title home fields
ghostrider-05 Aug 30, 2024
fddf782
Save home page with cms
ghostrider-05 Aug 30, 2024
c11c163
Update attributes and comments
ghostrider-05 Sep 2, 2024
1ce6dec
Update configs
ghostrider-05 Sep 3, 2024
f9c2e60
Update contributing guide
ghostrider-05 Sep 3, 2024
3a745d3
ci: add seperate input for controlling pushing image
ghostrider-05 Sep 3, 2024
c3c304e
Update configs
ghostrider-05 Sep 4, 2024
a912707
Move some config to json
ghostrider-05 Sep 4, 2024
effc211
Update cms fields
ghostrider-05 Sep 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.json text
*.js text linguist-detectable
*.md text linguist-detectable
*.ts text linguist-detectable
*.{yml,yaml} text

*.png binary
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ on:
description: "The version of the website to deploy"
type: string
required: true
push_image:
description: "Push to remote. Disable to use an already pushed image with the same version"
type: boolean
default: true
deploy_image:
description: "Push and deploy this image. Disable to build only"
description: "Deploy the image using this version to the server"
type: boolean
default: true
send_webhook:
Expand Down Expand Up @@ -62,7 +66,7 @@ jobs:
id: docker
with:
context: .
push: ${{ github.event.inputs.deploy_image }}
push: ${{ github.event.inputs.push_image }}
# See https://github.com/docker/build-push-action/issues/535#issuecomment-1936723515
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_IMAGE_NAME }}:${{ github.event.inputs.version }}
deploy:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ node_modules
/docs/.vitepress/dist/
/docs/.vitepress/cache/
/.vitepress/cache/
/docs/.vitepress/public/admin/

# Do not commit API keys
.env
29 changes: 25 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
# Overview
# Workflow

Contribution should be performed through a number of simple steps:
Hi, we, the [guide maintainers](./README.md), are really exited that you are interested in contributing to this guide. Before contributing, decide what type of contribution you are looking to make:

- [Writing guide pages](#content-editing).
- Writing code. Before starting make sure to read:
- [The development workflow](#development)
- [The project guidelines](#guidelines)
- [Development setup guide](#development-and-local-testing)
- Becoming a team member: send a message to Mr. Swaggles or ghostrider-05 on Discord

## Content editing

To make changes to the content of the guide, we recommend to use the CMS ([Content Management System](https://en.wikipedia.org/wiki/Content_management_system)), available on the [`/admin/`](https://rocketleaguemapmaking.com/admin/) path or by clicking the `Edit this page` link on a guide page, to make your contributions through the following steps:

1. [Create a GitHub account](https://github.com/join)
2. Log in using your GitHub account on the [guide CMS](https://rocketleaguemapmaking.com/admin/).
3. Write guide pages while following [the guidelines](#guidelines).
4. When finished, save your edited pages and go to [the workflow UI](https://rocketleaguemapmaking.com/admin/#/workflow) and move your changes to the `In Review` column.
5. A maintainer will review your changes and merge the pull request on GitHub.

## Development

Code contributions should be performed through the following steps:

1. Find an issue to fix.
2. Fork the repository.
Expand Down Expand Up @@ -33,7 +54,7 @@ We have some minor style requirements for documentation additions:
- Images should be added in `/docs/.vitepress/public/images/{section}/` and icons in `/docs/.vitepress/public/icons`.
- Images and icons should have relevant file names to their content and be named in snake_case. Icons should also be prefixed by `logo_`.
- Images are not allowed directly in `/images/`, `/images/blender/` and `/images/udk/`, only the subdirectories of those folders.
- Image references in markdown should [have a good alt text](https://supercooldesign.co.uk/blog/how-to-write-good-alt-text). They can also have [a title](https://www.markdownguide.org/basic-syntax/#images-1) with a comment or small joke. Images of icons don't need to have an alt text.
- Image references in markdown should [have a good alt text](https://webaim.org/techniques/alttext/). They can also have [a title](https://www.markdownguide.org/basic-syntax/#images-1) with a comment or small joke. <!-- Some image alt text may be redundant, but that is something for later to check -->
- Images should have a line break (`---` with one white line above) between each other if no other text is between the images.
- [Create an issue](https://github.com/rocketleaguemapmaking/RL-docs/issues/new/choose) for small contributions (such as fixing typos or broken links).

Expand Down Expand Up @@ -85,4 +106,4 @@ Furthermore, this repo has the following `pageClass`es available:

The following components (not including the components registered by the theme) are also registered globally:

- `DocFeatures`
- [`DocFeatures`](https://theme-rlmm.pages.dev/components#docfeatures)
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

# Rocket League Mapmaking Website Documentation

[![GitHub package.json version](https://img.shields.io/github/package-json/v/rocketleaguemapmaking/rl-docs)][package.json]
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/RocketLeagueMapMaking/RL-docs/test.yml?branch=master&label=tests)][github-actions]
[![Website](https://img.shields.io/website?down_message=offline&up_message=online&url=https%3A%2F%2Frocketleaguemapmaking.com%2F)][domain]
[![Dev website](https://img.shields.io/website?down_message=offline&up_message=online&label=website@master&url=https%3A%2F%2Frocketleaguemapmaking.pages.dev%2F)][dev-domain]
[![GitHub package.json version](https://img.shields.io/github/package-json/v/rocketleaguemapmaking/rl-docs)][package.json]

- Guide by Mr Swaggles
- Site design by ghostrider-05
Expand All @@ -22,7 +22,8 @@ This site can be executed as a docker container on the host machine.
To update the site on the host machine, run [the `deploy` workflow](https://github.com/RocketLeagueMapmaking/RL-docs/actions/workflows/deploy.yml) on the default branch with the following inputs:

- version: the version to deploy. Generally the same as the version in [package.json](./package.json).
- deploy & push (default: `true`). Disable this to only build the Docker Image with deploying it.
- push (default: `true`). Controls whether to push the built image to Docker hub. If `deploy` is enabled and `push` is disabled, the server will use an already pushed image with the same `version`, or fail.
- deploy (default: `true`). Disable this to only build (and push) the Docker Image without deploying it.
- webhook message (default: `true`): send a Discord message with the deployment details when the workflow is finished.

See the GitHub documentation for [how to run a workflow manually](https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow#running-a-workflow).
Expand Down
52 changes: 52 additions & 0 deletions docs/.vitepress/config/cms/blocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { DecapCmsField } from 'vite-plugin-decap-cms'

type BlockFields = { summary?: string, contents: string, type: string }

export const customContainerBlock = {
id: 'custom-block',
label: 'Custom block',
fields: [
{
name: 'type',
label: 'Type of block',
widget: 'select',
required: true,
options: [
'details',
'warning',
'danger',
'info',
'tip',
// Not a custom container, but has the same syntax
'raw',
],
},
{
name: 'summary',
label: 'Summary',
required: false,
widget: 'string'
},
{
name: 'contents',
label: 'Contents',
required: true,
widget: 'markdown'
}
] satisfies DecapCmsField[],
// @ts-expect-error Needs flag to work
pattern: /^:::(\w+)(.*?)\n(.*?)\n^:::$/ms,
fromBlock: function (match: RegExpMatchArray): BlockFields {
return {
type: match[1],
summary: match[2],
contents: match[3]
}
},
toBlock: function (data: BlockFields) {
return `:::${data.type} ${data.summary}\n${data.contents}\n:::`
},
toPreview: function (data: BlockFields) {
return `:::${data.type} ${data.summary}\n${data.contents}\n:::`
},
}
147 changes: 147 additions & 0 deletions docs/.vitepress/config/cms/collections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import { type PageData } from 'vitepress'
import { type DecapCmsCollection } from 'vite-plugin-decap-cms'

import sidebar, { type Sidebar } from '../sidebar'

import {
createFeaturePageField,
createHomePageFields,
createSiteConfigFields,
createTeamPageField,
} from './fields'

import {
createAdvancedCollections,
createFileCollection,
createFolderCollection,
} from './options'

export const getCollectionItemEditLink = (page: Pick<PageData, 'filePath' | 'frontmatter'>) => {
const parts = page.filePath.slice(0, -'.md'.length).split('/')
const collectionName = parts.at(-2) + (page.frontmatter.advanced ? '_advanced' : ''), entryName = parts.at(-1)!

return `/admin/index.html#/edit/${collectionName}/${entryName}`
}

export default function (): DecapCmsCollection[] {
const sidebarItems = Object.values(<Sidebar>sidebar)

return [
createFileCollection('Special pages', [
{
name: 'Site configuration',
file: 'docs/.vitepress/config/data/config.json',
overwrites: {
deleted: true,
},
additionalFields: createSiteConfigFields(),
},
{
name: 'Home page',
file: 'docs/index.md',
overwrites: {
titleTemplate: { hidden: true },
head: { hidden: true },
body: { required: false },
},
additionalFields: createHomePageFields(),
},
], {
collection: {
create: false,
delete: false,
publish: false,
},
}),
createFileCollection('Special keys', [
{
name: 'About: teams & special thanks',
file: 'docs/more/about.md',
overwrites: {
hidden: true,
},
additionalFields: [
createTeamPageField(),
]
},
{
name: 'Features: map test - collision types',
file: 'docs/guide/udk/04_map_test.md',
overwrites: {
hidden: true,
},
additionalFields: [
createFeaturePageField({
name: 'collision_types',
label: 'Collision types',
label_singular: 'type',
}),
],
},
{
name: 'Features: building - next actions',
file: 'docs/guide/udk/06_owl.md',
overwrites: {
hidden: true,
},
additionalFields: [
createFeaturePageField({
name: 'next_actions',
label: 'Next actions',
label_singular: 'action',
}),
],
},
], {
collection: {
create: false,
delete: false,
publish: false,
},
}),

...sidebarItems
.filter(({ base }) => base === '/guide/')
.flatMap(({ items, meta }) => {
return items.flatMap(item => {
const dirname = item.base!.replace('/guide/', '').slice(0, -1)

if (dirname === 'udk') {
return createAdvancedCollections((type) => ({
base: item.base!,
name: dirname,
mediaFolder: dirname + '/',
label: meta.text! + ': Editor' + (type === 'advanced' ? ' advanced' : ''),
description: item.text! + ' ' + type + ' guide pages',
}))
}

return createFolderCollection({
base: item.base!,
name: dirname,
label: meta.text! + ': ' + item.text!,
description: item.text! + ' guide pages',
mediaFolder: dirname + '/',
})
})
}),

...createAdvancedCollections((type) => ({
base: '/guide/blender/',
name: 'blender',
mediaFolder: `blender/${type}/`,
label: 'Blender' + (type === 'advanced' ? ': advanced' : ''),
description: `Blender ${type} guide pages`,
})),

...sidebarItems
.filter(({ base }) => !base.startsWith('/guide/'))
.flatMap(({ items, base, meta: config }) => {
return createFolderCollection({
base,
label: config.text ?? items[0].text!,
mediaFolder: '',
})
}),
]
}
Loading