Skip to content

first_image URLs not resolving correctly on RTD  #59

Closed
@rabernat

Description

@rabernat

Thanks for this amazing package! 👏 So helpful for the open source documentation community.

Context

I am trying to use this extension with a sphinx site (https://github.com/pangeo-forge/pangeo-forge-recipes/tree/master/docs) on ReadTheDocs. My config looks like this

ogp_image = "_static/pangeo-forge-logo-blue.png"
ogp_use_first_image = True

I am explicitly not setting ocp_site_url, as I want it to be set automatically, following this code path:

https://github.com/wpilibsuite/sphinxext-opengraph/blob/d99815bac5a42f5e9ac756cc3e74eebfd80d2505/sphinxext/opengraph/__init__.py#L70-L72

As far as I can tell, this is working correctly.

What works: default ogp_image

Our home page - https://pangeo-forge.readthedocs.io/en/latest/index.html - has no image so defaults to ogp_image. The headers look like this:

<meta property="og:title" content="Pangeo Forge Documentation" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://pangeo-forge.readthedocs.io/en/latest/index.html" />
<meta property="og:description" content="Resources for understanding and using Pangeo Forge First Steps: New to Pangeo Forge? You are in the right spot! What is Pangeo Forge?- Read more about Pangeo Forge and how it works., Introduction T..." />
<meta property="og:image" content="https://pangeo-forge.readthedocs.io/en/latest/_static/pangeo-forge-logo-blue.png" />
<meta property="og:image:alt" content="Pangeo Forge Documentation" />

The image url - https://pangeo-forge.readthedocs.io/en/latest/_static/pangeo-forge-logo-blue.png - is correct and works.

What does not work: first_image

This page - https://pangeo-forge.readthedocs.io/en/latest/introduction_tutorial/intro_tutorial_part1.html - DOES have an image.

It's header looks like this

<meta property="og:title" content="Defining a FilePattern (Intro Tutorial Part 1)" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://pangeo-forge.readthedocs.io/en/latest/introduction_tutorial/intro_tutorial_part1.html" />
<meta property="og:description" content="Welcome to the Pangeo Forge introduction tutorial! This tutorial is split into three parts: Defining a FilePattern, Defining a recipe and running it locally, Setting up a recipe to run in the cloud..." />
<meta property="og:image" content="https://pangeo-forge.readthedocs.io/en/_images/OISST_URL_structure.png" />
<meta property="og:image:alt" content="OISST file structure" />

Note that here the og:image URL is not correct! https://pangeo-forge.readthedocs.io/en/_images/OISST_URL_structure.png

It should be https://pangeo-forge.readthedocs.io/en/latest/_images/OISST_URL_structure.png

The autogenerated image URL is missing the /latest directory.

#48 was supposed to add support for relative URLs, but something is not working right here. I would appreciate any suggestions you may have.


🙏 thanks again for your work on this very useful package!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions