diff --git a/build_doc.sh b/build_doc.sh
index a1cd480294a05dfddcc1f34544e4c3626623e60b..7644550cfebecd02296bfc0fc769b62faef2432f 100755
--- a/build_doc.sh
+++ b/build_doc.sh
@@ -4,6 +4,8 @@ set -eux -o pipefail
 ROOT_DIR="$(pwd)/hysop"
 BUILD_DIR="$(pwd)/build"
 INSTALL_DIR="$(pwd)/install"
+CI_DIR="$(pwd)"
+mkdir -p ${CI_DIR}/logs # as artifact in gitlab-ci
 
 # Get sources for API documentation
 git clone --depth 1 https://gricad-gitlab.univ-grenoble-alpes.fr/particle_methods/hysop.git
@@ -15,18 +17,12 @@ cp -r _static devel examples install_guide getting_started reference users_guide
 cd hysop
 FC=mpif90 meson setup ${BUILD_DIR} --python.install-env prefix --prefix=${INSTALL_DIR} -DWITH_DOCUMENTATION=ON
 meson compile -C ${BUILD_DIR}
-# Tweak meson builddir: move the f2hysop*so file into hysop python files.
-find ${BUILD_DIR} -name 'f2hysop*so' -exec cp  '{}' ${BUILD_DIR}/hysop/. \;
-# Tweak python path for nbsphinx
-export PYTHONPATH=${BUILD_DIR}
-meson compile -C ${BUILD_DIR}  docs
-HYSOP_VERBOSE=false meson compile -C ${BUILD_DIR} doctest
+meson install -C ${BUILD_DIR} # Docs needs to find an proper installed hysop (i.e. finding f2hysop.so)
+ln -s ${CI_DIR}/logs ${BUILD_DIR}/docs/logs # trik to keep logs in ci artifacts even in case of failure
+meson compile -C ${BUILD_DIR} docs
+meson compile -C ${BUILD_DIR} doctest
 cd -
-mv ${BUILD_DIR}/docs/build/html  public
-
-mkdir -p logs
-find ${BUILD_DIR} -name doxygen.log -exec mv '{}' logs/. \;
-find ${BUILD_DIR} -name sphinx.log  -exec mv '{}' logs/. \;
+mv ${BUILD_DIR}/docs/build/html  ${CI_DIR}/public # as artifact in gitlab-ci
 
 rm -rf ${BUILD_DIR} ${ROOT_DIR} ${INSTALL_DIR}
 exit 0
diff --git a/conf.py.in b/conf.py.in
index 764f5cd6e773c8d6987bc29d855c442f7915b343..ded80413207e62cd8cc75cfe779904992b640938 100644
--- a/conf.py.in
+++ b/conf.py.in
@@ -43,7 +43,7 @@ extensions = [
     'nbsphinx',
     'sphinxcontrib.doxylink']
 
-sys.path.insert(0, "@HYSOP_BUILD_PYTHONPATH@")
+sys.path.insert(0, "@HYSOP_PYTHONPATH@/hysop")
 numpydoc_class_members_toctree = True
 numpydoc_show_class_members = False
 # Napoleon settings