diff --git a/app/views/public/api/v1/portals/articles/_article_header.html.erb b/app/views/public/api/v1/portals/articles/_article_header.html.erb index f70d24519..4adc6a728 100644 --- a/app/views/public/api/v1/portals/articles/_article_header.html.erb +++ b/app/views/public/api/v1/portals/articles/_article_header.html.erb @@ -1,7 +1,7 @@ <% category_link_params = { portal_slug: @portal.slug, - category_locale: @article.category.locale, - category_slug: @article.category.slug, + category_locale: @article.category&.locale, + category_slug: @article.category&.slug, theme: @theme_from_params, is_plain_layout_enabled: @is_plain_layout_enabled } @@ -33,6 +33,6 @@
<%= render "public/api/v1/portals/thumbnail", author: article.author, size: 5 %>
- By <%= article.author.available_name %> • <%= I18n.t('public_portal.common.last_updated_on', last_updated_on: article.updated_at.strftime("%b %d, %Y")) %> + <%= "#{I18n.t('public_portal.common.by')} #{article.author&.available_name || article.author&.name || ''}" %> • <%= I18n.t('public_portal.common.last_updated_on', last_updated_on: article.updated_at.strftime("%b %d, %Y")) %> diff --git a/app/views/public/api/v1/portals/categories/show.html.erb b/app/views/public/api/v1/portals/categories/show.html.erb index 3e6398c0b..9ce4a7650 100644 --- a/app/views/public/api/v1/portals/categories/show.html.erb +++ b/app/views/public/api/v1/portals/categories/show.html.erb @@ -36,7 +36,9 @@
<% author = article.author %> <%= render "public/api/v1/portals/thumbnail", author: author, size: 5 %> - <%= "#{I18n.t('public_portal.common.by')} #{author.name}" %> + <% if author&.name.present? %> + <%= "#{I18n.t('public_portal.common.by')} #{author&.name}" %> + <% end %>
<%= I18n.t('public_portal.common.last_updated_on', last_updated_on: article.updated_at.strftime("%b %d, %Y")) %>