-
Notifications
You must be signed in to change notification settings - Fork 220
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
Use shorter shortlinks #689
Conversation
Rather than needing to choose a meaningful name for each "shortlink", use an alphanumeric 6-character link. Updated README with a command to generate a link in this format.
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 Update (preview) for stack pulumi/pulumi.io-staging was successful.
Resources:
44 changes
+ 2 to create
~ 41 to update
- 1 to delete
506 unchanged
Visit the Pulumi Cloud Console for more information.
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.
Sounds reasonable, but it might be useful to have vanity URLs as well if we have the ability. So maybe just adding a note that you could choose any URL-safe name for the permalink that would work too. But I agree generating one random is easier.
If you expect to be doing this a lot over the coming weeks/months, consider writing a Bash script to just generate the md file as well. e.g. create-short-url.sh "xvd72s" "/reference/toubleshooting.html#..."
.
@chrsmith Added a script and updated the README |
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 Update (preview) for stack pulumi/pulumi.io-staging was successful.
Resources:
44 changes
+ 2 to create
~ 41 to update
- 1 to delete
506 unchanged
Visit the Pulumi Cloud Console for more information.
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.
Some nit picks on the Bash script, but if it works feel free to submit it as-is.
@@ -0,0 +1,45 @@ | |||
#!/usr/bin/env bash | |||
|
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.
Let's add a big long, comment explaining what this script does.
scripts/create_short_url.sh
Outdated
|
||
if [[ $# -ne 2 && $# -ne 3 ]]; then | ||
cat << EOF | ||
Usage: create_short_url.sh <target_link> <filename> [shortlink] |
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.
Nit: If we ever rename the script this would be out of date, $0
can be used instead of create_short_url.sh
.
scripts/create_short_url.sh
Outdated
fi | ||
|
||
RELATIVEPATH="./shortlinks/${FILENAME}.md" | ||
FILEPATH=$(echo "$(cd "$(dirname "$RELATIVEPATH")"; pwd -P)/$(basename "$RELATIVEPATH")") |
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.
To cut down on the nested expressions, could we have FOO=$(cd "$(dirname "$RELATIVEPATH")"; pwd -P)
and then reference $FOO
here instead?
scripts/create_short_url.sh
Outdated
fi | ||
|
||
RELATIVEPATH="./shortlinks/${FILENAME}.md" | ||
FILEPATH=$(echo "$(cd "$(dirname "$RELATIVEPATH")"; pwd -P)/$(basename "$RELATIVEPATH")") |
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.
Nit: To be consistent with the rest of the file, we should use ${RELATIVEPATH}
, 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 Update (preview) for stack pulumi/pulumi.io-staging was successful.
Resources:
+ 2 to create
~ 41 to update
- 1 to delete
3 changes. 506 unchanged
Visit the Pulumi Cloud Console for more information.
Rather than needing to choose a meaningful name for each "shortlink",
use an alphanumeric 6-character link. Updated README with a command
to generate a link in this format.