Skip to content

RHIDP-6499: Modularize Customizing the Learning Paths #1068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 22, 2025
15 changes: 15 additions & 0 deletions assemblies/assembly-customizing-the-learning-paths.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[id='proc-customize-rhdh-learning-paths_{context}']
= Customizing the Learning Paths in {product}

In {product}, you can configure Learning Paths by hosting the required data externally,
and using the built-in proxy to deliver this data rather than the default.

You can provide Learning Paths data from the following sources:

* JSON files hosted on a web server, such as GitHub or GitLab.
* A dedicated service that provides the Learning Paths data in JSON format using an API.

include::modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-hosted-json-files.adoc[leveloffset=+1]


include::modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-a-dedicated-service.adoc[leveloffset=+1]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[id='proc-customizing-the-learning-paths-by-using-a-customization-service_{context}']
= Customizing the Learning Paths by using a customization service

For advanced scenarios, you can host your {product} customization service to provide data to all configurable {product-short} pages.
You can even use a different service for each page.

.Procedure
. Deploy your {product-short} customization service on the same {ocp-short} cluster as your {product-short} instance.
You can find an example at link:https://github.com/redhat-developer/red-hat-developer-hub-customization-provider[`red-hat-developer-hub-customization-provider`], that provides the same data as default {product-short} data.
The customization service provides a Learning Paths data URL such as: `pass:c[http://rhdh-customization-provider/learning-paths]`.

. Configure the {product-short} proxy to use your dedicated service to provide the Learning Path data, add the following to the link:{configuring-book-url}[`{my-app-config-file}` file]:
+
[source,yaml,subs='+quotes']
----
proxy:
endpoints:
'/developer-hub/learning-paths':
target: _<learning_path_data_url>_
changeOrigin: true
qsecure: true # <1>
----
<1> Change to "false" in case of using self hosted cluster with a self-signed certificate
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[id='proc-customize-rhdh-learning-paths_{context}']
= Customizing the Learning Paths by using hosted JSON files

For ease of use and simplicity, you can configure the Learning Paths by using hosted JSON files.


.Procedure
. Publish the JSON files containing your Learning Paths data to a web server, such as GitHub or Gitlab. You can find an example at link:https://raw.githubusercontent.com/redhat-developer/rhdh/main/packages/app/public/learning-paths/data.json[].

. Configure the {product-short} proxy to access the Learning Paths data from the hosted JSON files, by adding the following code to the `{my-app-config-file}` file:
+
[source,yaml]
----
proxy:
endpoints:
'/developer-hub':
target: https://raw.githubusercontent.com/
pathRewrite:
'^/api/proxy/developer-hub/learning-paths': '/redhat-developer/rhdh/main/packages/app/public/learning-paths/data.json'
changeOrigin: true
secure: true
----
+
[TIP]
====
When also configuring the home page, due to the use of overlapping `pathRewrites` for both the `learning-path` and `homepage` quick access proxies, create the `learning-paths` configuration (`^api/proxy/developer-hub/learning-paths`) before you create the `homepage` configuration (`^/api/proxy/developer-hub`).
For example:

[source,yaml]
----
proxy:
endpoints:
'/developer-hub':
target: https://raw.githubusercontent.com/
pathRewrite:
'^/api/proxy/developer-hub/learning-paths': '/redhat-developer/rhdh/main/packages/app/public/learning-paths/data.json'
'^/api/proxy/developer-hub/tech-radar': '/redhat-developer/rhdh/main/packages/app/public/tech-radar/data-default.json'
'^/api/proxy/developer-hub': '/redhat-developer/rhdh/main/packages/app/public/homepage/data.json'
changeOrigin: true
secure: true
----
====

.Additional resources
* xref:customizing-the-home-page[Customizing the Home page in {product}].
2 changes: 1 addition & 1 deletion titles/customizing/master.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include::modules/customizing/proc-customizing-the-backend-secret.adoc[leveloffse
include::assemblies/assembly-configuring-templates.adoc[leveloffset=+1]


include::modules/customizing-the-learning-paths/proc-customize-rhdh-learning-paths.adoc[leveloffset=+1]
include::assemblies/assembly-customizing-the-learning-paths.adoc[leveloffset=+1]


include::assemblies/assembly-configuring-the-global-header.adoc[leveloffset=+1]
Expand Down
Loading