Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to the podcast category in single podcast. #330

Conversation

StevenDufresne
Copy link
Collaborator

This PR links the Podcast text to the /news/podcast URL. This is not a great approach especially because news is hard coded and our local dev doesn't serve out of a subfolder.

I'm getting this PR early to discuss the best approach. Is there a better way to link to urls in HTML templates?

@iandunn
Copy link
Member

iandunn commented Feb 17, 2022

Unfortunately that's a shortcoming of FSE. #57 has some background info

We've used relative URLs in a few places, but IIRC that only works on the homepage:

I think in this case hardcoding the production URL is the least-bad option, unless someone else knows of a better way?

@ryelle
Copy link
Contributor

ryelle commented Feb 17, 2022

Podcasts isn't actually a category, or else we could use <!-- wp:post-terms {"term":"category"} /-->. I think the truly "least-bad" option would be to make our own post-type-name block with an isLink attribute, and propose the same to Gutenberg. Ours can follow the same pattern as the other blocks we've written, rather than a full interactive editor interface, so that shouldn't take very long to build.

@StevenDufresne
Copy link
Collaborator Author

@iandunn Thanks for creating the issues in Gutenberg!

@ryelle Yeah, I like the post-type-name approach.

Maybe a site-link component could work? Where it outputs a link and makes use of `get_site_url? idk.

@ryelle
Copy link
Contributor

ryelle commented Feb 18, 2022

Maybe a site-link component could work? Where it outputs a link and makes use of `get_site_url? idk.

While that would work conceptually in the template, it's not really a block - I don't know how that would work in an editor, for example. (edit: unless I'm misunderstanding how it would work)

@StevenDufresne
Copy link
Collaborator Author

Maybe a site-link component could work? Where it outputs a link and makes use of `get_site_url? idk.

While that would work conceptually in the template, it's not really a block - I don't know how that would work in an editor, for example. (edit: unless I'm misunderstanding how it would work)

Yeah, it would probably break "block" conventions. I'm concerned that creating a post-type-name component is only kicking the can down the road, so to speak. There will be other scenarios where we want to link to things that are internal and not post types.

Maybe thinking about this from a template first perspective is wrong? Maybe content with links should be done in the content/editor anyways. I'm behind on the localization conversation, but I imagine its a similar problem?

@ryelle
Copy link
Contributor

ryelle commented Feb 18, 2022

I'm concerned that creating a post-type-name component is only kicking the can down the road, so to speak.

I see it as analogous to the post-author-name, post-title, site-title, etc blocks, which all have an isLink attribute, so I think that's an established pattern in GB.

Maybe content with links should be done in the content/editor anyways.

This particular link isn't in the Episode CPT, it's in the template itself. We haven't been using the site editor (it's currently broken, in fact #95). If we update the template in the site editor, we're basically forking it, and that template won't get any new code updates (there's an issue in GB about this: WordPress/gutenberg#22469). So unfortunately I don't think that's viable with the setup we have right now.

@StevenDufresne
Copy link
Collaborator Author

If we update the template in the site editor, we're basically forking it, and that template won't get any .

Ah that's right. Thanks for mentioning that? I'm not opposed to the post-type-name control to solve this in the short term but It would be nice and forward-moving if we can come up with something reliable. Others will be in the same position we are.

@ryelle
Copy link
Contributor

ryelle commented Feb 22, 2022

It would be nice and forward-moving if we can come up with something reliable.

I don't see post-type-name itself as a short-term fix, I think it lines up with how other content-blocks work (I see our likely implementation as a short-term fix, so that we don't need to build a whole editor interface). I'm having trouble understanding what the other issues you see are, but if you think this is something other people would run into, you should open an issue in Gutenberg to discuss it.

@StevenDufresne
Copy link
Collaborator Author

Will be replaced by #361

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants