I was annoyed about standard blogger post url with a date in it e.g. https://tdalon.blogspot.com/2020/07/teamsy.html . I wanted a date neutral one so I can redirect documentation with a fixed doc root url (example from internal to external). Instead of previous url https://tdalon.blogspot.com/2020/07/teamsy.html something like this: https://tdalon.blogspot.com/teamsy This is a solution I have found to fix it.
Update: the original code is provided here: https://github.com/jokenox/bloggerjs by Kenny Cruz.
You shall copy the code just below the <head> tag in your Html Template.
I have found the solution first here: https://www.niltuts.com/how-to-remove-date-from-blogger-url/
by Indranil Paul, 2020-17-03. (it looks to me Indranil just stole this code without credit)
After some experimenting, I have reverted to converting all the links to URL without dates because:
- When you share a link to twitter the preview does not work with cleaned-up links
- You can not link to a specific part of a post (using anchor id) like for example https://tdalon.blogspot.com/2020/09/teams-presentation-with-video.html#ndi : if you redirect to clean links with this code the anchor will be removed (issue 4)
[I have tried to fix the code for this but couldn't]
I use now the following configuration:
// Configuration
var config = {
postsDatePrefix: true,
accessOnly: true,
useApiV3: false,
apiKey: "mykey"
}
var config = {
postsDatePrefix: true,
accessOnly: true,
useApiV3: false,
apiKey: "mykey"
}
This allows me to use shortened URL like https://tdalon.blogspot.com/teamsy instead of https://tdalon.blogspot.com/2020/07/teamsy.html
I have updated my NWS PowerTool so that IntelliPaste will also clean-up such blogger links automatically.
Experimenting with using the API key (it shall be faster) did not work for me. See reported issue
Thanks to Kenny Cruz for sharing this!
No comments:
Post a Comment