Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. individual head content

individual head content

Scheduled Pinned Locked Moved General Discussion
12 Posts 3 Posters 40 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jonathansteffens
    wrote on Apr 6, 2025, 11:26 AM last edited by
    #1

    hi, i want to add

    <meta name="robots" content="noindex,nofollow" />
    

    to the heads of the pages "menu" and "footer" in order to hide them in google's subpage-list (see screnshot). i found this post from laythemeforum where @gunesmu explains how i can edit the functions.php. but this would be deleted with every update, right? so i wonder if there is another way to edit the meta-tags of an indivudal page. thanks alot.

    Bildschirmfoto 2025-04-06 um 13.19.03.png

    1 Reply Last reply
    0
    • F Offline
      F Offline
      felix_rabe
      wrote on Apr 7, 2025, 10:07 AM last edited by felix_rabe Apr 7, 2025, 6:09 AM
      #2

      @jonathansteffens you can infuse this with javascript:

       document.addEventListener('DOMContentLoaded', function() {
           // Check if we're on the footer page
           if (document.body.classList.contains('page-id-XX')) { // Replace XX with the actual page ID of your footer page
       
               // Check if a robots meta tag already exists
               var existingMetaTag = document.querySelector('meta[name="robots"]');
               
               if (existingMetaTag) {
                   // If it exists, update its content to "noindex, nofollow"
                   existingMetaTag.content = "noindex, nofollow";
               } else {
                   // If it doesn't exist, create a new meta tag
                   var metaTag = document.createElement('meta');
                   metaTag.name = "robots";
                   metaTag.content = "noindex, nofollow";
                   document.getElementsByTagName('head')[0].appendChild(metaTag);
               }
           }
       });
      
      1 Reply Last reply
      0
      • J Offline
        J Offline
        jonathansteffens
        wrote on Apr 7, 2025, 10:36 AM last edited by
        #3

        thats a very good idea, thank you!

        1 Reply Last reply
        0
        • A Offline
          A Offline
          arminunruh
          Global Moderator
          wrote 29 days ago last edited by
          #4

          the problem is that the page overlay links are actually links to pages in the html code right?
          and thats why google lists them as pages you can visit.

          is my assumption right? this would mean you use footer and menu as page overlays?

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jonathansteffens
            wrote 28 days ago last edited by
            #5

            thats absolutely right!

            1 Reply Last reply
            0
            • A Offline
              A Offline
              arminunruh
              Global Moderator
              wrote 28 days ago last edited by
              #6

              so i did implement a:
              <a rel="nofollow"

              for the burger menu page overlay links:

              Screenshot 2025-04-10 at 20.52.25.png

              this will be part of the next lay theme update.
              but for other links to page overlays like in menus i will need to create a nofollow for these too

              1 Reply Last reply
              0
              • A Offline
                A Offline
                arminunruh
                Global Moderator
                wrote 28 days ago last edited by
                #7

                do you use menu links to these page overlays?
                or burger icon like in the screenshot above?
                or just links in +text in the gridder?

                for text elements in the gridder i would need to implement a nofollow checkbox

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jonathansteffens
                  wrote 27 days ago last edited by
                  #8

                  hi, that would be awesome if you implemented this. i use the burger icon option and the footer option

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jonathansteffens
                    wrote 27 days ago last edited by
                    #9

                    Bildschirmfoto 2025-04-11 um 10.02.06.png
                    Bildschirmfoto 2025-04-11 um 10.03.01.png

                    the site is friederike-dudda.de

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      jonathansteffens
                      wrote 27 days ago last edited by
                      #10
                      window.laytheme.on("newpageshown", function () {
                      if (
                          document.body.classList.contains("page-id-146") ||
                          document.body.classList.contains("page-id-81")
                        ) {
                           
                          //redirect
                          window.location.href = "/";
                            
                          // Check if a robots meta tag already exists
                          var existingMetaTag = document.querySelector('meta[name="robots"]');
                      
                          if (existingMetaTag) {
                            // If it exists, update its content to "noindex, nofollow"
                            existingMetaTag.content = "noindex, nofollow";
                          } else {
                            // If it doesn't exist, create a new meta tag
                            var metaTag = document.createElement("meta");
                            metaTag.name = "robots";
                            metaTag.content = "noindex, nofollow";
                            document.getElementsByTagName("head")[0].appendChild(metaTag);
                          }
                        }
                      });
                      

                      this is what i did now (following the proposition above). i added a redirect, which doesnt seem to be a problem for the functionality of the menu and the footer.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        arminunruh
                        Global Moderator
                        wrote 27 days ago last edited by
                        #11

                        alright

                        the next lay theme version will:

                        • have a nofollow checkbox when setting links:
                          Screenshot 2025-04-11 at 10.29.03.png

                        and any links to page overlays in menus and as burger icons will be rel="nofollow" automatically.

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          jonathansteffens
                          wrote 27 days ago last edited by
                          #12

                          👍
                          thank you

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes

                          9/12

                          Apr 11, 2025, 8:03 AM


                          I also code custom websites or custom Lay features.
                          💿 Email me here: 💿
                          info@laytheme.com

                          Before you post:
                          1. When using a WordPress Cache plugin, disable it or clear your cache.
                          2. Update Lay Theme and all Lay Theme Addons
                          3. Disable all Plugins
                          4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                          This often solves issues you might run into

                          When you post:
                          1. Post a link to where the problem is
                          2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                          3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                          Online Users
                          A
                          alasdair17
                          15 minutes ago
                          Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                          laytheme.com
                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          9 out of 12
                          • First post
                            9/12
                            Last post
                          0
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Search