quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.81k stars 309 forks source link

Wrong URL for twitter cards/open graph #4278

Closed ddobrinskiy closed 1 year ago

ddobrinskiy commented 1 year ago

It appears that when I'm publishing my Jupyter notebooks to quartopub, the OG/twitter preview image urls are wrong.

Code in jupyter/qmd:

![](images/streamlit-jupyter-logo.png){.preview-image}

What is rendered in html:


<meta property="og:image" content="https://quartopub.com/sites/ddobrinskiy/blog/posts/2023/02/nbdev_streamlit_jupyter/images/streamlit-jupyter-logo.png">

<meta name="twitter:image" content="https://quartopub.com/sites/ddobrinskiy/blog/posts/2023/02/nbdev_streamlit_jupyter/images/streamlit-jupyter-logo.png">

However, the links from above lead to 404, page not found.

The correct URL would be the following: https://ddobrinskiy.quarto.pub/blog/posts/2023/02/nbdev_streamlit_jupyter/images/streamlit-jupyter-logo.png

I'm wondering if this is a bug, or something wrong with my config?

I run quarto publish from the CLI to publish my website.

The source code is available here:

ddobrinskiy commented 1 year ago

After digging deeper, here's what I found: the base url for these links is taken from _publish.qmd

After changing it to https://ddobrinskiy.quarto.pub/blog and publishing, the problem is temporarily fixed.

However, after publishing, quarto automatically changes the url in _publish.qmd back to what it was before: https://quartopub.com/sites/ddobrinskiy/blog

And so when I publish again, the preview images don't work again, because they lead to non-existent links for images, as outlined in the original issue.

So looks like this is a bug with the CLI?

dragonstyle commented 1 year ago

This is actually fixed in our Quarto 1.3 release- could you give that a try and see if it resolves the issue?

(for reference- dug this up) https://github.com/quarto-dev/quarto-cli/commit/47f12b052a07ed5bb07bafe6448cddd4d9eec4a6