1b.app
Link copied -

Variable [shopurl] Implementing dynamic URLs for internal links in the knowledge base: Need advice

Task: Ensure the correctness of internal links in the knowledge base when copying it between different instances of the platform.

Example of a knowledge base article: https://icolor-trade.1b.app/app/knowledgebase/edit/69/

Details:

- There is a knowledge base consisting of a set of articles linked together by hyperlinks.

- Current links in articles are absolute and contain the URL of the current platform instance (for example, https://icolor-trade.1b.app/...).

- It is necessary to implement a mechanism that will allow copying this knowledge base to another instance of the platform (with a different URL, for example, https://new-shop.1b.app/...).

- After copying, all internal links in articles in the new instance should automatically update to point to resources within that new instance.

Proposed solution:

- Replace the static part of the URL (instance domain) in internal links with a dynamic placeholder variable, for example, [shopurl].

Example:

- Current link in the article: https://icolor-trade.1b.app/app/knowledgebase/edit/69/

- You need to replace it with the template: https://[shopurl]/app/knowledgebase/edit/69/

Expected result:

When copying the knowledge base to a new instance with the URL https://new-shop.1b.app/, the system should automatically substitute the URL of the new instance instead of the variable [shopurl] so that the links look like this: https://new-shop.1b.app/app/knowledgebase/edit/69/.

Technical requirements:

- It is necessary to determine how internal links in knowledge base articles are stored and processed.

- It is necessary to implement the logic that, when copying the knowledge base:

- - Detects all internal links in articles.

- - Replaces the static part of the URL with the variable [shopurl] (if it hasn't already been done).

- - When displaying articles on a new instance, substitutes the URL of the current instance for the [shopurl] variable.

Additional information:

- It is important to ensure that this mechanism works for all types of internal links in the knowledge base.

- You should consider the possible implications for existing knowledge bases where links do not yet use the [shopurl] variable. This may require a migration process or updating of existing links.
Original question is available on version: ua Вячеслав Легеза

Answers:

Please join the conversation. If you have something to say - please write a comment. You will need a mobile phone and an SMS code for identification to enter. Log in and comment