diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..dce544a69 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +--- +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + groups: + actions: + patterns: ["*"] diff --git a/.github/workflows/verify-redirects.yml b/.github/workflows/verify-redirects.yml new file mode 100644 index 000000000..c24d6d452 --- /dev/null +++ b/.github/workflows/verify-redirects.yml @@ -0,0 +1,77 @@ +--- +name: Verify redirects + +on: + pull_request: + paths: + - .netlify.toml + - content/version/3/0/** + - hugo.toml + - static/_redirects + - static/scripts/builder.js + push: + branches: + - release + workflow_dispatch: + +permissions: + contents: read + +jobs: + verify-redirects: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup Hugo + run: | + HUGO_VERSION="0.155.0" + wget -q "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb" -O hugo.deb + sudo dpkg -i hugo.deb + hugo version + - name: Build site + run: hugo --quiet + - name: Verify uppercase file exists + run: | + if [ -f "public/version/3/0/code_of_conduct/CODE_OF_CONDUCT.md" ]; then + echo "::info::✓ CODE_OF_CONDUCT.md exists" + else + echo "::error::✗ CODE_OF_CONDUCT.md does NOT exist" + exit 1 + fi + - name: Verify cased filenames + run: | + echo "Files generated by Hugo:" + ls -la public/version/3/0/code_of_conduct/*.md 2>/dev/null || true + + if [ -f "public/version/3/0/code_of_conduct/code_of_conduct.md" ]; then + echo "::error::✗ code_of_conduct.md exists (should NOT exist)" + exit 1 + else + echo "::info::✓ code_of_conduct.md does NOT exist (correct - redirect will work)" + fi + + # Verify uppercase exists + if [ -f "public/version/3/0/code_of_conduct/CODE_OF_CONDUCT.md" ]; then + echo "::info::✓ CODE_OF_CONDUCT.md exists (correct)" + else + echo "::error::✗ CODE_OF_CONDUCT.md NOT found" + exit 1 + fi + - name: Verify _redirects file exists + run: | + if [ -f "public/_redirects" ]; then + echo "::info::✓ _redirects file exists" + cat public/_redirects + else + echo "::error::✗ _redirects file does NOT exist" + exit 1 + fi + - name: Verify redirect rule exists + run: | + if grep -q "/version/3/0/code_of_conduct/code_of_conduct.md.*CODE_OF_CONDUCT.md" public/_redirects; then + echo "::info::✓ Redirect rule found in _redirects" + else + echo "::error::✗ Redirect rule NOT found in _redirects" + exit 1 + fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 86b64912a..78a6dd87e 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,7 @@ If you are a native speaker interested in doing a translation, please follow the 1. Fork the repository and make a branch for your translation. 1. If it's a new language, add it to `config.toml`, with a localized name and language code/optional region (e.g. `pt` or `pt-br`). -1. Create a markdown file with your translation in `version/3/0/code_of_conduct.LANGUAGECODE.md`. (Underscores, not hyphens.) Use the English markdown file as an example. +1. Create a markdown file with your translation in `version/3/0/CODE_OF_CONDUCT.LANGUAGECODE.md`. (Underscores, not hyphens.) Use the English markdown file as an example. 1. Update the two fields at the top of your new markdown file: `reportingPlaceholder`, which should contain the exact placeholder text in the "how to report" section, and `enforcementPlaceholder`, which should contain the exact placeholder text in the "Addressing and Repairing Harm" section. 1. Open a pull request. 1. We will put out a call to have one or more other native speakers review the translation. diff --git a/content/version/3/0/code_of_conduct.bn.md b/content/version/3/0/code_of_conduct.bn.md index 6b38922b9..84530b97e 100644 --- a/content/version/3/0/code_of_conduct.bn.md +++ b/content/version/3/0/code_of_conduct.bn.md @@ -2,6 +2,7 @@ title = "Contributor Covenant 3" version = "3.0" aliases = ["/version/3/0/bn"] +slug = "code_of_conduct" reportingPlaceholder = "[দ্রষ্টব্য: এখানে আপনার রিপোর্ট করার পদ্ধতি বর্ণনা করুন.]" enforcementPlaceholder = "[দ্রষ্টব্য: নীচে বর্ণিত প্রতিকার ও মেরামতি প্রক্রিয়াগুলি আচরণবিধি প্রয়োগের উত্তম চর্চার উপর ভিত্তি করে পরামর্শ মাত্র। আপনার দলের নিজস্ব প্রয়োগ প্রক্রিয়া থাকলে, অনুগ্রহ করে এই অংশটি আপনার নীতিমালা অনুযায়ী সম্পাদনা করুন.]" +++ diff --git a/content/version/3/0/code_of_conduct.de.md b/content/version/3/0/code_of_conduct.de.md index 4215d43cb..a9a842e0a 100644 --- a/content/version/3/0/code_of_conduct.de.md +++ b/content/version/3/0/code_of_conduct.de.md @@ -2,6 +2,7 @@ title = "Contributor Covenant 3" version = "3.0" aliases = ["/version/3/0/de"] +slug = "code_of_conduct" reportingPlaceholder = "[ANMERKUNG: Beschreiben Sie hier Ihr Meldeverfahren.]" enforcementPlaceholder = "[ANMERKUNG: Die unten aufgeführten Maßnahmen bei Verstößen und zur Wiedergutmachung sind Vorschläge basierend auf bewährten Praktiken der Durchsetzung von Verhaltenskodizes. Wenn Ihre Gemeinschaft eigene Verfahren hat, passen Sie diesen Abschnitt entsprechend an.]" +++ diff --git a/content/version/3/0/code_of_conduct.md b/content/version/3/0/code_of_conduct.md index 8c41b5802..9064d94e1 100755 --- a/content/version/3/0/code_of_conduct.md +++ b/content/version/3/0/code_of_conduct.md @@ -2,6 +2,7 @@ title = "Contributor Covenant 3" version = "3.0" aliases = ["/version/3/0"] +slug = "code_of_conduct" reportingPlaceholder = "[NOTE: describe your means of reporting here.]" enforcementPlaceholder = "[NOTE: The remedies and repairs outlined below are suggestions based on best practices in code of conduct enforcement. If your community has its own established enforcement process, be sure to edit this section to describe your own policies.]" +++ diff --git a/content/version/3/0/code_of_conduct.zh-cn.md b/content/version/3/0/code_of_conduct.zh-cn.md index a85c2a9a9..1c371d1e5 100644 --- a/content/version/3/0/code_of_conduct.zh-cn.md +++ b/content/version/3/0/code_of_conduct.zh-cn.md @@ -2,6 +2,7 @@ title = "Contributor Covenant 3" version = "3.0" aliases = ["/version/3/0/cn"] +slug = "code_of_conduct" reportingPlaceholder = "[注意:请在此填入举报方式]" enforcementPlaceholder = "[注意:下文所列的处理办法与补救措施,是基于行为准则执行过程中的最佳做法而提出的建议。如果你们的社区已经有既定的执行流程,请确保修改本段内容,以描述你们自己的政策。]" +++ diff --git a/hugo.toml b/hugo.toml index 459e3c5b6..27962e125 100644 --- a/hugo.toml +++ b/hugo.toml @@ -3,6 +3,7 @@ baseURL = "https://www.contributor-covenant.org" languageCode = "en-us" title = "Contributor Covenant" disableKinds = ["RSS"] +disablePathToLower = true DefaultContentLanguage = "en" hasCJKLanguage = true diff --git a/static/_redirects b/static/_redirects new file mode 100644 index 000000000..ec4140b9a --- /dev/null +++ b/static/_redirects @@ -0,0 +1,5 @@ +# Redirect lowercase filename to canonical format: code_of_conduct/CODE_OF_CONDUCT.md +/version/3/0/code_of_conduct/code_of_conduct.md /version/3/0/code_of_conduct/CODE_OF_CONDUCT.md +/version/3/0/bn/code_of_conduct/code_of_conduct.md /version/3/0/bn/code_of_conduct/CODE_OF_CONDUCT.md +/version/3/0/de/code_of_conduct/code_of_conduct.md /version/3/0/de/code_of_conduct/CODE_OF_CONDUCT.md +/version/3/0/zh-cn/code_of_conduct/code_of_conduct.md /version/3/0/zh-cn/code_of_conduct/CODE_OF_CONDUCT.md diff --git a/static/scripts/builder.js b/static/scripts/builder.js index 0ffe7eaa3..18aef4259 100644 --- a/static/scripts/builder.js +++ b/static/scripts/builder.js @@ -1,6 +1,14 @@ const initializeBuilder = async (languageCode, version, reportingPlaceholder, enforcementPlaceholder) => { const versionPath = version.replace(".", "/") - const sourceUrl = window.location.href.replace("adopt/",`${languageCode.replace("en","")}/version/${versionPath}/code_of_conduct/code_of_conduct.md`) + const versionMajor = parseInt(version.split('.')[0], 10); + const filename = versionMajor >= 3 ? "CODE_OF_CONDUCT.md" : "code_of_conduct.md"; + const sourceUrl = window.location.href.replace( + "adopt/", + `${languageCode.replace( + "en", + "" + )}/version/${versionPath}/code_of_conduct/${filename}` + ); const content = await readTemplate(sourceUrl) const template = document.getElementById('template') @@ -220,7 +228,7 @@ const downloadBuffer = () => { const a = document.createElement('a'); a.href = url; - a.download = "CODE_OF_CONDUCT.MD"; + a.download = "CODE_OF_CONDUCT.md"; a.style.display = 'none'; document.body.appendChild(a);