Skip to content
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

feat: seo improvements #421

Merged
merged 38 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
14b13ea
feat: do not include sitemap.xml
jorgepiloto Feb 2, 2024
868261a
fix: stop using redirect in favor of dev or stable index.html file (…
jorgepiloto Feb 26, 2024
9b252fa
feat: new _doc-gen-robots action to generate seo-compliant "robots.tx…
jorgepiloto Mar 11, 2024
a0c1413
Merge branch 'main' into feat/seo-improvements
Revathyvenugopal162 Mar 12, 2024
0bbc679
Merge branch 'main' into feat/seo-improvements
Revathyvenugopal162 Mar 13, 2024
ab9cad7
feat: new canonical link action (#425)
jorgepiloto Mar 20, 2024
b9be610
Merge branch 'main' into feat/seo-improvements
jorgepiloto Mar 20, 2024
3baad00
fix: action ref
jorgepiloto Mar 22, 2024
ac33eef
fix: variable substitution
jorgepiloto Mar 25, 2024
3d146bc
fix: Typo in ``Robots.txt`` file (#434)
Revathyvenugopal162 Mar 25, 2024
0e93d1c
Merge branch 'main' into feat/seo-improvements
jorgepiloto Apr 2, 2024
5d5e268
fix: step description
jorgepiloto Apr 2, 2024
88466a9
fix: variable substitution
jorgepiloto Apr 2, 2024
386032e
fix: always rewrite canonical link
jorgepiloto Apr 2, 2024
6bb7838
fix: update canonical in dev and stable
jorgepiloto Apr 2, 2024
1ad1bf6
fix: variable substitution in baseurl
jorgepiloto Apr 3, 2024
25bf384
Merge branch 'main' into feat/seo-improvements
jorgepiloto Apr 3, 2024
5a63c6d
fix: actions order
jorgepiloto Apr 5, 2024
b9b4cca
feat: restore sitemap creation
jorgepiloto Apr 8, 2024
b5f2df9
doc: improve step description
jorgepiloto Apr 8, 2024
3bad719
fix: canonical for landing page
jorgepiloto Apr 8, 2024
8f3596d
Merge branch 'main' into feat/seo-improvements
jorgepiloto Apr 8, 2024
fde6f92
feat: deploy sitemap in dev too
jorgepiloto Apr 9, 2024
a1cc531
doc: improve step description
jorgepiloto Apr 9, 2024
83de792
Merge branch 'main' into feat/seo-improvements
jorgepiloto Apr 9, 2024
fdcab00
fix: syntax
jorgepiloto Apr 9, 2024
f20e2af
Merge branch 'main' into feat/seo-improvements
jorgepiloto Apr 9, 2024
aefbd62
doc: include info about new SEO improvements
jorgepiloto Apr 10, 2024
a08f4d1
doc: remove base_url option in conf.py
jorgepiloto Apr 10, 2024
91ba8d9
doc: document under development section
jorgepiloto Apr 11, 2024
d6ddc4d
Merge branch 'main' into feat/seo-improvements
jorgepiloto Apr 15, 2024
824334b
fix: ensure canonical links are removed and do not include canonical …
jorgepiloto Apr 16, 2024
9da9881
fix: remove duplicated function
jorgepiloto Apr 16, 2024
3701afe
Merge branch 'main' into feat/seo-improvements
jorgepiloto Apr 16, 2024
ef3622f
doc: fix style
jorgepiloto Apr 16, 2024
9ecbfe7
doc: fix style
jorgepiloto Apr 16, 2024
014aca0
Merge branch 'main' into feat/seo-improvements
jorgepiloto Apr 17, 2024
24b033e
fix: update references to main
jorgepiloto Apr 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 8 additions & 12 deletions _doc-gen-canonical/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,34 +61,30 @@ runs:
shell: bash
run: |

has_canonical_tag() {
remove_canonical_tag() {
local file=$1
grep -qP '<link\s+rel="canonical".*\/>' ${file}
grep -vP '<link\s+rel="canonical".*\/>' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
}

add_canonical_tag() {
local file=$1
local filename=$(basename "$file")
local relative_path=${file#*version/*/}
local baseurl="https://${{ inputs.cname }}/version/stable"
local baseurl="https://geometry.docs.pyansys.com/version/stable"
jorgepiloto marked this conversation as resolved.
Show resolved Hide resolved
local canonical_url="${baseurl}/${relative_path}"

if ! has_canonical_tag "${file}"; then
link_tag="\ \ <link rel=\"canonical\" href=\"$canonical_url\" />"
sed -i "/<\/head>/i$link_tag" "$file"
echo "Canonical link added to $file"
fi
local link_tag="\ \ <link rel=\"canonical\" href=\"$canonical_url\" />"
sed -i "/<\/head>/i$link_tag" "$file"
echo "Canonical link added to $file"
}

export -f has_canonical_tag
export -f remove_canonical_tag
export -f add_canonical_tag

find_html_files() {
local directory=$1
find "$directory" -type f -name "*.html" \
! \( -name "announcement.html" -o -name "webpack-macros.html" \) \
-exec bash -c 'add_canonical_tag "$0"' {} \;
-exec bash -c 'remove_canonical_tag "$0" && add_canonical_tag "$0"' {} \;
}

find_html_files ${{ inputs.html-directory }}

14 changes: 14 additions & 0 deletions doc-deploy-dev/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,20 @@ runs:
touch .nojekyll CNAME
echo "${{ inputs.cname }}" > CNAME

# ------------------------------------------------------------------------

- uses: ansys/actions/_logging@main
with:
level: "INFO"
message: >
Include a link canonical tag in old versions if not present.

- name: "Include link canonical tag in pages"
uses: ansys/actions/_doc-gen-canonical@feat/seo-improvements
with:
cname: ${{ inputs.cname }}
html-directory: version

# ------------------------------------------------------------------------

- uses: ansys/actions/_logging@main
Expand Down
2 changes: 1 addition & 1 deletion doc-deploy-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ runs:
uses: ansys/actions/_doc-gen-canonical@feat/seo-improvements
with:
cname: ${{ inputs.cname }}
html-directory: version/stable
html-directory: version

# ------------------------------------------------------------------------

Expand Down