We have a client with a requirement to be able to associate multiple authors to a single blog post. I know this is not available in Hubspot so we created a custom module to add authors to each blog and it works fine - we are 99% there.
However, right now a user has to manuall enter name and image of every author for every blog.
DESIRED What we want is to have the drop-down list of authors available for user to select from. All users in the list should come from here
So, user enter all Authors information in deafult screen in Hubspot and we pull these values in a drop-down in a custom module to add additional authors.
Can anyone help with what field name vaule of code we can use to fetch the drop-down?
How can I implement the second author slug (url)? I was able to work with your code to get the second author on our blog template, but I'm having a bit of an issue with grabbing the second author url. The 1st author is using this:
<a href="{{ group.absolute_url }}/author/{{ content.blog_post_author.slug }}" alt="">{{ second.name }}</a> Any help you can provide for me to pull the second author slug would be great. Thank you
I did something like this for a client once. Unfortunately they're not on hubspot anmore and I don't have the code saved anywhere.
But for author one I'd pull it in in the standard way.
Then for author two, I think you can do something like use a choice tag that you fill using the recent authors tag.
You'll definitely need to fiddle around with this but it's something like
// Empty Array
{% set authors_list = [] %}
// Get Authors
{% set my_authors = blog_authors("default", 250) %}
// Add Authors to array
{% for author in my_authors %}
{% do authors_list.append(author) %}
{% endfor %}
//Push authors into choice field
{% choice "second_author" label="Choose second author", value=authors_list %}
// Output second author
{{ second_author }}
Again, that's entirely off the top of my sleepless head so you'll no doubt need to fiddle with it but it's a start. Maybe you can get {{second_author.url}} etc. from that, maybe not, maybe you need to expand what you'd adding to the array to get that.
I don't think you'll be able to do it the route you are going. If I was in your shoes, the route I would go would be to create a HubDB table with the data (name, title, image etc) about each author. Then in my module, for the field type I'd make it a HubDB row and make it use the repeater functionality.
When you drop that module on a post you can then select one or more authors, and use them in your module similar to how you are now.
In case of Author you can retrieve only single author as author is a single selection element , multiple selection is possible only for the tags not for the author, so you can not show multiple author in dropdown as how you want.
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.