Skip to content

Commit f8e804d

Browse files
authored
Image rendering docs and scripts (#14613)
* update sponsor script for assets directory Signed-off-by: Matty Stratton <[email protected]> * fix hugo version in posh script Signed-off-by: Matty Stratton <[email protected]> * Update change sponsor script for assets directory Signed-off-by: Matty Stratton <[email protected]> * Fix documentation Signed-off-by: Matty Stratton <[email protected]> * Add warning if sponsors not in directory Signed-off-by: Matty Stratton <[email protected]> * Update add_sponsors.sh * Update warning message slightly Signed-off-by: Matty Stratton <[email protected]> --------- Signed-off-by: Matty Stratton <[email protected]>
1 parent 490ff7a commit f8e804d

File tree

7 files changed

+23
-15
lines changed

7 files changed

+23
-15
lines changed

hugoserver.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ $MyPath = $PSScriptRoot
55

66
docker stop hugo-server
77
docker rm hugo-server
8-
docker run -tip 1313:1313 -v $(pwd):/home/circleci/project:cached -e HUGO_THEME=devopsdays-theme -e HUGO_BASEURL="http://localhost:1313" --name hugo-server --entrypoint "" cibuilds/hugo:0.123.2 hugo server --watch --bind ""
8+
docker run -tip 1313:1313 -v $(pwd):/home/circleci/project:cached -e HUGO_THEME=devopsdays-theme -e HUGO_BASEURL="http://localhost:1313" --name hugo-server --entrypoint "" cibuilds/hugo:0.126.1 hugo server --watch --bind ""

themes/devopsdays-theme/layouts/partials/sponsors.html

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ <h4 class="sponsor-cta">{{ $level.label }} Sponsors</h4>
8383
{{- $imagefile := $imageresource.Fit "300x300 webp Lanczos q100" -}}
8484
<img src = "{{ $imagefile.RelPermalink }}" alt = "{{ $s.name }}" title = "{{ $s.name }}" class="img-fluid">
8585
{{- else -}}
86+
{{- warnf "No image file found in assets directory for %s. Please copy it to %s for best performance." .id $assetdir -}}
8687
<img src = "/img/sponsors/{{ .id }}.png" alt = "{{ $s.name }}" title = "{{ $s.name }}" class="img-fluid">
8788
{{- end -}}
8889
</a>

utilities/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Use [add_new_event.sh](add_new_event.sh) to add a new event. This is year-specif
2020
1. The script will create a data file for your event in `data/events/yyyy-city.yml`. This is where you will configure many of your updates and customizations. In particular, you need to list your local organizer team here.
2121
1. The script will populate your event directory in `content/events/yyyy-city` with default content. You should edit it as desired.
2222
1. The script will add or update your entry in `static/_redirects`. This allows you to use the url `https://devopsdays.org/city-name` to point to your current-year event.
23-
1. Once you have created a logo graphic, place it in `static/events/yyyy-city/logo.png`. (The file MUST be called `logo.png`.) The sample welcome page has a commented-out element to display a logo named in this way. For front-page use, you also need a square version in `static/events/yyyy-city/logo-square.jpg`.
23+
1. Once you have created a logo graphic, place it in `assets/events/yyyy-city/logo.png`. (The file MUST be called `logo.png`.) The sample welcome page has a commented-out element to display a logo named in this way. For front-page use, you also need a square version in `assets/events/yyyy-city/logo-square.jpg`.
2424

2525
## Google Analytics
2626

@@ -30,7 +30,7 @@ If you have set up a Google Analytics v4 or newer account for tracking your spec
3030

3131
### Event Square Logo
3232

33-
To customize the logo that appears on the root of devopsdays.org, place a square file (jpg format only) in `static/events/yyyy-city`. It must be named `logo-square.jpg` and should be at minimum 300px x 300px, but optimally should be 600px x 600px. Note that in the preview (without gulp processing), non-square files will appear to be okay. However, once processed for production, they will be stretched to be square.
33+
To customize the logo that appears on the root of devopsdays.org, place a square file (jpg format only) in `assets/events/yyyy-city`. It must be named `logo-square.jpg` and should be at minimum 300px x 300px, but optimally should be 600px x 600px. Note that in the preview (without gulp processing), non-square files will appear to be okay. However, once processed for production, they will be stretched to be square.
3434

3535
### Reference Content
3636

@@ -94,7 +94,7 @@ See [Pivotal logo update](https://github.com/devopsdays/devopsdays-web/pull/6501
9494
Use [add_sponsors.sh](add_sponsors.sh) to easily add new sponsors. (Only do this if the sponsor doesn't already exist.)
9595

9696
1. Sponsors need a file in the data directory, as such: `data/sponsors/sponsorname.yml`. Before creating a new one, look to see if there is an old one, possibly with a date prepended. If it has the right URL and logo, you should use it instead of creating a new one.
97-
1. Put the images for your sponsors in the `static/img/sponsors` directory. They need to be PNG files and named exactly after the name of the sponsor in your event file (and the corresponding sponsor data file), i.e., `static/img/sponsors/sponsorname.png`.
97+
1. Put the images for your sponsors in the `assets/sponsors/FIRST_INITIAL/` directory. They need to be PNG files and named exactly after the name of the sponsor in your event file (and the corresponding sponsor data file), i.e., `assets/sponsors/s/sponsorname.png`.
9898
1. Add the new sponsor to your event's datafile with the appropriate level.
9999

100100
See [contrib/make_sponsors.rb](make_sponsors.rb) for another option.
@@ -115,7 +115,7 @@ All logos will be resized at release time, to 200px wide. Versions for high-dens
115115

116116
See the example local organizer team members listed in the generated data file found in `data/events/201?-yourcity.yml`. To generate the `team_members: ` section you can use [add_organizers.sh](add_organizers.sh).
117117

118-
The organizer photo must be in JPG format, and should be a minimum 300px x 300px, but optimally 600px x 600px. These images should be placed in the `static/events/yyyy-city/organizers` directory (which the `add_organizers.sh` script will do).
118+
The organizer photo must be in JPG format, and should be a minimum 300px x 300px, but optimally 600px x 600px. These images should be placed in the `assets/events/yyyy-city/organizers` directory (which the `add_organizers.sh` script will do).
119119

120120
Any PRs adding a new local organizer will need to be accompanied by an email to `[email protected]` with their full name and email address. We merge the PR at the same time as adding them to email lists and Slack, so if you aren't ready to send that email, merging your PR will be delayed until we have that info.
121121

utilities/add_organizers.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ read -p "Enter path to organizer image as jpg (return to skip): " organizerimage
7878
[ -z "${organizerimage}" ] && organizerimage=''
7979

8080
if [ $organizerimage ]; then
81-
cp "$organizerimage" ../static/events/$event_slug/organizers/$organizer_slug.jpg
81+
cp "$organizerimage" ../assets/events/$event_slug/organizers/$organizer_slug.jpg
8282
else
83-
echo "Put organizer image at ../static/events/$event_slug/organizers/$organizer_slug.jpg before creating the pull request, if desired."
83+
echo "Put organizer image at ../assets/events/$event_slug/organizers/$organizer_slug.jpg before creating the pull request, if desired."
8484
fi
8585

8686
####################

utilities/add_speakers.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,17 @@ string_replace "ABSTRACT" "${abstract}" "${talkfile}"
9898
#
9999

100100
# if speaker image is already in expected location
101-
if [[ -f "../static/events/$event_slug/speakers/$speaker_slug.png" ]] ; then
101+
if [[ -f "../assets/events/$event_slug/speakers/$speaker_slug.png" ]] ; then
102102
string_replace "image = \"\"" "image = \"${speaker_slug}.png\"" "${speakerfile}"
103103
echo "found ${speaker_slug}.png, using"
104104
else
105105
read -p "Enter path to speaker image PNG: " speakerimage
106106
if [[ -n "${speakerimage}" ]] && [[ -f "${speakerimage}" ]] ; then
107-
cp -v "${speakerimage}" "../static/events/${event_slug}/speakers/${speaker_slug}.png"
107+
cp -v "${speakerimage}" "../assets/events/${event_slug}/speakers/${speaker_slug}.png"
108108
string_replace "image = \"\"" "image = \"${speaker_slug}.png\"" "${speakerfile}"
109109
else
110110
echo "no image used. If desired:
111-
1. Copy PNG into ../static/events/${event_slug}/speakers/${speaker_slug}.png
111+
1. Copy PNG into ../assets/events/${event_slug}/speakers/${speaker_slug}.png
112112
2. update ${speakerfile}, changing image = \"${speaker_slug}.png\"
113113
before creating your Pull Request.
114114
"

utilities/add_sponsors.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ echo "Adding new sponsors; use CTRL+C to stop..."
3333
# Gather info
3434
read -p "Enter sponsor name: " sponsorname
3535
sponsor_slug=$(echo $sponsorname | tr '-' ' ' | tr -dc '[:alnum:][:blank:]' | tr '[:upper:]' '[:lower:]'| tr 'āáǎàãâēéěèīíǐìōóǒòöūúǔùǖǘǚǜü' 'aaaaaaeeeeiiiiooooouuuuuuuuu' | tr ' ' '-')
36+
sponsor_initial=$(echo "${sponsor_slug}" | cut -c 1)
3637

3738
# set default sponsor yaml file
3839
sponsorfile="../data/sponsors/$sponsor_slug.yml"
@@ -67,9 +68,12 @@ fi
6768
# Set logo
6869

6970
if [ $logo ]; then
70-
cp "$logo" ../static/img/sponsors/$sponsor_slug.png
71+
if [ ! -d ../assets/sponsors/$sponsor_initial/]; then
72+
mkdir -p ../assets/sponsors/$sponsor_initial/
73+
fi
74+
cp "$logo" ../assets/sponsors/$sponsor_initial/$sponsor_slug.png
7175
else
72-
echo "Set the sponsor logo at ../static/img/sponsors/$sponsor_slug.png before submitting PR."
76+
echo "Set the sponsor logo at ../assets/sponsors/$sponsor_initial/$sponsor_slug.png before submitting PR."
7377
fi
7478

7579
echo "Add this to ../data/events/"$year"/"$city_slug"/main.yml under sponsors:"

utilities/change_sponsor_logo.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ source common_code
1313
SPONSOR_NAME=${1:-}
1414
IMAGE_TO_COPY=${2:-}
1515
TODAY=$(date +%Y%m%d)
16-
16+
SPONSOR_INITIAL=$(echo "${SPONSOR_NAME}" | cut -c 1)
1717
# Make sure we have everything we need to run.
1818

1919
if [ $# -ne 2 ]; then
@@ -22,7 +22,7 @@ if [ $# -ne 2 ]; then
2222
exit 1
2323
fi
2424

25-
IMAGE_FILE="$(gitroot)/static/img/sponsors/$SPONSOR_NAME.png"
25+
IMAGE_FILE="$(gitroot)/assets/sponsors/$SPONSOR_INITIAL/$SPONSOR_NAME.png"
2626
if [ ! -f "$IMAGE_FILE" ]; then
2727
echo "Couldn't find a sponsor image at $IMAGE_FILE."
2828
exit 1
@@ -41,10 +41,12 @@ fi
4141

4242
# Start by copying the existing definitions as the "old" definitions
4343

44-
OLD_IMAGE_FILE=$(gitroot)/static/img/sponsors/$SPONSOR_NAME-before-$TODAY.png
44+
OLD_IMAGE_FILE=$(gitroot)/assets/sponsors/$SPONSOR_INITIAL/$SPONSOR_NAME-before-$TODAY.png
45+
OLD_STATIC_IMAGE=$(gitroot)/static/img/sponsors/$SPONSOR_NAME-before-$TODAY.png
4546
OLD_SPONSOR_FILE=$(gitroot)/data/sponsors/$SPONSOR_NAME-before-$TODAY.yml
4647

4748
cp "$IMAGE_FILE" "$OLD_IMAGE_FILE"
49+
cp "$IMAGE_FILE" "$OLD_STATIC_IMAGE"
4850
cp "$SPONSOR_FILE" "$OLD_SPONSOR_FILE"
4951

5052
# Find all events with this sponsor in years other than this year, excluding existing renames
@@ -60,6 +62,7 @@ done
6062
popd > /dev/null
6163

6264
# Put the new image in place.
65+
6366
cp "$IMAGE_TO_COPY" "$IMAGE_FILE"
6467

6568
# Modify any archived events.

0 commit comments

Comments
 (0)