From 75076124a53606ecd3058ed31fad1a22c2c591a2 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Thu, 6 Jan 2022 12:09:24 +0200 Subject: [PATCH] util/generate-hugo-content.py: use dspace field name Now all elements have DSpace field names so we can use that as the unique identifier for each element. --- util/generate-hugo-content.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/util/generate-hugo-content.py b/util/generate-hugo-content.py index 6334df0e..d4fb0318 100755 --- a/util/generate-hugo-content.py +++ b/util/generate-hugo-content.py @@ -58,10 +58,14 @@ def parseSchema(schema_df): # use the custom fsc layout instead of the default home layout. layout = "fsc" + if row["dspace field name"] is not None and row["dspace field name"] != "": + dspace_field_name = row["dspace field name"] + else: + dspace_field_name = False + # Generate a "safe" version of the element name for use in URLs and - # files by combining the cluster and the element name. This could - # change in the future. - element_name_safe = cluster.replace(" ", "-").lower() + "-" + element_name + # files by using the DSpace field name with dots replaced by dashes. + element_name_safe = dspace_field_name.replace(".", "-").lower() print(f"element name: {element_name_safe}") @@ -109,11 +113,6 @@ def parseSchema(schema_df): else: required = False - if row["dspace field name"] is not None and row["dspace field name"] != "": - dspace_field_name = row["dspace field name"] - else: - dspace_field_name = False - # Combine element type and options into a "policy" of sorts and convert # them to sentence case because they are ALL CAPS in the Excel. We don't # need to do any checks because these fields should always exist.