-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add API for social media tags #2391
Conversation
Code Climate has analyzed commit 5158344 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 98.9% (50% is the threshold). This pull request will bring the total coverage in the repository to 82.3% (0.0% change). View more on Code Climate. |
e622c68
to
0f49800
Compare
@f1sh1918 @sarahsporck currently we mix meta tags that are statically encoded in the app index.html file and some tags that are fetched from our API. My question: do we want too keep that mixed approach or should we either load meta tags from the index.html or API? If we do the mixed approach we need to decide which tags we keep in the index.html and which ones we need to move into the CMS. Currently, I moved the content of our PHP script into https://github.com/digitalfabrik/integreat-cms/pull/2391/files#diff-450ba7df606ea74a9a19ea6c0ea8388b3be650029959822d92382958f7fcf560R1-R10 . |
300533c
to
d1809a4
Compare
I am pretty sure that the suffix |
As far as I'm concerned I think setting social media headers in the backend as much as possible should be the preferred solution. In the best case scenario this would also include json ld tags. Therefore, the following tags seem to be missing: <meta property="og:site_name" content="integreat.app/malte.app/halloaschaffenburg.app">
<meta property="og:image" content="<%= config.icons.socialMediaPreview %>" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property='og:url' content={window.location.href} /> // not sure about this one And besides these there are the json+ld tags (events, breadcrumbs), which are a little bit more complicated, and adding these could also be discussed separately. Any other tags that are calculated in the frontend should not have anything to do with how search engines or social media crawlers see our site. |
@svenseeberg do you need more help or input for this? If you're too busy right now, I could take over :) |
Please feel always free to add new commits to my branches 😅 I think I can continue to work on this PR next week at the earliest. |
We also have a problem with Aschaffenburg, because they are in the same CMS and I don't want the social media previews to be region specific. Well, we may have to create region settings with global fallbacks. Or maybe it is time to move Aschaffenburg into their own CMS. |
d1809a4
to
69c5727
Compare
bd93453
to
8302876
Compare
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.
Thanks a lot! 💪
Since we're thinking about moving aschaffenburg into its own cms, this is probably not the final state anyways, but I just left my preliminary comments anyway 🙈
f625972
to
6d579c1
Compare
f9371d0
to
37a65d7
Compare
6c17c59
to
0b31fb4
Compare
suggestions are implemented now
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 just noted that the output is not yet exactly what we need. I have not invenstigated the reason.
The html and head tags should not be there.
<html lang="de-DE">
<head>
<title>Alltag - Augsburg | Integreat</title>
<meta name="apple-mobile-web-app-title" content="Alltag - Augsburg | Integreat">
<meta name="twitter:title " content="Alltag - Augsburg | Integreat">
<meta name="twitter:card" content="summary">
<meta property="og:title" content="Alltag - Augsburg | Integreat">
<meta property="og:description" content="Gültiger LinkUngeprüfter LinkUngültiger LinkIgnorierter LinkInterner LinkFehlerhafter interner LinkE">
<meta name="twitter:description" content="Gültiger LinkUngeprüfter LinkUngültiger LinkIgnorierter LinkInterner LinkFehlerhafter interner LinkE">
<meta property="og:image" content="http://localhost:8000/static/logos/integreat/social-media-preview.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:url" content="https://integreat.app/augsburg/de/alltag/" />
By default a HttpResponse
should return an empty document. So its probably something that we do.
@svenseeberg the partial html response was my idea to be able to set the language tag of the html tag. |
0b31fb4
to
670ccfe
Compare
digitalfabrik/integreat-cms#2391 introduces a partial HTML response
32db6da
to
b38c6e7
Compare
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.
Finally, I think this is ready to be merged! 🎉
I opened a PR on the web app's side to adapt their part of the including template as well:
digitalfabrik/integreat-app#2809
Apart from that, I made some further changes to ensure that the response is also a partial HTML response when a 404 error occurs and I changed the tests to compare the literal html output instead of converting the API result to json first.
@david-venhoff could you check again whether everything makes sense at it is now? Thanks! 👍
And @svenseeberg do you have any concerns about this idea with the partial HTML response?
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 looks good to me. I found one question, but I think this pr is already in a good state and should not be delayed much further.
b38c6e7
to
5158344
Compare
Co-authored-by: David Venhoff <[email protected]> Co-authored-by: Timo Brembeck <[email protected]> Co-authored-by: Sven Seeberg <[email protected]>
digitalfabrik/integreat-cms#2391 introduces a partial HTML response
No, should be okay 🎉 |
Short description
Add a new API endpoint that returns a ready to use HTML snippet with social media meta tags. The resulting HTML code can be included with Nginx Server Side Includes into the index.html of the web app.
Proposed changes
/api/social/REGION_SLUG/LANGUAGE_SLUG/PATH
Side effects
/api/social/testumgebung/ar/events/sprachmentoring-treffen-2$2023-08-12
. Not sure if we can find a good way to handle this, as we definitely will have namespace collissions. However, we could add a dedicated route for/api/social/REGION_SLUG/LANGUAGE_SLUG/{events,locations}/PATH
etc. Feedback is welcome.cms
app templates directory, not in theapi
app.hallo
region slug as this is hallo aschaffenburg with a dedicated app in the Integreat CMS.Resolved issues
Fixes: #2084
Additional context
This page should basically be replaced by the social endpoint -> https://git.tuerantuer.org/Integreat/social-media-meta-tags/src/branch/master/meta.php
A few helpful links to get a better understanding of the why and all the follow ups:
og:title
, ...Pull Request Review Guidelines