git: 989bbd57fa - main - Makefiles: Add a conditional check on HOSTNAME variable

Daniel Ebdrup Jensen <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
The branch main has been updated by debdrup:

URL: https://cgit.FreeBSD.org/doc/commit/?id=989bbd57fa03b4efe7d920aeadeb0952c5960dda

commit 989bbd57fa03b4efe7d920aeadeb0952c5960dda
Author:     Daniel Ebdrup Jensen <[email protected]>
AuthorDate: 2021-02-14 21:39:20 +0000
Commit:     Daniel Ebdrup Jensen <[email protected]>
CommitDate: 2021-02-14 21:50:52 +0000

    Makefiles: Add a conditional check on HOSTNAME variable
    
    In order for hugo to build all links correctly, it is necessary to
    define baseURL - but in order to do this, we need some way of adding a
    hostname. This change adds the HOSTNAME variable to accomplish this.
    
    Another advantage is that if HOSTNAME is set to something other than
    localhost, hugo can be run on a different (more powerful) machine which
    can shorten the time it takes to build.
    
    A note about this will need to be added to the FDP later.
---
 documentation/Makefile | 8 +++++++-
 website/Makefile       | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/documentation/Makefile b/documentation/Makefile
index 57472063dd..3b5c1cfd65 100644
--- a/documentation/Makefile
+++ b/documentation/Makefile
@@ -19,6 +19,12 @@ PYTHON_CMD =	/usr/local/bin/python3.7
 HUGO_CMD =	/usr/local/bin/hugo
 LANGUAGES =	en,es,pt-br,de,ja,zh-cn,zh-tw,ru,el,hu,it,mn,nl,pl,fr
 
+.ifndef HOSTNAME
+.HOST+=localhost
+.else
+.HOST+=$(HOSTNAME)
+.endif
+
 .ORDER: all run
 
 .ORDER: starting-message generate-books-toc
@@ -41,7 +47,7 @@ generate-books-toc: .PHONY
 	${PYTHON_CMD} ./tools/books-toc-examples-creator.py -l ${LANGUAGES}
 
 run-local: .PHONY
-	${HUGO_CMD} server -D
+	${HUGO_CMD} server -D --baseURL="http://$(.HOST):1313"
 
 build: .PHONY
 	${HUGO_CMD} --minify
diff --git a/website/Makefile b/website/Makefile
index 6337692942..2294db8838 100644
--- a/website/Makefile
+++ b/website/Makefile
@@ -18,6 +18,12 @@ [email protected]
 PYTHON_CMD =	/usr/local/bin/python3.7
 HUGO_CMD =	/usr/local/bin/hugo
 
+.ifndef HOSTNAME
+.HOST+=localhost
+.else
+.HOST+=$(HOSTNAME)
+.endif
+
 .ORDER: all run
 
 .ORDER: starting-message generate-releases
@@ -36,7 +42,7 @@ generate-releases: .PHONY
 	${PYTHON_CMD} ./tools/releases-toml.py -p ./shared/releases.adoc
 
 run-local: .PHONY
-	${HUGO_CMD} server -D
+	${HUGO_CMD} server -D --baseURL="http://$(.HOST):1313"
 
 build: .PHONY
 	${HUGO_CMD}
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.