[website] adjust internal links in old latest when making a new version

Summary: A little bit of sed to adjust links (see previous commit for effect).

Reviewed By: skcho

Differential Revision: D27360106

fbshipit-source-id: 2fa32f05f
master
Jules Villard 4 years ago committed by Facebook GitHub Bot
parent 68b4b5cc27
commit 21ad5d64f6

@ -984,6 +984,13 @@ new-website-version: doc-publish
cd $(WEBSITE_DIR)/versioned_docs/version-$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ && \
find . -type f -not -name versions.md \
-exec sed -i -e 's#/next/#/$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/#g' \{\} \+
# adjust intra-doc links in the previous "latest" version: /docs/foo -> /docs/<oldlatest>/foo
# select the first version that is not the one we are creating (in case this target is run
# multiple times)
old_latest=$$(jq 'map(select(. != "$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)"))[0]' < $(WEBSITE_DIR)/versions.json | tr -d '"'); \
cd $(WEBSITE_DIR)/versioned_docs/version-$${old_latest}/ && \
find . -type f -not -name versions.md \
-exec sed -i -e "s#(/docs/\([^$$(echo $$old_latest | cut -b 1)]\)#(/docs/$${old_latest}/\1#g" \{\} \+
# adjust versions.md, the page where users can navigate to other versions of the docs, unless
# it was already changed by an earlier run of this rule
cd $(WEBSITE_DIR)/ && \

Loading…
Cancel
Save