Skip to content

Commit

Permalink
[rdf] Handle unpublished categories (fix #240)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Dec 1, 2016
1 parent 3f6ab5b commit 7ba205e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions modules/mod_ginger_rdf/models/m_rdf.erl
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,17 @@ get_category_uri([Category|T], Context) ->
%% Don't use m_rsc:p(Id, uri, Context) as that will return all URIs, even
%% including generated ones (http://site.com/id/123). We only want to return
%% a URI if it has been set explicitly.
Props = m_rsc:get_visible(Category, Context),
case proplists:get_value(uri, Props) of
case m_rsc:get_visible(Category, Context) of
undefined ->
%% Fall back to parent category
get_category_uri(T, Context);
Uri ->
Uri
undefined;
Props ->
case proplists:get_value(uri, Props) of
undefined ->
%% Fall back to parent category
get_category_uri(T, Context);
Uri ->
Uri
end
end;
get_category_uri(Category, Context) ->
get_category_uri(lists:reverse(m_category:is_a(Category, Context)), Context).

0 comments on commit 7ba205e

Please sign in to comment.