Skip to content

Commit

Permalink
Edit URLs in the recommendations box to work without a server.
Browse files Browse the repository at this point in the history
Rather than starting with "/dhq/", URLs to other articles start
with "../../../../" to get back to the root directory. (We could
trim the `/vol/` from the full URL to reduce the path, but this
seemed simpler and fairly reliable.)
  • Loading branch information
amclark42 committed Jul 5, 2024
1 parent 2bfc84a commit ad0bc29
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion common/xslt/dhq2html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,14 @@
<!-- Select the chosen matching row -->
<xsl:variable name="inner_tabs" select="tokenize($identifiedRow[1], '\t')" />
<!-- Editing the url to get the relative url path. index 16 is the url-->
<xsl:variable name="path" select="substring-after($inner_tabs[16], 'org')" />
<xsl:variable name="path">
<xsl:variable name="fullUrl" select="$inner_tabs[16]"/>
<!-- Regex to find both new and old styles of DHQ URL. -->
<xsl:variable name="removeFromUrl"
select="'^(https://digitalhumanities\.org/dhq|https://dhq.digitalhumanities\.org)/'"/>
<!-- Replace the website host with a relative path back to the root directory. -->
<xsl:sequence select="replace($fullUrl, $removeFromUrl, '../../../../')"/>
</xsl:variable>
<!-- Now we pull from the tabs of the selected row. 5 is the name of the article -->
<!-- Setting up the url and its <a> tag-->
<a href="{$path}"><xsl:value-of select="$inner_tabs[5]"/></a>,&#160;
Expand Down

0 comments on commit ad0bc29

Please sign in to comment.