Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion blog/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ plugins:
copyright: "Copyright © 2024 The Knative Authors"

extra:
homepage: https://knative.dev/docs
homepage: https://knative.dev
# social:
# - icon: fontawesome/brands/twitter
# link: https://twitter.com/KnativeProject
Expand Down
14 changes: 0 additions & 14 deletions config/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,17 +349,3 @@ nav:
- Verifying Knative Binaries: reference/security/verifying-cli.md
- Release notes: reference/relnotes/README.md
- Blog: /blog/
- About:
- Testimonials: about/testimonials.md
- Case studies:
- List of Case Studies: about/case-studies/README.md
- deepc: about/case-studies/deepc.md
- IBM: about/case-studies/ibm.md
- Outfit7: about/case-studies/outfit7.md
- Puppet: about/case-studies/puppet.md
- PNC Bank: about/case-studies/pnc.md
- SVA: about/case-studies/sva.md
- Community:
- How To Get Involved: community/README.md
- Contribute to Knative: community/contributing.md
- Community Rules and Practices: community/governance.md
110 changes: 49 additions & 61 deletions hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set -x
# 1) Make a release-NN branch as normal.
# 2) Update VERSIONS below (on main) to include the new version, and remove the oldest
# Order matters :-), Most recent first.
VERSIONS=("1.18" "1.17") # Docs version, results in the url e.g. knative.dev/docs-1.9/..
VERSIONS=("1.19" "1.18" "1.17") # Docs version, results in the url e.g. knative.dev/v1.9-docs/..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not quite ready to release 1.19 -- the OpenTelemetry changes came in late and we've had to push some bug fixes.

# 4) PR the result to main.
# 5) Party.

Expand All @@ -41,55 +41,61 @@ readonly SITE=$PWD/site
rm -rf site/

if [ "$BUILD_VERSIONS" == "no" ]; then
# HEAD to /docs if we're not doing versioning.
mkdocs build -f mkdocs.yml -d site/docs
# Build to root if we're not doing versioning
mkdocs build -f mkdocs.yml -d site
Comment on lines 43 to +45
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this "tiny build for preview" seems to potentially be the part that's messing things up. I wonder if we want to remove it for now, and leave a TODO to optimize this later. (The preview version is also not importing the serving/eventing reference docs, and makes it hard to reason about these sorts of changes from the preview.)

else
# Versioning: pre-release (HEAD): docs => development/
cp -r . $TEMP/docs-main
# Build latest version to /docs
cp -r . "$TEMP/docs-main"
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/main/docs/serving-api.md -s > "$TEMP/docs-main/docs/serving/reference/serving-api.md"
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/main/docs/eventing-api.md -s > "$TEMP/docs-main/docs/eventing/reference/eventing-api.md"
pushd "$TEMP/docs-main"; mkdocs build -f mkdocs.yml -d $SITE/development; popd

# Latest release branch to /docs
git clone --depth 1 -b ${DOCS_BRANCHES[0]} https://github.com/${GIT_SLUG} "$TEMP/docs-$latest"

if [ ${latest#*1.} -gt 6 ]; then
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/${DOCS_BRANCHES[0]}/docs/serving-api.md -s > "$TEMP/docs-$latest/docs/serving/reference/serving-api.md"
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/${DOCS_BRANCHES[0]}/docs/eventing-api.md -s > "$TEMP/docs-$latest/docs/eventing/reference/eventing-api.md"
else
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/${DOCS_BRANCHES[0]}/docs/serving-api.md -s > "$TEMP/docs-$latest/docs/reference/api/serving-api.md"
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/${DOCS_BRANCHES[0]}/docs/eventing-api.md -s > "$TEMP/docs-$latest/docs/reference/api/eventing-api.md"
fi

pushd "$TEMP/docs-$latest"; KNATIVE_VERSION="${VERSIONS[0]}.0" SAMPLES_BRANCH="${DOCS_BRANCHES[0]}" mkdocs build -d $SITE/docs; popd

# Previous release branches release-$version to /v$version-docs

# Create docs directory structure
mkdir -p "$SITE/docs"

# Build latest docs to /docs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were building the next-release docs to /development/... and the most-recent-release docs to /docs/.... I think you've changed this to build the next-release docs to /docs/..., and not publish docs for the current release anywhere.

pushd "$TEMP/docs-main"
KNATIVE_VERSION="${VERSIONS[0]}.0" SAMPLES_BRANCH="${DOCS_BRANCHES[0]}" mkdocs build -d "$SITE/docs"
popd

# Build versioned docs to /vX.Y-docs/
for i in "${!previous[@]}"; do
version="${previous[$i]}"
branch="${DOCS_BRANCHES[$((i+1))]}"

git clone --depth 1 -b "$branch" "https://github.com/$GIT_SLUG" "$TEMP/docs-$version"

# Fetch API reference docs for versioned builds
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/$branch/docs/serving-api.md -s > "$TEMP/docs-$version/docs/serving/reference/serving-api.md"
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/$branch/docs/eventing-api.md -s > "$TEMP/docs-$version/docs/eventing/reference/eventing-api.md"

pushd "$TEMP/docs-$version"
KNATIVE_VERSION="$version.0" SAMPLES_BRANCH="$branch" mkdocs build -d "$SITE/v$version-docs"
popd
done

# Build development site
pushd "$TEMP/docs-main"
KNATIVE_VERSION="${VERSIONS[0]}.0" SAMPLES_BRANCH="${DOCS_BRANCHES[0]}" mkdocs build -f mkdocs.yml -d "$SITE/development"
popd
Comment on lines +76 to +79
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we repeating 56-58 here?


# Move non-versioned content to root level
mkdir -p "$SITE/about"
cp -r "$TEMP/docs-main/docs/about" "$SITE/"
mkdir -p "$SITE/community"
cp -r "$TEMP/docs-main/docs/community" "$SITE/"
Comment on lines +81 to +85
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may break links for images, CSS, and JavaScript for these pages. I'll attempt another build with your changes this afternoon (I avoided this PR yesterday because I had a few other items and I really got pulled in on Friday).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The index.html did seem to mostly work with just a copy, mostly because that page is largely hand-crafted HTML.

There are still a few items I'm trying to figure out in the navigation -- like why the "blog", "about", and "community" links don't show up in the navigation tabs, despite being in nav.html.


# Copy index.html and sitemap.xml to root
cp "$SITE/docs/index.html" "$SITE/"
cp "$SITE/docs/sitemap.xml" "$SITE/"

# Create version JSON for version picker
versionjson=""
for i in "${!previous[@]}"; do
version=${previous[$i]}
versionjson+="{\"version\": \"v$version-docs\", \"title\": \"v$version\", \"aliases\": [\"\"]},"
Comment on lines +91 to 95
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously in the loop on 60-74. I don't have a strong opinion, but it feels slightly odd to have the same loop twice with some other actions in between.


echo "Building for previous version $version"
git clone --depth 1 -b ${DOCS_BRANCHES[$i+1]} https://github.com/${GIT_SLUG} "$TEMP/docs-$version"
if [ ${version#*1.} -gt 6 ]; then
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/${DOCS_BRANCHES[i+1]}/docs/serving-api.md -s > "$TEMP/docs-$version/docs/serving/reference/serving-api.md"
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/${DOCS_BRANCHES[i+1]}/docs/eventing-api.md -s > "$TEMP/docs-$version/docs/eventing/reference/eventing-api.md"
else
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/${DOCS_BRANCHES[i+1]}/docs/serving-api.md -s > "$TEMP/docs-$version/docs/reference/api/serving-api.md"
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/${DOCS_BRANCHES[i+1]}/docs/eventing-api.md -s > "$TEMP/docs-$version/docs/reference/api/eventing-api.md"
fi
pushd "$TEMP/docs-$version"; KNATIVE_VERSION="${VERSIONS[i+1]}.0" SAMPLES_BRANCH="${DOCS_BRANCHES[i+1]}" VERSION_WARNING=true mkdocs build -d "$SITE/v$version-docs"; popd

done

# Set up the version file to point to the built docs.
cat << EOF > $SITE/versions.json
[
{"version": "docs", "title": "v$latest", "aliases": [""]},
$versionjson
{"version": "development", "title": "(Pre-release)", "aliases": [""]}
]
EOF
versionjson="[{\"version\": \"docs\", \"title\": \"latest\", \"aliases\": [\"\"]},$versionjson]"
echo "$versionjson" > "$SITE/versions.json"
fi

# Create the blog
Expand All @@ -107,25 +113,7 @@ cp golang/*.html site/golang/
cat golang/_redirects >> site/_redirects


# Home page is served from docs, so add a redirect.
cat << EOF > site/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting</title>
<noscript>
<meta http-equiv="refresh" content="1; url=docs/" />
</noscript>
<script>
window.location.replace("docs/");
</script>
</head>
<body>
Redirecting to <a href="docs/">docs/</a>...
</body>
</html>
EOF
# Home page is now served directly from root, no redirect needed

# Clean up
rm -rf $TEMP
Expand Down
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
INHERIT: config/nav.yml

site_name: Knative
site_url: https://knative.dev/docs
site_url: https://knative.dev
site_description: Knative Documentation
extra_css:
- stylesheets/extra.css

repo_url: https://github.com/knative/docs
edit_uri: edit/main/docs
edit_uri: edit/main

theme:
name: material
Expand Down
89 changes: 85 additions & 4 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Settings in the [build] context are global and are applied to all contexts
# unless otherwise overridden by more specific contexts.
[build]
command = "./hack/build.sh"
command = "hack/build.sh"
publish = "site"

[build.environment]
NODE_VERSION= "14"
PYTHON_VERSION = "3.8"
PYTHON_VERSION = "3.9"
NODE_VERSION = "16"
NPM_VERSION = "8.5.5"

# Deploy Preview context: all deploys generated from a pull/merge request will
# inherit these settings.
Expand All @@ -17,16 +18,96 @@
[context.deploy-preview.environment]
BUILD_VERSIONS="no"

# Handle versioned docs
[[redirects]]
from = "/contributing/"
from = "/v:version-docs/*"
to = "/v:version-docs/:splat"
status = 200

# Redirect old versioned docs to new paths
[[redirects]]
from = "/docs-:version/*"
to = "/v:version-docs/:splat"
status = 301

# Redirect root to /docs for the latest version
[[redirects]]
from = "/"
to = "/docs"
status = 200

# Handle /docs paths
[[redirects]]
from = "/docs"
to = "/docs/"
status = 301

[[redirects]]
from = "/docs/*"
to = "/docs/:splat"
status = 200

# Handle old about and community URLs (root level to /docs/)
[[redirects]]
from = "/about"
to = "/docs/about/"
status = 301

[[redirects]]
from = "/about/*"
to = "/docs/about/:splat"
status = 301

[[redirects]]
from = "/community"
to = "/docs/community/"
status = 301

[[redirects]]
from = "/community/*"
to = "/docs/community/:splat"
status = 301

# Handle blog URLs
[[redirects]]
from = "/blog/*"
to = "/blog/:splat"
status = 200

# Handle old development URLs
[[redirects]]
from = "/development/*"
to = "/docs/:splat"
status = 301

# Handle old API reference URLs
[[redirects]]
from = "/reference/api/*"
to = "/docs/reference/api/:splat"
status = 301

# Handle old serving and eventing reference URLs
[[redirects]]
from = "/serving/reference/*"
to = "/docs/serving/reference/:splat"
status = 301

[[redirects]]
from = "/eventing/reference/*"
to = "/docs/eventing/reference/:splat"
status = 301

# Keep existing contributor redirects
[[redirects]]
from = "/contributing/"
to = "/docs/community/"
status = 301

[[redirects]]
from = "/help/contributing/"
to = "https://github.com/knative/docs/blob/main/contribute-to-docs/README.md"
status = 301

[[redirects]]
from = "/docs/help/contributor/*"
to = "https://github.com/knative/docs/blob/main/contribute-to-docs/README.md"
Expand Down
4 changes: 2 additions & 2 deletions overrides/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</a>
</li>
<li class="md-tabs__item">
<a href="/docs/about/testimonials/" class="md-tabs__link">
<a href="/about/testimonials/" class="md-tabs__link">
About
</a>
</li>
Expand All @@ -107,7 +107,7 @@
</a>
</li>
<li class="md-tabs__item">
<a href="/docs/community/" class="md-tabs__link">
<a href="/community/" class="md-tabs__link">
Community
</a>
</li>
Expand Down