Git Product home page Git Product logo

Comments (4)

jdanyow avatar jdanyow commented on May 22, 2024 1

nice- thanks

from utterances.

jdanyow avatar jdanyow commented on May 22, 2024

You're using the "issue title contains page url" mode. This works well for blog post pages but not for a homepage. All your post issue titles will match the home page url https://dennisdel.com/blog/:

https://github.com/dend/blog/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20%22https%3A%2F%2Fdennisdel.com%2Fblog%2F%22%20

For home pages it's better to use a hard coded search term or issue number.

For example, you could create an issue titled "homepage" and use this configuration:

<script src="https://utteranc.es/client.js"
        repo="dend/blog"
        branch="master"
        issue-term="homepage"
        async>
</script>

Or if the homepage issue already exists, reference it by number:

<script src="https://utteranc.es/client.js"
        repo="dend/blog"
        branch="master"
        issue-number="123"
        async>
</script>

The trick here will be preserving your existing configuration on "blog post" pages while using a hard-coded term on the home page. Here's how you could do that:

- <script src="https://utteranc.es/client.js"
-         repo="dend/blog"
-         branch="master"
-         issue-term="url"
-         async>
- </script>
+ <script id="utterances-bootstrapper">
+   var s = document.createElement('script');
+   s.src = 'https://utteranc.es/client.js';
+   s.async = true;
+   s.setAttribute('repo', 'dend/blog');
+   s.setAttribute('branch', 'master');
+   s.setAttribute('issue-term', /^\/blog\/?$/.test(location.pathname) ? 'homepage' : 'url');
+ 
+   var me = document.getElementById('utterances-bootstrapper');
+   me.insertAdjacentElement('afterend', s);
+ </script>

from utterances.

jdanyow avatar jdanyow commented on May 22, 2024

@dend are you all set- can this be closed?

from utterances.

dend avatar dend commented on May 22, 2024

@jdanyow thanks for the help! I fixed the template in this situation with a check on the title (there is only one page with a specific title in my set) to determine where not to render. This can be closed.

from utterances.

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.