Skip to content

Commit c4a0d2e

Browse files
author
Sam Kleinman
committed
DOCS-374 integrating sitemap into the build system
1 parent 60f6a53 commit c4a0d2e

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

bin/sitemap_gen.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/python
2-
#
31
# Copyright (c) 2004, 2005 Google Inc.
42
# All rights reserved.
53
#
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<site
33
base_url="http://docs.mongodb.org/manual/"
4-
store_into="build/dirhtml/sitemap.xml.gz"
4+
store_into="build/sitemap.xml.gz"
55
verbose="1"
66
>
77

makefile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# You can set these variables from the command line.
44
SPHINXOPTS = -c ./
55
SPHINXBUILD = sphinx-build
6-
SITEMAPBUILD = bin/sitemap_gen.py
76
PAPER =
87

98
# change this to reflect the location of the public repo
@@ -28,8 +27,16 @@ endif
2827
ifeq ($(UNAME), Darwin)
2928
SED_ARGS_FILE = -i "" -E
3029
SED_ARGS_REGEX = -E
30+
PYTHONBIN = python
3131
endif
3232

33+
ifeq ($(shell test -f /etc/arch-release && echo arch || echo Linux),arch)
34+
PYTHONBIN = python2
35+
else
36+
PYTHONBIN = python
37+
endif
38+
39+
3340
# Internal variables.
3441
PAPEROPT_a4 = -D latex_paper_size=a4
3542
PAPEROPT_letter = -D latex_paper_size=letter
@@ -98,7 +105,7 @@ setup:
98105
mkdir -p $(BUILDDIR)/{dirhtml,singlehtml,html,epub,latex} $(CURRENTBUILD)/single
99106

100107
deploy-one:source/about.txt $(BUILDDIR)/html
101-
deploy-two:$(CURRENTBUILD) $(CURRENTBUILD)/release.txt $(CURRENTBUILD)/MongoDB-Manual.pdf $(CURRENTBUILD)/MongoDB-Manual.epub
108+
deploy-two:$(CURRENTBUILD) $(CURRENTBUILD)/release.txt $(CURRENTBUILD)/MongoDB-Manual.pdf $(CURRENTBUILD)/MongoDB-Manual.epub $(CURRENTBUILD)/sitemap.xml.gz
102109
deploy-three:$(CURRENTBUILD)/single $(CURRENTBUILD)/single/search.html $(CURRENTBUILD)/single/genindex.html $(CURRENTBUILD)/single/index.html
103110
deploy-four:$(publication-output)/index.html $(publication-output)/10gen-gpg-key.asc $(CURRENTBUILD)/tutorials $(CURRENTBUILD)/.htaccess
104111

@@ -108,6 +115,7 @@ deploy-four:$(publication-output)/index.html $(publication-output)/10gen-gpg-key
108115
$(BUILDDIR)/epub/MongoDB.epub:epub
109116
$(BUILDDIR)/latex/MongoDB.tex:latex
110117
$(BUILDDIR)/latex/MongoDB.pdf:$(BUILDDIR)/latex/MongoDB.tex
118+
$(BUILDDIR)/sitemap.xml.gz:$(BUILDDIR)/dirhtml
111119

112120
$(BUILDDIR)/singlehtml/contents.html:$(BUILDDIR)/singlehtml
113121
$(BUILDDIR)/dirhtml/search/index.html:$(BUILDDIR)/dirhtml
@@ -152,6 +160,8 @@ $(CURRENTBUILD)/single/index.html:$(BUILDDIR)/singlehtml/contents.html
152160
@sed $(SED_ARGS_FILE) -e 's/href="contents.html/href="index.html/g' $@
153161
@sed $(SED_ARGS_FILE) -e 's/name="robots" content="index"/name="robots" content="noindex"/g' $@
154162
@echo "[SINGLE]: generating '$@'"
163+
$(CURRENTBUILD)/sitemap.xml.gz:$(BUILDDIR)/sitemap.xml.gz
164+
cp $< $@
155165

156166
# Deployment related work for the non-Sphinx aspects of the build.
157167
$(CURRENTBUILD)/release.txt:$(publication-output)/manual
@@ -207,10 +217,11 @@ epub:
207217
@{ $(epub-command) 2>&1 1>&3 | $(epub-filter) 1>&2; } 3>&1
208218
@echo "[EPUB] Build complete."
209219

210-
# --testing creates sitemap but does not notify Google of new
211-
# sitemap.xml
212-
sitemap:
213-
$(SITEMAPBUILD) --testing --config=sitemap-config.xml
220+
SITEMAPBUILD = $(PYTHONBIN) bin/sitemap_gen.py
221+
sitemap:$(BUILDDIR)/sitemap.xml.gz
222+
$(BUILDDIR)/sitemap.xml.gz:
223+
$(SITEMAPBUILD) --testing --config=conf-sitemap.xml
224+
@echo "[SITEMAP] sitemap built."
214225

215226

216227
######################################################################

0 commit comments

Comments
 (0)