mirror of https://github.com/knative/docs.git
Build blog and community with hugo (#3558)
* Build blog and community with hugo * Use http-server instead of serve * Add package.json and ignore temp
This commit is contained in:
parent
5e9b4024ff
commit
67fda06b05
|
@ -5,6 +5,8 @@
|
||||||
__pycache__
|
__pycache__
|
||||||
hack/__pycache__
|
hack/__pycache__
|
||||||
/site/
|
/site/
|
||||||
|
/temp/
|
||||||
|
/node_modules/
|
||||||
|
|
||||||
|
|
||||||
.settings/
|
.settings/
|
||||||
|
|
|
@ -11,3 +11,12 @@
|
||||||
width: 3rem;
|
width: 3rem;
|
||||||
height: 2.4rem;
|
height: 2.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.md-tabs {
|
||||||
|
border-bottom: 1px solid var(--home-color);
|
||||||
|
}
|
||||||
|
.md-tabs__list li:nth-last-child(1),
|
||||||
|
.md-tabs__list li:nth-last-child(2) {
|
||||||
|
background: var(--home-color);
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Builds blog and community into the site by cloning the website repo, copying blog/community dirs in, running hugo.
|
||||||
|
# - Results are written to site/ as normal.
|
||||||
|
# - Run as "./hack/build-with-blog.sh serve" to run a local preview server on site/ afterwards (requires `npm install -g http-server`).
|
||||||
|
|
||||||
|
# Quit on error
|
||||||
|
set -e
|
||||||
|
# Echo each line
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# First, build the main site with mkdocs
|
||||||
|
rm -rf site/
|
||||||
|
mkdocs build -d site/docs
|
||||||
|
|
||||||
|
# Re-Clone
|
||||||
|
# TODO(jz) Cache this and just do a pull/update for local dev flow.
|
||||||
|
# Maybe also support local checkout in siblings?
|
||||||
|
rm -rf temp
|
||||||
|
mkdir temp
|
||||||
|
git clone --recurse-submodules https://github.com/knative/website temp/website
|
||||||
|
git clone https://github.com/knative/community temp/community
|
||||||
|
|
||||||
|
# Move blog files into position
|
||||||
|
mkdir -p temp/website/content/en
|
||||||
|
cp -r blog temp/website/content/en/
|
||||||
|
|
||||||
|
# Clone community/ in to position too
|
||||||
|
# This is pretty weird: the base community is in docs, but then the
|
||||||
|
# community repo is overlayed into the community/contributing subdir.
|
||||||
|
cp -r community temp/website/content/en/
|
||||||
|
cp -r temp/community/* temp/website/content/en/community/contributing/
|
||||||
|
rm -r temp/website/content/en/community/contributing/elections/2021-TOC # Temp fix for markdown that confuses hugo.
|
||||||
|
|
||||||
|
# Run the hugo build as normal!
|
||||||
|
pushd temp/website
|
||||||
|
hugo
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Hugo builds to public/, just copy over to site/ to match up with mkdocs
|
||||||
|
mv temp/website/public/blog site/
|
||||||
|
mv temp/website/public/community site/
|
||||||
|
mv temp/website/public/css site/
|
||||||
|
mv temp/website/public/scss site/
|
||||||
|
mv temp/website/public/webfonts site/
|
||||||
|
mv temp/website/public/images site/
|
||||||
|
mv temp/website/public/js site/
|
||||||
|
|
||||||
|
# Home page is served from docs, so add a redirect.
|
||||||
|
# TODO(jz) in production this should be done with a netlify 301 (or maybe just copy docs/index up with a base set).
|
||||||
|
cat << EOF > site/index.html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Redirecting</title>
|
||||||
|
<noscript>
|
||||||
|
<meta http-equiv="refresh" content="1; url=../dev/" />
|
||||||
|
</noscript>
|
||||||
|
<script>
|
||||||
|
window.location.replace("/docs/");
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Redirecting to <a href="/docs/">/docs/</a>...
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -rf temp
|
||||||
|
|
||||||
|
if [ "$1" = "serve" ]; then
|
||||||
|
pushd site
|
||||||
|
npx http-server
|
||||||
|
popd
|
||||||
|
fi
|
|
@ -194,7 +194,8 @@ nav:
|
||||||
- Client:
|
- Client:
|
||||||
- CLI tools: client/README.md
|
- CLI tools: client/README.md
|
||||||
- Install kn: client/install-kn.md
|
- Install kn: client/install-kn.md
|
||||||
- Community: todo
|
- "Join the Community ➠": /community/
|
||||||
|
- "Read the Blog ➠": /blog/
|
||||||
|
|
||||||
theme:
|
theme:
|
||||||
name: material
|
name: material
|
||||||
|
@ -231,6 +232,7 @@ markdown_extensions:
|
||||||
- pymdownx.superfences
|
- pymdownx.superfences
|
||||||
- pymdownx.tabbed
|
- pymdownx.tabbed
|
||||||
- pymdownx.details
|
- pymdownx.details
|
||||||
|
- pymdownx.snippets
|
||||||
- pymdownx.keys
|
- pymdownx.keys
|
||||||
- pymdownx.caret
|
- pymdownx.caret
|
||||||
- pymdownx.mark
|
- pymdownx.mark
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "knative",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "Knative docs",
|
||||||
|
"main": "index.js",
|
||||||
|
"devDependencies": {
|
||||||
|
"autoprefixer": "^9.8.6",
|
||||||
|
"http-server": "^0.12.3",
|
||||||
|
"postcss-cli": "^6.1.3"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/knative/docs.git"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/knative/docs/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://knative.dev",
|
||||||
|
"engines": {
|
||||||
|
"node": ">12.0"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue