Jun 18, 20246:14 AM - edited Jun 18, 20246:15 AM
Member
Creating a Manageable List of Old External Links
SOLVE
Hi all,
I'm thinking of creating a page that would list all old topic links (inside rich text module) that I removed from my main page. This links are all external links and will be redirected to another page once clicked.
I tried using the rich text editor to just list all of the links in it but I thought that it will get very long and will be hard to maintain.
Is there a better way of doing this? I was thinking of something like the blog listing page, but instead of the blog posts hosted by HubSpot, it'll just be simple clickable links (Like search result) that would redirect the user to the external website.
the easiest way would be to create a custom module with a for-loop.
Once you've created a custom module add a text (not rich-text) and a link field to the right sidebar like this:
group them like this(click on actions and select "group") and type in a name you'd like to be displayed for the content editor while editing the module
the most important part: While you're in the group scroll down to the very bottom of the right sidebar, enable the repeater option and select a sorting label(this is optional but recommended)
Now write something like this in the module.html area of the module:
(here's the code for easier use)
<div class="custom-list-wrapper">
<ul class="custom-list">
{% for single_item in module.list_items %}
{% set href = item.link.url.href %}
{% if item.link.url.type is equalto "EMAIL_ADDRESS" %}
{% set href = "mailto:" + href %}
{% endif %}
<li>
<a href="{{ href }}" {% if item.link.open_in_new_tab %}target="_blank"{% endif %} {% if item.link.rel %}rel="{{ item.link.rel|escape_attr }}"{% endif %}>
{{ single_item.headline }}
</a>
</li>
{% endfor %}
</ul>
</div>
The (unstyled) result of the module and "editor experience" will look like this:
A tip that might save you some time: If you want to display the same content on several pages over and over again -> make sure to select "global module" during the intial creation of the module (when you type in the name of it)
the easiest way would be to create a custom module with a for-loop.
Once you've created a custom module add a text (not rich-text) and a link field to the right sidebar like this:
group them like this(click on actions and select "group") and type in a name you'd like to be displayed for the content editor while editing the module
the most important part: While you're in the group scroll down to the very bottom of the right sidebar, enable the repeater option and select a sorting label(this is optional but recommended)
Now write something like this in the module.html area of the module:
(here's the code for easier use)
<div class="custom-list-wrapper">
<ul class="custom-list">
{% for single_item in module.list_items %}
{% set href = item.link.url.href %}
{% if item.link.url.type is equalto "EMAIL_ADDRESS" %}
{% set href = "mailto:" + href %}
{% endif %}
<li>
<a href="{{ href }}" {% if item.link.open_in_new_tab %}target="_blank"{% endif %} {% if item.link.rel %}rel="{{ item.link.rel|escape_attr }}"{% endif %}>
{{ single_item.headline }}
</a>
</li>
{% endfor %}
</ul>
</div>
The (unstyled) result of the module and "editor experience" will look like this:
A tip that might save you some time: If you want to display the same content on several pages over and over again -> make sure to select "global module" during the intial creation of the module (when you type in the name of it)