1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[SOLVED] Sitemap XML for own content-type

Discussion in 'XenForo Development Discussions' started by Bugfix, Sep 15, 2014.

  1. Bugfix

    Bugfix Member

    Hello!

    Did anyone tried to use the new Sitemap XML system with an own content-type?
    https://xenforo.com/community/threads/sitemap-xml.78977/

    I inserted a sitemap_handler_class for my ct in xf_content_type_field but it seems that the entry is ignored.
    When I generate a new sitemap, my own code is ignored :(

    Can anyone help me?
    Harald
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    You need to define your content type in xf_content_type too.

    After that you need to rebuild the content types cache.

    One way of doing that is to export your add on and then use that to upgrade your add on (the cache is rebuilt when any add on is installed or upgraded).
     
    Bugfix likes this.
  3. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    Wouldn't calling
    PHP:
    XenForo_Model::create('XenForo_Model_ContentType')->rebuildContentTypeCache()
    suffice? It's a major pain to do a global rebuild :p
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    It's not really a pain to run an add on upgrade.

    Your method is valid. I know there are multiple ways of doing it. Personally I use my content type management add on.
     
  5. Bugfix

    Bugfix Member

    Hey chris D - thank you very much!
    Rebuilding the content types cache solved my problem :)
     
  6. Jeff Berry

    Jeff Berry Well-Known Member

    No need to delete add-ons or rebuild caches, this is the simplest way (IMO) to reset your content types. Just a simple SQL query.
    PHP:
    DELETE FROM xf_data_registry WHERE data_key 'contentTypes';
    UPDATE xf_content_type SET fields '';
    This will force the previous user's suggestion to automatically run on the next page load:
    PHP:
    XenForo_Model::create('XenForo_Model_ContentType')->rebuildContentTypeCache();
     
    Last edited: Sep 23, 2014

Share This Page