CMS Development

dtg001
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.

0 Upvotes
1 Accepted solution
Anton
Solution
Thought Leader

Creating a Manageable List of Old External Links

SOLVE

Hi @dtg001

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:

Bildschirmfoto 2024-06-18 um 14.55.28.png

 

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

Bildschirmfoto 2024-06-18 um 14.58.54.png

 

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)

Bildschirmfoto 2024-06-18 um 15.00.11.png

Now write something like this in the module.html area of the module:

Bildschirmfoto 2024-06-18 um 15.03.11.png

 

(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:

Bildschirmfoto 2024-06-18 um 15.06.43.png

Bildschirmfoto 2024-06-18 um 15.07.07.png

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)

 

 

best, 

Anton

Anton Bujanowski Signature

View solution in original post

0 Upvotes
1 Reply 1
Anton
Solution
Thought Leader

Creating a Manageable List of Old External Links

SOLVE

Hi @dtg001

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:

Bildschirmfoto 2024-06-18 um 14.55.28.png

 

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

Bildschirmfoto 2024-06-18 um 14.58.54.png

 

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)

Bildschirmfoto 2024-06-18 um 15.00.11.png

Now write something like this in the module.html area of the module:

Bildschirmfoto 2024-06-18 um 15.03.11.png

 

(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:

Bildschirmfoto 2024-06-18 um 15.06.43.png

Bildschirmfoto 2024-06-18 um 15.07.07.png

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)

 

 

best, 

Anton

Anton Bujanowski Signature
0 Upvotes