Skip to content

Commit

Permalink
mod_seo_sitemap: update sitemap on pivot, remove prio 0 resources fro…
Browse files Browse the repository at this point in the history
…m urlsets (0.x) (#3029)
  • Loading branch information
mworrell committed Jun 23, 2022
1 parent d9d4519 commit 5e27e1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 3 additions & 6 deletions modules/mod_seo_sitemap/mod_seo_sitemap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
-export([
observe_seo_sitemap_index/2,
observe_seo_sitemap_urlset/2,
observe_rsc_update_done/2,
observe_rsc_pivot_done/2,

event/2,

Expand All @@ -58,11 +58,8 @@ observe_seo_sitemap_urlset(#seo_sitemap_urlset{ source = <<"seo_sitemap">>, offs
observe_seo_sitemap_urlset(#seo_sitemap_urlset{}, _Context) ->
undefined.

observe_rsc_update_done(#rsc_update_done{ id = Id, action = Action }, Context) when Action =/= delete ->
m_seo_sitemap:update_rsc(Id, Context);
observe_rsc_update_done(#rsc_update_done{}, _Context) ->
undefined.

observe_rsc_pivot_done(#rsc_pivot_done{ id = Id }, Context) ->
m_seo_sitemap:update_rsc(Id, Context).

event(#postback{ message = sitemap_rebuild }, Context) ->
case z_acl:is_admin(Context)
Expand Down
8 changes: 6 additions & 2 deletions modules/mod_seo_sitemap/models/m_seo_sitemap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ slice( Offset, Limit, Context ) ->
Url1 = Url#{
loc => z_context:abs_url(Loc, AnonContext)
},
Url2 = maybe_add_category_attrs(Url1, AnonContext),
{true, Url2};
case maybe_add_category_attrs(Url1, AnonContext) of
#{ priority := P } when P < 0.1 ->
false;
Url2 ->
{true, Url2}
end;
false ->
false
end
Expand Down

0 comments on commit 5e27e1d

Please sign in to comment.