Untitled

 avatar
unknown
plain_text
9 months ago
931 B
13
Indexable
<div id="slug-box"></div>

<script>
document.addEventListener("DOMContentLoaded", function() {
  // Get the current page path
  const path = window.location.pathname;
  
  // Extract the slug (last part of URL)
  const slug = path.split('/').filter(Boolean).pop();

  // Log it (for debugging)
  console.log("Current slug:", slug);

  // Create custom HTML that uses the slug
  const customHTML = `
    <div style="
      padding: 20px;
      background: #f8f9fa;
      border: 2px solid #e1e1e1;
      border-radius: 10px;
      text-align: center;
      font-family: Arial, sans-serif;
      margin-top: 15px;
    ">
      <h2 style="color:#333; margin-bottom:8px;">This Page Slug:</h2>
      <p style="color:#0073aa; font-weight:bold;">${slug}</p>
    </div>
  `;

  // Insert HTML into the page
  const container = document.getElementById("slug-box");
  if (container) {
    container.innerHTML = customHTML;
  }
});
</script>
Editor is loading...
Leave a Comment