Closed christophsax closed 9 months ago
The site is published via Cloudfront at blog.cynkra.com -> better than gh-pages
Previously existing links are breaking anyway, right?
No, we should redirect cynkra.com/blog -> blog.cynkra.com while preserving the suffix parts.
@maelle are the suffixes, i.e. the permalinks, identical (old to new)?
It looks good but see #38, I'll make a PR. The two missing posts are the ones with outdated job ads.
current_site <- "https://cynkra.com/sitemap.xml"
new_blog <- "https://blog.cynkra.com/sitemap.xml"
current_links <- current_site |>
xml2::read_xml() |>
xml2::xml_find_all("//d1:loc") |>
xml2::xml_text() |>
purrr::keep(startsWith, "https://www.cynkra.com/blog/") |>
stringr::str_remove_all("https://www.cynkra.com/blog/") |>
stringr::str_remove_all("\\/$") |>
purrr::keep(nzchar)
new_links <- new_blog |>
xml2::read_xml() |>
xml2::xml_find_all("//d1:loc") |>
xml2::xml_text() |>
stringr::str_remove_all("https://blog.cynkra.com/blog/posts/") |>
stringr::str_remove_all("\\/index\\.html")
current_links[!(current_links %in% new_links)]
#> [1] "2019-08-02-system-engineer" "2020-09-15-devops"
new_links[!(new_links %in% current_links)]
#> [1] "https://blog.cynkra.com" "https://blog.cynkra.com/blog"
Created on 2024-01-08 with reprex v2.0.2
@pat-s regarding redirection, see above and #39
The two missing posts are the ones with outdated job ads.
I think they can/should be left out anyhow.
Ok so the answer to your question is yes the last part of permalink is identical but the whole links would be better after #39 IMHO
@maelle Do we still need something here? If in doubt, I would rather compromise than further delay the go-live.
@DivadNojnarg is now responsible for blog content, and we would like to start publishing again. Thanks a lot!
I need help in #45 for the two things are are necessary there "Fix toggle and search icon in light mode" and "Find a way to make logo dark". I can read comments next Monday to implement suggestions, then hopefully merge that PR, then ask for the redirect because what remains can indeed be fixed later.
@DivadNojnarg if needed we can have a call next week so I explain what my problems are, maybe we can even fix them live and be done. :grin: Looking forward to reading the blog so motivated to not delay this! :innocent:
Thanks! If in doubt, I think it would also make sense to move forward and fix #45 later on. Our current blog is much worse than what we have here, even if some hick ups are left for the future.
Redirection is in place. Here's the LambdaEdge function I wrote to take care of all the redirection cases.
'use strict';
export const handler = async(event) => {
var request = event.Records[0].cf.request;
var uri = request.uri;
if (uri === "/blog/" || uri === "/blog") {
var redirectUrl = `https://blog.cynkra.com/`;
var response = {
status: "301",
statusDescription: "Moved Permanently",
headers: {
location: [{ key: "Location", value: redirectUrl }],
},
};
return response;
}
if (uri.includes("/blog/")) {
var redirectUrl = `https://blog.cynkra.com/posts${uri.replace("/blog", "")}`;
var response = {
status: "301",
statusDescription: "Moved Permanently",
headers: {
location: [{ key: "Location", value: redirectUrl }],
},
};
return response;
}
return request;
}
I also updated the navbar link in cynkraweb.
Amazing, thanks a lot @pat-s!
Thank you @pat-s!
I think I missed something and closed this too early. Or, how do I follow the delay in publication?
@pat-s: I don't see the results of https://github.com/cynkra/cynkrablog/commit/119b73fb0dc54e7cb9e046aaa65878250a9117a9 on blog.cynkra.com
Ah now I do! How can one follow publication, is there a dashboard somewhere? Like what one gets with GitHub Pages deploy, seeing whether it's queued/in progress/etc.
It should be immediate (few minutes) since we invalidate the cloudfront cache in the workflow run. How long was the delay?
PS: GH pages: I think https://cynkra.github.io/cynkrablog/ should be turned off to avoid multiple sites with the same content.
Probably only a few minutes! I got impatient and started wondering whether what worked locally didn't work (the new thing was not a new post so less easy to see whether the version had been deployed)
https://cynkra.github.io/cynkrablog/ has <meta name="robots" content="noindex">
and is used for previews, isn't it fine to keep it?
Yes, with a robot.txt entry it should be fine then 👍
wait do you mean I should add a robot.txt, not only that meta tag?
Probably for @pat-s, feel free to reassign @maelle.
Alternatively, I could switch the link in the cynkraweb to
https://cynkra.github.io/cynkrablog/
. I don't have a problem with that, but it looks a bit uglier, and external links break if we switch back.Previously existing links are breaking anyway, right?
If in doubt, I would opt for the faster solution.