Documentation / Tutorials / Awesome Apps

Creating Custom Sitemap For The App

/ Awesome Apps / Creating Custom Sitemap For The App

Sometimes we don’t use CPT’s to show the content.
suppose i have an app which show job listing and single job page
in this case job is not a post, it’s a lead in the database.
so for the job single page wpseo is not gonna create sitemap.
to create our custom site-map follow this steps:

  1. Create settings in app config(if not available).
  2. Create metafield ‘enable_sitemap’ in settings module and set value to yes, this will create sitemap of that app.
  3. Create new module in config named as custom-sitemap and write your custom code in this module.

Sample custom-sitemap module:

//** get all the jobs which are not closed.**//
[module.set_array job_xml_query]
        SELECT coll_id as data_id,object_id FROM job_postings where coll_type='job' and meta_key='status' and meta_value != 'closed'
  [transform ref_id=data_id /]
  [meta new]
[db.meta_query query="{module.job_xml_query}" set='template.res' /]

//**generate sitemap of jobs**//
[[email protected] template.res.rows]
    <loc>[php.site_url /]/current-openings/job/[aw2.get @job.item.job_slug /]</loc>
    <lastmod>[aw2.get @job.item.created_datetime /]</lastmod>
[/[email protected]]
Most Popular

Leave a Reply

Your email address will not be published.