Jump to content

Automatically generated menus: menu for portfolio pages and menus duplicating in footer (or anywhere)

Recommended Posts

Posted

Hi you all,

has anybody a solution for having the projects of a portfolio in a menu generated automatically?

Let say my portfolio page has a project per year, for let's say 10-20 years... Or I just want to update/change regularly my portfolio. Manual solutions are not very helpful in such cases if you need to change around the whole website links and lists that are manually done.

It would be nice to have also automated a duplicate in the footer (or any other section) of any menu you may have in your header section. I like a bit of redundancy so visitors can always reach any page from different places in the website. It is very annoying to have to go to the beginning to just navigate another project or another part of the website that is not in the main menu. Maybe there is already a solution for this and I just don't know how or where to find it. 😉

Where can I make of all of this a feature request?

Thanks!

  • 3 weeks later...
  • Replies 1
  • Views 392
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted

You can do this, follow these quick steps. Here I tested on my test site. If it doesn't work on your site, you can send portfolio page url, I will check easier.

#1. First, edit Site Footer > Add a Code Block > Paste this code

<div class="footer-portfolio-nav"></div>

image.thumb.png.87a43e7480d844b1afc26661713a573e.png

#2. Use this code to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
    $('#gridThumbs .grid-item').each(function() {
        var title = $(this).find('h3').text();
        var link = $(this).attr('href');
        var footerItem = $('<a>', {
            href: link,
            text: title,
            class: 'footer-portfolio-item'
        });
        
        $('.footer-portfolio-nav').append(footerItem);
    });
});
</script>

image.thumb.png.dffcb9728175c71d5733b278a2e31cda.png

It will copy all items from Portfolio Page and add it to Footer

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.