Giter VIP home page Giter VIP logo

Comments (4)

aghdom avatar aghdom commented on May 31, 2024 1

Thank you for the info! I had no idea this was a thing, because I worked with Hugo a long time ago and didn't keep up with the new changes.

The benefit of adding the custom templates, which would allow you to use the cover.image is that you wouldn't need to specify the image in two separate places, so for the sake of convenience I think it would still be worth merging.

Of course the other side of that coin is the fact that if you introduce this template you will need to keep it up to date with the changes made to the _internal template, if you want to keep all the new funcionality/changes they add.

Ultimately, it's up to you, whether you choose to add it or not. Since I now know how to specify it using the base Hugo template, I can update my posts to work correctly, if you choose not to merge it.

And once again a huge thanks for taking the time and sharing this information with me! 🙏 You, sir, rock! 🤘

from hugo-papermod.

adityatelange avatar adityatelange commented on May 31, 2024

Hello @aghdom,
We already have implemented og, twitter cards, one need to set env to production as mentioned in code below.

{{- if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{- template "_internal/google_analytics_async.html" . }}
{{- template "_internal/opengraph.html" . }}
{{- template "_internal/twitter_cards.html" . }}
{{- template "_internal/schema.html" . }}
{{- end }}

However the cover image linking is already under discussion #13 (comment)

The linked pull-request #31 will add duplicate code to the head section, we need more better implementation by overriding the hugo's internal template for both og as well as twitter-cards.

from hugo-papermod.

adityatelange avatar adityatelange commented on May 31, 2024

I have added stuff for this change => 6c4e094c91ce^...306889f
But I am unsure if this needs to be merged 🤔

Hugo has a way to include the image in images

ref : https://github.com/gohugoio/hugo/blob/e9a7ebaf67a63ffe5e64c3b3aaefe66feb7f1868/tpl/tplimpl/embedded/templates/opengraph.html#L5-L16

It can be used in social meta just by adding cover or thumbnail in its name and it will show up 🎉


this won't work as hugo's (opengraph and twitter)'s template doesn't support relative urls, and I cannot fix that

Ah damn! that's disappointing. Looks like there are some fixes scattered on the internet. I'll try these

  1. https://discourse.gohugo.io/t/links-for-images-videos-audio-in-internal-templates-twitter-cards-and-opengraph/10464
  2. https://discourse.gohugo.io/t/how-to-set-open-graph-image-for-a-specific-page/6700/6
  3. https://www.telematika.org/post/adjusting-hugo-internal-open-graph-template/

Originally posted by @singhkays in #13 (comment)

@adityatelange The first link worked perfectly! I'll close this but you should think about implementing this in the theme by default. I can see the value add of specifying one of the images in the blog post as one of the OG or Twitter card images rather than storing these in a separate folder and then specifying the absolute path.

Originally posted by @singhkays in #13 (comment)


cc @aghdom @singhkays @kdkasad

from hugo-papermod.

adityatelange avatar adityatelange commented on May 31, 2024

The thing is I've tested the code with and without having template override the cover link needs to be with other params of twitter cards or same with opengraph, otherwise it would choose the image that is near to other params will be selected

So I think it should be replaced with _internal ones

from hugo-papermod.

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.