Giter VIP home page Giter VIP logo

Comments (5)

drem-darios avatar drem-darios commented on May 24, 2024 1

Here is what I suggest can be added to the header.html file. This allows users to customize the most important tags.
<!-- ============ open graph tags ========== --> <meta property="og:site_name" content="{{ .Site.Params.openGraph.siteName | default .Site.Title}}"/> <meta property="og:title" content="{{ .Site.Params.openGraph.title | default .Site.Title}}"/> <meta property="og:description" content="{{ .Site.Params.openGraph.description | default .Site.Params.description }}"/> <meta property="og:image" content="{{ .Site.Params.openGraph.image | default .Site.Params.logo.main }}"> <meta property="og:url" content="{{ .Site.Params.openGraph.url | default .Site.BaseURL }}"> <meta property="og:type" content="{{ .Site.Params.openGraph.title | default "website"}}"/>

from toha.

alex-bezek avatar alex-bezek commented on May 24, 2024

@drem-darios hugo offers the ability to customize opengraph settings via an internal template https://gohugo.io/templates/internal/#open-graph
Does that enable what you are looking for or are there more customizations needed?

from toha.

alex-bezek avatar alex-bezek commented on May 24, 2024

So this is what it would do to the posts pages
image

However, one problem with the open-graph internal template is that it won't take into account internationalization for the main home page for the description like we do here https://github.com/hossainemruz/toha/blob/master/layouts/index.html#L12

image
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/opengraph.html#L2
You could technically add the description config back into the main config.yml if you wanted.

If internationalization isn't a strong requirement, it would technically be simplest to use the internal template to align with hugo standards and not create more custom config options, but it won't be as flexible as something like what @drem-darios posted above

from toha.

tanho63 avatar tanho63 commented on May 24, 2024

Echoing this request (also for Twitter cards)!

from toha.

hossainemruz avatar hossainemruz commented on May 24, 2024

Added OpenGraph header in #333. Used Hugo internal template for the post pages. Added a custom template for home page to handle the internationalization.

Check this PR to see how to customize the headers.
hugo-toha/hugo-toha.github.io#77

from toha.

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.