-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
URW-189 Open Graph tags #179
base: develop
Are you sure you want to change the base?
Conversation
Updated default value setting in head() Minor db connection fix
@@ -1,6 +1,6 @@ | |||
<?php | |||
require('../../template/top.php'); | |||
head('Merch Ordered', true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change shouldn't be needed, since it's just passing in defaults, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default description is null
which puts the default description. Putting an empty string sets the OG description to be empty.
@@ -3,7 +3,7 @@ | |||
require(BASE . '/api/discord/bots/admin.php'); | |||
//require(BASE . '/api/google/count_majors.php'); | |||
|
|||
head('About Us', true); | |||
head('About Us', true, false, false, "UNT Robotics is a broad engineering student organization at the University of North Texas. We focus on developing student's skills in engineering & robotics, which involves a range of beginner workshops, industry talks, robotics-based hackathons, recreational projects and competitions."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how I feel about having these as function args...
What if we create two new classes:
HeadingConfig
which contains the auth, return, and the second class OpenGraphConfig
That way this ugliness of stacking params should be fixed and instead we'll have a nicer way to specify something like
$config = {
auth: false,
og: $og_config
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it go in template/top.php
or in a separate file in template/classes/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each would be its own new class under template/classes
and head
would take a single argument of $config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you instantiate objects in PHP like that? The only way I can see to get a similar instantiation is if it's an array. As an object, it ends up moving the messy stacking of params into a constructor instead of the head function like this:
$og_config = new OpenGraphConfig('UNT Robotics is a broad engineering...', 'images/og-image-2.png');
$config = new HeadingConfig('About Us', true, true, false, $og_config);
head($config);
I don't think that's any better than extracting the params into separate variables and passing the variables instead of values.
images/og-image.png
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do some platforms require a square og image? I vaguely recall from my days of setting up og at NT Daily that I had to specify a square image for facebook or twitter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think twitter has a specific tag since the rectangle image gets cropped. https://devcommunity.x.com/t/twitter-card-for-open-graph/149336
You can specify the width and height for the image too. With Facebook it helps it load properly apparently? https://developers.facebook.com/docs/sharing/webmasters/#images
I'll try messing around with a square image
merch/product.php
Outdated
head("Buy {$product->get_name()}", true); | ||
|
||
preg_match("@^(.+?)•@ims", $catalog_product->get_description(), $m); | ||
//var_dump($m); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the debugging code
merch/product.php
Outdated
@@ -2,7 +2,7 @@ | |||
require('../template/top.php'); | |||
require(BASE . '/api/printful/printful.php'); | |||
require(BASE . '/template/functions/functions.php'); | |||
require(BASE . '/template/functions/payment_button.php'); | |||
//require(BASE . '/template/functions/payment_button.php'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was throwing an error when I pushed it to the dev site (probably because I deleted the file)
merch/product.php
Outdated
@@ -289,7 +290,7 @@ class="btn variant-btn" | |||
'variant' => $selected_variant->get_id() | |||
)); | |||
|
|||
$payment_button = new PaymentButton( | |||
/* $payment_button = new PaymentButton( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If any code is commented, it needs to:
- Have a TODO or FIXME comment, with a backlog ticket number to address the issue that led to it being commented out
- Or be considered dead code and just deleted (the nice thing about git is we can still find dead and deleted code from the past)
Adds Open Graph tags to every page. These tags are used for embeds on social media and certain messaging platforms, like Facebook and Discord.
This PR adds the required tags. The only optional tag added is
site_name
.Also fixes 2 bugs in
/template/top.php
:mysqli->connect()
.auth
was set totrue
due tonull
being a falsy value.