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

Do not render the pdf_url metatag if there is no value #985

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

joecorall
Copy link
Member

@joecorall joecorall commented Oct 22, 2023

What does this Pull Request do?

With the space added to the [islandoratokens:pdf_url] token, if that token is used in metatags, the <meta> element always renders even if there is no PDF associated with the given node.

Also updates the function that token uses to always return a string.

What's new?

Remove the space from the token.

How should this be tested?

  • Enable the metatags module
  • Add [islandoratokens:pdf_url] to one of the metatag elements (for testing purposes, it can be any element)
  • Visit a node/XYZ page on your site that does not have a PDF
  • View the HTML source and see <meta name="citation_pdf_url" content=" " />
  • Apply this PR
  • See that that element no longer shows

Documentation Status

  • Does this change existing behaviour that's currently documented? no
  • Does this change require new pages or sections of documentation? no
  • Who does this need to be documented for? no

Interested parties

@Islandora/committers
@wgilling

@wgilling wgilling self-requested a review November 1, 2023 17:51
@wgilling
Copy link

wgilling commented Nov 3, 2023

Enable the metatags module
I tried to test this and I got stumped by the first step. Should I run composer require drupal/metatags followed by running drush pm:enable metatags?

@joecorall
Copy link
Member Author

@wgilling I tried to test this and I got stumped by the first step. Should I run composer require drupal/metatags followed by running drush pm:enable metatags?

That sounds right. However you normally install/enable modules will do.

@wgilling
Copy link

wgilling commented Nov 3, 2023

Ok - sorry for the false alarm there. With the original islandora 2.x code, I cloned https://git.drupalcode.org/project/metatag off in a separate folder and then copied it under the modules/contrib and then enabled it using the GUI. I then proceeded to add a meta tag for original_source: | [islandoratokens:pdf_url] and navigated to a node which did not have any document pdf and I saw the meta tag with the empty content part of it:
<meta name="original-source" content="" />

I then swapped out the islandora code with Joe's branch and cleared the cache and viewed the same object as before and view-source revealed that this metatag was no longer rendered, so this PASSES QC and I'd approve a merge of this.

Copy link

@wgilling wgilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change passed the steps to test and I approve to merge.

@rosiel rosiel merged commit f29fef2 into Islandora:2.x Nov 6, 2023
9 checks passed
@joecorall joecorall deleted the patch-1 branch November 6, 2023 13:48
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