Create an HTML sitemap without plugins, it's simple and very useful for SEO.

aikis

Active member
Elite
XNullUser
Joined
Oct 9, 2021
Messages
170
Reaction score
175
Points
43
Website
autopmr.com
NullCash
281
How to properly create an HTML Sitemap in Osclass (Delta theme)

Step 1. Create the template file
Navigate to your theme directory on your hosting. Go to folder , then , then . Create a new file there and name it . Insert the following code into it:eek:c-contentthemesdeltatemplate-html-sitemap.php

PHP

<?php
/*
Template Name: HTML Sitemap
*/
?>
<?php osc_current_web_theme_path('header.php'); ?>

<section class="content sitemap-page loc-page">
<div class="inside">
<h1><?php echo osc_static_page_title(); ?></h1>

<div class="sitemap-wrap" style="display: flex; flex-wrap: wrap; gap: 20px; margin-top: 20px;">
<?php
osc_goto_first_category();
while(osc_has_categories()) { ?>
<div class="sitemap-col" style="flex: 1 1 250px; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid #eee;">
<h3 style="margin-top:0; font-size: 18px; border-bottom: 2px solid <?php echo del_param('color1'); ?>; padding-bottom: 10px; margin-bottom: 15px;">
<a href="<?php echo osc_search_category_url(); ?>" style="color: #333; text-decoration: none;">
<?php echo osc_category_name(); ?>
</a>
<span style="color:#999; font-size:14px; font-weight: normal;">(<?php echo osc_category_total_items(); ?>)</span>
</h3>

<?php if(osc_count_subcategories() > 0) { ?>
<ul style="list-style: none; padding-left: 0; margin: 0;">
<?php while(osc_has_subcategories()) { ?>
<li style="margin-bottom: 8px;">
<a href="<?php echo osc_search_category_url(); ?>" style="color: #666; text-decoration: none; transition: 0.2s;">
&mdash; <?php echo osc_category_name(); ?>
</a>
</li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</section>

<?php osc_current_web_theme_path('footer.php'); ?>

Step 2. Page setup in the admin panel

  1. Log in to the Osclass admin panel.
  2. Go to the Pages section, click Add new.
  3. In the Title field, write: Sitemap.
  4. In the Internal name field, you must strictly write the word (in lowercase English letters, no spaces).sitemap
  5. Save the page.
Step 3. Connecting the template in the theme core In Osclass, custom templates are connected much more reliably by intercepting the internal page name.

  1. On your hosting, go back to your theme folder.delta
  2. Find the system file and open it for editing.page.php
  3. At the very beginning of the file, right below the opening PHP tag, insert this interceptor code:
PHP

if (osc_static_page_slug() == 'sitemap') {
osc_current_web_theme_path('template-html-sitemap.php');
exit;
}

How it works: Now, when a visitor or a search engine bot tries to open your Sitemap page, the engine will check its internal name. Seeing the word sitemap, the system will instantly load your beautiful new file with the category grid and stop loading the standard empty sheet (the exit command is responsible for exactly this).
Post automatically merged:

Forgot to specify the file name - template-html-sitemap.php
 
Last edited:

stoic

Member
XNullUser
Joined
Nov 22, 2025
Messages
77
Reaction score
22
Points
8
Location
Caribbean
NullCash
58
Thanks!

I will implement this when I get a chance..

Based on the themes folder where you instructed that we create a file as a first step (in oc-content>themes>delta>"template-html-sitemap.php"),

I take it that delta is based on your setup and that it should also work just fine with everything else (not theme dependent).
 

aikis

Active member
Elite
XNullUser
Joined
Oct 9, 2021
Messages
170
Reaction score
175
Points
43
Website
autopmr.com
NullCash
281
Thanks!

I will implement this when I get a chance..

Based on the themes folder where you instructed that we create a file as a first step (in oc-content>themes>delta>"template-html-sitemap.php"),

I take it that delta is based on your setup and that it should also work just fine with everything else (not theme dependent).
I tested it with different themes, but if you like the design, you can always redo it.
 
Top