Skip to content

Commit

Permalink
views: optional index page registration
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsherva committed Jan 10, 2025
1 parent a5e65d3 commit c54e335
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
5 changes: 4 additions & 1 deletion invenio_app_rdm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _(x):
"""Footer base template."""

THEME_FRONTPAGE = False
"""Use default frontpage."""
"""Use default theme frontpage."""

THEME_FRONTPAGE_TITLE = _("The turn-key research data management repository")
"""Frontpage title."""
Expand All @@ -276,6 +276,9 @@ def _(x):
THEME_HEADER_LOGIN_TEMPLATE = "invenio_app_rdm/header_login.html"
"""Header login base template."""

RDM_FRONTPAGE = True
"""Use RDM frontpage."""


def _get_package_version():
from importlib.metadata import PackageNotFoundError, version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,15 @@ const handleAuthButtonClick = () => {

$authButton.on({ click: handleAuthButtonClick });

const invenioConfig = JSON.parse(document.body.dataset.invenioConfig);
const isMathJaxEnabled = invenioConfig?.isMathJaxEnabled;
if (window.invenio) {
window.invenio.onSearchResultsRendered = () => {
if (isMathJaxEnabled) {
// Re-render mathematical content on the page using MathJax.
return window.MathJax?.typeset();
}
};
if (document.body.dataset.invenioConfig) {
const invenioConfig = JSON.parse(document.body.dataset.invenioConfig);
const isMathJaxEnabled = invenioConfig?.isMathJaxEnabled;
if (window.invenio) {
window.invenio.onSearchResultsRendered = () => {
if (isMathJaxEnabled) {
// Re-render mathematical content on the page using MathJax.
return window.MathJax?.typeset();
}
};
}
}
6 changes: 4 additions & 2 deletions invenio_app_rdm/theme/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ def create_blueprint(app):
template_folder="templates",
static_folder="static",
)

blueprint.add_url_rule(**create_url_rule(routes["index"], default_view_func=index))
if app.config["RDM_FRONTPAGE"]:
blueprint.add_url_rule(
**create_url_rule(routes["index"], default_view_func=index)
)
blueprint.add_url_rule(
**create_url_rule(routes["robots"], default_view_func=robots)
)
Expand Down

0 comments on commit c54e335

Please sign in to comment.