htmlinstafeedjs

Show only the newest instagram picture with instafeed


So I need to show only one Instagram picture, which is the newest picture from the Instagram account. This HTML code shows all the pictures the account has.

<!DOCTYPE html>
<html>
<head>
    <title>Instagram</title>
    <style type="text/css">
        a img{ 
            width: 25%;
        }
    </style>
</head>
<body>
    <h1 style="text-align: center"></h1>
        <div id="instafeed-container"></div>



    <script src="https://cdn.jsdelivr.net/gh/stevenschobert/instafeed.js@2.0.0rc1/src/instafeed.min.js"></script>
    <script type="text/javascript">
    var userFeed = new Instafeed({
        
        get: 'user',
        target: "instafeed-container",
        resolution: 'low_resolution',
        accessToken: 'YOURACCESSTOKEN'
    });
    userFeed.run();
    </script>
</body>
</html>

So how do I filter the pictures and only show the newest picture? I tried to use "limit: '1", but it doesn't show anything at all.


Solution

  • You can limit the number of records, as per the documentation e.g,

    limit : 1

    in Instafeed Object.

    see here in the documentation