mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-25 14:08:30 +02:00
* feat(build): publish each page's markdown at /path.md as well as /path/index.md Hugo writes the Markdown output format beside the HTML it belongs to, so a page at /articles/foo/ is published at /articles/foo/index.md. That is correct and it stays: it is what the llms.txt convention prescribes for directory-style URLs, it is the form /llms.txt already advertises for 670 pages, and it is the target of the <link rel="alternate" type="text/markdown"> we emit in every page head. What it is not is guessable. Every other documentation site I compared exposes a page's markdown by swapping the extension, so a client holding only a URL can construct /articles/foo.md directly instead of first fetching the HTML to read the alternate link: /articles/immutable-data-structures.md 404 -> 200 text/markdown /articles/immutable-data-structures/index.md 200 200 (unchanged) So publish both. A post-build step copies every public/**/index.md to public/**.md; the originals are untouched, so no published URL changes. Netlify already serves .md as text/markdown, and the files are small: 7.6 MB against a 1.4 GB build, 0.5%. Deliberately a build step rather than a Netlify redirect. A splat has to be terminal, so /articles/*.md is not a pattern Netlify accepts, and a rule that cannot be verified locally is worse than a copy that can. Adds npm run md:test, which builds the site, runs the script over the output and checks all 789 aliases exist and match their source byte for byte, that the canonical index.md and index.html are untouched, that nothing is written outside the publish directory, and that a second run overwrites nothing. Verified the tests fail when the script is stubbed out. The test deletes its build directory on exit. A build is ~1.4 GB, and a suite that leaves temp directories behind fills a disk faster than anyone notices. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * test(md): cut the alias tests down, and keep master's npm scripts Review: the tests were redundant. Two of the four asserted what cp does, and all four needed a full ~1.4 GB Hugo build to say it. Replaced with two tests over a synthetic directory, covering the only two things the script decides: skip the site root, never overwrite an existing file. 87 lines to 39, and the run drops from a full site build to 0.26s. package.json: this branch predates the charts work, so its scripts block replaced master's. Merging as-is would have silently deleted viz:test and viz:charts. Now keeps both and adds md:test. Also trims the script's comment header from 19 lines to 8. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * test(md): drop the npm script, run the test file directly package.json is the site's manifest; a runner alias for one shell script does not belong in it. The test runs as: node --test test/markdown/aliases.test.mjs package.json is now untouched by this branch, which also removes the risk of the merge dropping master's viz scripts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
36 lines
1.4 KiB
Bash
36 lines
1.4 KiB
Bash
#!/bin/bash
|
|
|
|
DART_SASS_VERSION=${DART_SASS_VERSION:-1.70.0}
|
|
DEPLOY_PRIME_URL=${DEPLOY_PRIME_URL:-"https://qdrant.com"}
|
|
|
|
CURRENT_DIR=$(pwd)
|
|
|
|
REQUIRED_HUGO_VERSION="0.160.1"
|
|
INSTALLED_HUGO_VERSION=$(hugo version | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1 | tr -d 'v')
|
|
if [ "${INSTALLED_HUGO_VERSION}" != "${REQUIRED_HUGO_VERSION}" ]; then
|
|
echo "Error: Hugo version ${REQUIRED_HUGO_VERSION} is required, but found ${INSTALLED_HUGO_VERSION}."
|
|
echo "See https://gohugo.io/installation/ for installation instructions."
|
|
exit 1
|
|
fi
|
|
|
|
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
ARCH=$(uname -m)
|
|
case "${OS}" in
|
|
linux) SASS_OS="linux" ;;
|
|
darwin) SASS_OS="macos" ;;
|
|
*) echo "Error: Unsupported OS: ${OS}"; exit 1 ;;
|
|
esac
|
|
case "${ARCH}" in
|
|
x86_64) SASS_ARCH="x64" ;;
|
|
aarch64|arm64) SASS_ARCH="arm64" ;;
|
|
*) echo "Error: Unsupported architecture: ${ARCH}"; exit 1 ;;
|
|
esac
|
|
SASS_ARCHIVE="dart-sass-${DART_SASS_VERSION}-${SASS_OS}-${SASS_ARCH}.tar.gz"
|
|
|
|
curl -LJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/${SASS_ARCHIVE}" && \
|
|
tar -xf "${SASS_ARCHIVE}" && \
|
|
rm "${SASS_ARCHIVE}" && \
|
|
export PATH="${CURRENT_DIR}/dart-sass:${PATH}" && \
|
|
cd qdrant-landing && npm install && hugo --gc --minify --config config.toml,config-theme.toml --buildFuture -b ${DEPLOY_PRIME_URL} && \
|
|
./scripts/emit-md-aliases.sh public
|