Last active
April 16, 2024 10:03
-
-
Save eliasdabbas/27d13d542c61884c36b826ccfb0fb47e to your computer and use it in GitHub Desktop.
Create an HTML sitemap for a list of URLs and their anchor text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create anchors for all letters: | |
import string | |
print('<h3>' + ' '.join([f'<a href="#{letter}">{letter}</a>' for letter in string.ascii_uppercase]) + '</h3>') | |
# Assuming you have a DataFrame with the columns "full_name" and "loc": | |
for letter in string.ascii_uppercase: | |
df = players_df[players_static['full_name'].str[0].eq(letter)] | |
print() | |
print(f'<div id={letter}><h2>{letter}</h2></div>') | |
print() | |
for fullname, loc in df[['full_name', 'loc']].values: | |
print(f'<a href="{loc}">{fullname}</a><br>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download an example HTML sitemap file (4.9k links): https://bit.ly/442pnqL
Start with a list of URLs and their anchor texts:
Make an HTML sitemap: