Giter VIP home page Giter VIP logo

Comments (6)

styxlab avatar styxlab commented on June 11, 2024

Hi @tobimori, thanks for reporting this issue and for bringing your work to my attention - it looks really nice.

Yes there is an issue with the author and tag pages when using infinite scroll. I'd be happy to take an PR, if you want to fix this.

from gatsby-theme-try-ghost.

tobimori avatar tobimori commented on June 11, 2024

Not really understand how the pagination works yet, so I'm happy If you do it 😄

from gatsby-theme-try-ghost.

styxlab avatar styxlab commented on June 11, 2024

This is actually a bit tricky. I haven't quite made up my mind on how to best solve this.

from gatsby-theme-try-ghost.

tobimori avatar tobimori commented on June 11, 2024

On our old Ghost Theme we fetched the contents from the next site and just added the contents of the Post List there to the Post List on the main site

        let page = 2;
        let url_blog = window.location.href.replace("\/#", "/");
        let ids = ['p31', 'p32', 'p33', 'p21', 'p22', 'p1']
        let max_page = {{ pagination.pages }};
        let currentlyLoading = false;
        function ready(fn) {
            if (document.readyState != 'loading') {
                fn();
            } else {
                document.addEventListener('DOMContentLoaded', fn);
            }
        }
        function loadContent() {
            var req = new XMLHttpRequest();
            req.onreadystatechange = function () {
                if (this.readyState == 4 && this.status == 200) {
                    parser = new DOMParser();
                    doc = parser.parseFromString(this.responseText, "text/html");
                    ids.forEach((id) => {
                        document.getElementById(id).innerHTML += doc.getElementById(id).innerHTML;
                    })
                    currentlyLoading = false;
                }
            };
            req.open("GET", url_blog + 'page/' + page, true);
            req.send();
            page = page + 1;
        }
        function bottomDistance() {
            return Math.max(document.body.offsetHeight - (window.pageYOffset + window.innerHeight), 0);
        }
        ready(() => {
            document.addEventListener('scroll', function () {
                if (bottomDistance() < 1000 && !currentlyLoading) {
                    currentlyLoading = true;
                    loadContent();
                }
            })
        })

from gatsby-theme-try-ghost.

styxlab avatar styxlab commented on June 11, 2024

@tobimori: really interesting idea. For now I will stick to the current mechanism of fetching posts from files, but would reconsider if you method turns out to be faster.

from gatsby-theme-try-ghost.

styxlab avatar styxlab commented on June 11, 2024

Fixed in npm version >=1.10.2.

from gatsby-theme-try-ghost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.