CMS Development

clnmcgrw
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

Hello, I have a COS/hubl related question -  is there a way (outside of using a blog or managing page content in HubDB) to deal with landing or website pages in "collections" and be able to loop through them?

 

There are situations where I'd rather not use a blog, but want to show information from other groups of related pages.  I've built multiple sites/blogs on the COS now, been through the docs pretty thoroughly, and can't find a way to do this that doesn't involve hitting the Page Publishing API and rendering content on the front-end.

 

It seems like a function like get_page_by_id that returns the {{content}} available from that page would be incredibly useful.  It would allow something like this -

{% set related_pages = [482645, 482645, 482645] %}

{% for page in related_pages %}
  {% set content = get_page_by_id(page) %}
  <!-- show content -->
{% endfor %}

The group of page id's could be managed in hubdb or with a hubl module. Seems like it would make the COS much more flexible for developers.

 

I would love to hear how others are handling similar situations ... do you use blogs for any type of collection?  Or did I overlook something in the docs?  Any help or input is much appreciated, thanks! 

 

 

 

 

 

2 Solutions acceptées
MayPascaud
Solution
Ancien salarié HubSpot
Ancien salarié HubSpot

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

@clnmcgrw thanks so much for your detailed response. I think you make an excellent point. I've consolidated your arguments and have passed them along to the team in charge of this product area. Though it's out of my hands now, at the very least your feedback will be heard and considered 🙂

Voir la solution dans l'envoi d'origine

0 Votes
clnmcgrw
Solution
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

👋 Hey just popping in 7 years later, for anyone stumbling across this post...

 

There are now HubL functions that allow this! See:

https://developers.hubspot.com/docs/cms/hubl/functions#content-by-ids

https://developers.hubspot.com/docs/cms/hubl/functions#content-by-id

 

Voir la solution dans l'envoi d'origine

7 Réponses
clnmcgrw
Solution
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

👋 Hey just popping in 7 years later, for anyone stumbling across this post...

 

There are now HubL functions that allow this! See:

https://developers.hubspot.com/docs/cms/hubl/functions#content-by-ids

https://developers.hubspot.com/docs/cms/hubl/functions#content-by-id

 

MarcusZeal
Contributeur | Partenaire solutions Elite
Contributeur | Partenaire solutions Elite

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

I'd also love a solution for this. OP describes a pretty common trend in the industry of a "Resources" section of sorts that loops through a bunch of landing pages or page content. We've done this with HubDB, but a way to solve for this natively without the need for a HubDB management process would be game-changing for us as developers and in turn our customers. 

I could see a potential solution here being allowing Page Builder and post expirations solutions on Blog Posts (so we could just create Blogs here).  Oooorrr a way to query pages from HUBL in a loop.  😄 


0 Votes
MayPascaud
Ancien salarié HubSpot
Ancien salarié HubSpot

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

Hi @clnmcgrw so it seems as though you have a fairly good grasp on what is possible here. Most customers do end up using a blog, and I can imagine this working with HubDB as well, as you mentioned. Aside from hitting the API, there would not be a dynamic way of doing this like you're hoping, as the HubL function you're asking for does not exist at this time.

 

I would be curious to know your specific use case for this, however, and why using a blog wouldn't work for you in this scenario. Though what you're looking for isn't currently possible, we're always interested in taking a closer look into suggestions that are backed up by a strong enough use case, so please do share if you get the chance!

 

- May

0 Votes
clnmcgrw
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

Hi @MayPascaud@, thanks for the response!  I figured it wasn't possible to do this but just wanted to make sure.

 

I'll lay out our use case, as think there are a few major shortcomings/issues with the COS that do need to be addressed (the other being a hubl repeater issue mentioned by @AJLaPorte_diagr).

 

So, I'm lead developer at a branding/marketing agency, our leadership (and existing/potential clients) want to be able to manage websites from their Hubspot dashboard rather than a separate CMS, and I want to be able to make it happen for them.  Often our sites will have a lot of groups of related pages that may or may not share a single template - case studies, featured work, service offerings, team members, career listings, brand ambassadors, products/shop, locations, etc.

 

I would rather not use blogs to manage all these groups because they are not similar to blog content - they won't need comments, topics, authors, date info, compositions feature, subscriptions, rss feeds, etc.  They will not be continually published to.

 

But, these groups will need the ability to use separate templates within the same group/collection.  We will also want to make highly customized "parent/listing pages" for these groups that use hubl modules for extra editable information unique to that page.. the way these blogs work now that is not possible, there is no editor view for blog listing pages. It is also much easier to jump between folders in the "landing pages" section than to go back and forth between different blogs to edit things.

 

Lastly I just wanted to point out that every CMS has the ability to pull the data from a given page via a unique identifier, it's a useful utility feature.

 

Anywho, thanks again for your input, and here's to hoping these concerns are able to be heard by someone with some influence on the COS product development roadmap... thanks again!

0 Votes
MayPascaud
Solution
Ancien salarié HubSpot
Ancien salarié HubSpot

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

@clnmcgrw thanks so much for your detailed response. I think you make an excellent point. I've consolidated your arguments and have passed them along to the team in charge of this product area. Though it's out of my hands now, at the very least your feedback will be heard and considered 🙂

0 Votes
DanEtchPlay
Participant

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

Sorry to bring up an old topic but this is the current scenario we're faced with exactly as the OP described.

 

I don't suppose in the 4 years since this was discussed any progress has been made?

clnmcgrw
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Ways to Loop Through Collections of Landing/Website Pages?

Résolue

@MayPascaud thank you so much,  appreciate you passing on the concerns... cheers!

0 Votes