question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

slug is missing from og:url

See original GitHub issue

Describe the bug post slug is missing from og:url, resulting all embed linked to main page instead of post.

To Reproduce

  1. Open demo blog post like this
  2. og:url is set to https://nobelium.vercel.app (instead of https://nobelium.vercel.app/what-make-vs-code)

Expected behavior og:url should be post link, not blog main page link

Screenshots chrome_2022-10-05_10-54-57

Platform:

  • OS: Windows
  • Browser: Chrome
  • Version: 106.0.5249.91

Additional context I fixed by setting Layout tag slug to frontMatter.slug - See this line

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
izuolancommented, Oct 22, 2022

Closed - Looks like repo is not actively on development.

Hello, it’s easy to fix this problem.

In Container.js first line add:

import { useRouter } from 'next/router'

In line 9 below add:

const router = useRouter()

Edit line 37 code:

      <meta
        property='og:url'
        content={meta.slug ? `${url}/${meta.slug}` : `${url}${router.asPath}`}
      />
image

Finally, if you are interested, you can refer to my fork project: Notionic

0reactions
Lastorder-DCcommented, Oct 20, 2022

Closed - Looks like repo is not actively on development.

Read more comments on GitHub >

github_iconTop Results From Across the Web

slug not showing in browsers - WordPress.org
The name of the slug is Press. The url should read /press. It actually reads /?page_id=31. Why? This topic was modified 1 year,...
Read more >
URL slugs - Squarespace Help Center
A URL slug is the exact address of a specific page or collection item on your site. Squarespace automatically assigns a URL slug...
Read more >
Topic: 'Slugs' option has disappeared | WordPress.com Forums
The only option it gives me is to write an excerpt. It allows me to change slugs through the WordPress app on my...
Read more >
Slug disappeared - Toolset
Go to Toolset > Post Types and edit the custom post type where you have experienced the missing permalink slug problem. Scroll down...
Read more >
OctoberCMS: Why is the slug value missing in "post.url" of the ...
The url of the blog post page was url = "/blog/post" . I changed it to url = "/blog/post/:slug" and the issue was...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found