Webflow sync, pageviews & more.
NEW
Answers

Is there a way to display the full URL or slug as the link text in Webflow when creating a page with a list of collection item URLs?

Unfortunately, Webflow does not have a built-in feature to display the full URL or slug as the link text when creating a page with a list of collection item URLs. By default, Webflow only allows you to display the collection item field values as link text. However, there are alternative methods you can use to achieve this functionality.

One option is to use custom code. You can create a dynamic embed element and write code to extract the URL or slug from each collection item and display it as the link text. Here's an example of how you could accomplish this using JavaScript:

1. Add a dynamic embed element to your page where you want the links to be displayed.
2. In the settings panel for the dynamic embed, choose "Embed" as the source and select the type of code you want to use (e.g., inline or external).
3. Write JavaScript code inside the dynamic embed to iterate over the collection items and generate the appropriate HTML markup.

Here's an example code snippet to get you started:

```javascript
// Assuming you have a collection called "Items" and a field called "Slug" that contains the URL slug for each item

const collectionItems = Array.from(document.querySelectorAll('.your-collection-items-selector'));
const dynamicEmbed = document.querySelector('.your-dynamic-embed-selector');
let html = '';

collectionItems.forEach(item => {
const slug = item.dataset.slug; // Assume you have stored the slug as a data attribute on each collection item

html += `${slug}
`;
});

dynamicEmbed.innerHTML = html;
```

Make sure to replace `.your-collection-items-selector` and `.your-dynamic-embed-selector` with the appropriate CSS selectors for your elements.

Another option is to use a third-party integration or service that dynamically generates the link text based on the URL or slug. For example, you can use Zapier or Integromat to connect Webflow with other tools and services that provide this functionality.

While these workarounds require some technical knowledge, they can help you achieve the desired outcome of displaying the full URL or slug as the link text in Webflow when creating a page with a list of collection item URLs.

Rate this answer

Other Webflow Questions