Is there dynamic pages publish some HubDB rows and not others? E.g. for handling drafts.
What I thought might possibly work, but doesn't:
HubDB column `.live_status` checkbox for status.
Then in the template:
```
{% if dynamic_page_hubdb_row.live_status %}
<!-- Yes, dynamic page for this row -->
{% elif dynamic_page_hubdb_table_id %}
<!-- Index stuff -->
{% endif %}
```
That doesn't work, because the dynamic page is initiated before the template is picked. So, they are all in the sitemap. (But for the unchecked pages, it repeats the index.)
Well yes, for hiding items from a catelog you could create a boolean column "is_live" and in your catelog loop only output items where "is_live" is true. For events you'd be looking for it to only show events where the unix timestamp is greater than the current date.
I'll try to update this post in a few minutes with some examples.
But on the sitemap front, yes you're right, landing pages don't auto add, that seems like a good idea.
Here's a demo of an event listing I did for a client.
{% set get_current_date = unixtimestamp( local_dt ) %}
{% set queryFuture = "&my_event_date__gt="+get_current_date %}
{% set events = hubdb_table_rows(you_hubdb_table,"&orderBy=date" + queryFuture ) %}
{% for row in events %}
{{ row.title }}
{% endfor %}
So then for your is_live column you'd do something like:
{% set live_items = hubdb_table_rows(you_hubdb_table,"&is_live=true" ) %}
{% for row in live_items %}
{{ row.title }}
{% endfor %}
None of that's been tested, so you'll have to fiddle around but it's the basic idea
I don't think hubDB has that feature yet. It would be great if it does, though.
As @BarryGrennan mentioned, the only workaround is to add a noindex based on a column value. Just remember to exclude all "draft" items from the listing.
Best regards,
Abraham Ernesto
Best regards, Abraham ErnestoFound this answer helpful? Marking it as the solution helps both the community and me - thanks in advance!
I was wondering whether there was any way for those draft, or, `.live_status` unchecked pages to not be created at all. I want to use this for controling drafts, and for taking down expired dynamic content. E.g. for periodically adding and taking down products from a catalog. Or e.g. for putting up event pages in a calendar, and taking them down when passed.
We can auto schedule publication and unpublication of webpages. I wanted to be able to do the same kind of thing with HubDB dynamic pages -- because I also want an index feed. Though I am happy to check/uncheck manually.
I was just using the sitemap to verify that these 'draft' dynmic pages were actually being generated. Meaning I might eventually have dozens of identical webpages out there (being the `.live_status` unchecked pages all with the Index instead of the row content).
Good idea -- I can make those unwanted pages get a noindex tag. If I can't have them be not generated at all, then noindex will have to suffice. Not ideal, but it'll do if there's no other way.
Well yes, for hiding items from a catelog you could create a boolean column "is_live" and in your catelog loop only output items where "is_live" is true. For events you'd be looking for it to only show events where the unix timestamp is greater than the current date.
I'll try to update this post in a few minutes with some examples.
But on the sitemap front, yes you're right, landing pages don't auto add, that seems like a good idea.
Here's a demo of an event listing I did for a client.
{% set get_current_date = unixtimestamp( local_dt ) %}
{% set queryFuture = "&my_event_date__gt="+get_current_date %}
{% set events = hubdb_table_rows(you_hubdb_table,"&orderBy=date" + queryFuture ) %}
{% for row in events %}
{{ row.title }}
{% endfor %}
So then for your is_live column you'd do something like:
{% set live_items = hubdb_table_rows(you_hubdb_table,"&is_live=true" ) %}
{% for row in live_items %}
{{ row.title }}
{% endfor %}
None of that's been tested, so you'll have to fiddle around but it's the basic idea
I'm going for having the date(s) as a text field, because some are multi-day conferences. My users can put what they like in a text field. Then for ordering and inserting more conferences, they can handle that by HubDB row drag-and-drop.
Another idea occurs to me: I could have the HubDB dynamic page generated as a landing page. HubSpot does not auto-include landing pages in the sitemap XML.
(i.e. what is called a landing page in HubSpot's parlance, not what Google Analytics calls a landing page.)