Skip to content

Commit

Permalink
links script
Browse files Browse the repository at this point in the history
  • Loading branch information
fscelliott committed Jun 28, 2024
1 parent 6804db9 commit c860ece
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 220 deletions.
20 changes: 20 additions & 0 deletions assets/scripts/api_files/generate_replace_links
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import json

# Load the JSON file
with open('../..mint.json', 'r') as file:
data = json.load(file)

# Open the output text file in write mode
with open('config_internal_links_replacements.txt', 'w') as output_file:
# Iterate through each redirect in the array
for redirect in data.get('redirects', []):
source = redirect.get('source', '')
destination = redirect.get('destination', '')

# Modify the source as specified
modified_source = source.replace('/', '(', 1).replace('/', ':') + ' '

# Write to the output file
output_file.write(f"{modified_source}\t{destination}\n")

print("Redirects have been processed and written to redirects_output.txt")
220 changes: 0 additions & 220 deletions assets/scripts/api_files/internal_links_replacements.txt

This file was deleted.

0 comments on commit c860ece

Please sign in to comment.