OData / odataorg.github.io

Staging site and collaboration repository for http://www.odata.org
MIT License
63 stars 101 forks source link

Replace absolute links with relative links #357

Closed gathogojr closed 10 months ago

gathogojr commented 11 months ago

When one is running the site locally or on staging, the Bootstrap CSS file as well as other source files are referenced from the OData.org website. This makes it difficult to identify any issues that might exist (e.g., files missing locally or on staging) until the site is already published. By replacing absolute links with relative links, it makes it possible to run the site from any particular environment in isolation. The isolation makes is possible to pick out any issues before they make it to production.

Here's the absolute URL for the Bootstrap CSS file in _includes/head.html: image

An important thing to note about the Bootstrap CSS file referenced from the OData.org website is that it was not under source control. It appears like it was pushed to the site directly - probably using ftp. In addition, it's not a replica of any of the officially available versions of bootstrap.min.css: image

More about bootswatch here: https://bootswatch.com/ The CSS file with the custom changes has now been added to the repo and is built together with other source files.

Below is a table of the absolute URLs substituted with relative URLs with checks done to confirm that each relative link loads the expected page - no 404s:

Absolute URL Relative URL
https://www.odata.org/join-the-odata-discussion/ /join-the-odata-discussion/
https://www.odata.org/contribution /contribution
https://www.odata.org/documentation /documentation
https://www.odata.org/ecosystem /ecosystem
https://www.odata.org/libraries /libraries
https://www.odata.org/documentation/odata-version-3-0/url-conventions /documentation/odata-version-3-0/url-conventions
https://www.odata.org/documentation/odata-version-3-0/atom-format /documentation/odata-version-3-0/atom-format
https://www.odata.org/documentation/odata-version-3-0/common-schema-definition-language-csdl /documentation/odata-version-3-0/common-schema-definition-language-csdl
https://www.odata.org/documentation/odata-version-3-0/json-verbose-format /documentation/odata-version-3-0/json-verbose-format
https://www.odata.org/documentation/odata-version-3-0/abnf /documentation/odata-version-3-0/abnf
https://www.odata.org/documentation/odata-version-2-0/atom-format /documentation/odata-version-2-0/atom-format
https://www.odata.org/documentation/odata-v2-documentation/uri-conventions /documentation/odata-version-2-0/uri-conventions
https://www.odata.org/developers/protocols/atom-format /developers/protocols/atom-format
https://www.odata.org/developers/odata-sdk /developers/odata-sdk
https://www.odata.org/blog/queryable-odata-metadata /blog/queryable-odata-metadata
https://www.odata.org/blog/geospatial-data-support-in-odata/ /blog/geospatial-data-support-in-odata/
https://www.odata.org/blog/odata-roadshow /blog/odata-roadshow
https://www.odata.org/blog/adding-support-for-bags /blog/adding-support-for-bags
https://www.odata.org/blog/an-efficient-format-for-odata /an-efficient-format-for-odata
https://www.odata.org/blog/eclipse-ogee /blog/eclipse-ogee
https://www.odata.org/blog/enhancing-odata-support-for-querying-derived-types /blog/enhancing-odata-support-for-querying-derived-types
https://www.odata.org/blog/instant-odata-for-ibm-db2-on-zos-iseries-and-luw /blog/instant-odata-for-ibm-db2-on-zos-iseries-and-luw
https://www.odata.org/blog/ms-open-tech-china-introduces-azure-based-open-data-solution-using-ckan-and-odata-technologies /blog/ms-open-tech-china-introduces-azure-based-open-data-solution-using-ckan-and-odata-technologies
https://www.odata.org/blog/ms-open-tech-china-releases-odata-producer-codegen-for-to-tap-the-gold-mine-of-corporate-data /blog/ms-open-tech-china-releases-odata-producer-codegen-for-to-tap-the-gold-mine-of-corporate-data
https://www.odata.org/blog/odata-service-validation-tool /blog/odata-service-validation-tool
https://www.odata.org/blog/odata-v4-0-approved-as-a-new-oasis-standard /blog/odata-v4-0-approved-as-a-new-oasis-standard
https://www.odata.org/blog/restier-a-turn-key-framework-to-build-restful-service /blog/restier-a-turn-key-framework-to-build-restful-service
https://www.odata.org/blog/support-for-any-and-all /blog/support-for-any-and-all
https://www.odata.org/blog/the-open-data-protocol-net-framework-client-library-source-code-available-for-download /blog/the-open-data-protocol-net-framework-client-library-source-code-available-for-download
https://www.odata.org/documentation/odata-icon-usage-guidelines /odata-icon-usage-guidelines
https://www.odata.org/documentation/odata-version-2-0/operations /documentation/odata-version-2-0/operations
https://www.odata.org/documentation/odata-version-2-0/overview /documentation/odata-version-2-0/overview
https://www.odata.org/documentation/odata-version-3-0/batch-processing /documentation/odata-version-3-0/batch-processing
https://www.odata.org/getting-started/advanced-tutorial /getting-started/advanced-tutorial
https://www.odata.org/getting-started/basic-tutorial /getting-started/basic-tutorial
https://www.odata.org/odata-icon-usage-guidelines /odata-icon-usage-guidelines
https://www.odata.org/documentation /documentation
https://www.odata.org/blog /blog
https://www.odata.org/blog/salesforce-external-object-integration-using-lightning-connect-with-odata /blog/salesforce-external-object-integration-using-lightning-connect-with-odata
https://www.odata.org/blog/Lightning-Connect-New-in-OData-DF15/ /blog/Lightning-Connect-New-in-OData-DF15/
https://www.odata.org/odata-services /odata-services
https://www.odata.org/blog/combit-report-server-odata4 /blog/combit-report-server-odata4
https://www.odata.org/blog/microsoft-power-query-for-excel-releases-support-for-odata-v4 /blog/microsoft-power-query-for-excel-releases-support-for-odata-v4
https://www.odata.org /
http://odata.org /
http://odata.org/developers/odata-sdk /developers/odata-sdk

In addition, an additional yaml file __configstaging.yml was added. That file the site URL set to the staging endpoint:

url: "https://odata-prod-stage.azurewebsites.net"

The __configstaging.yml file is used when building the site for staging deployment as follows:

jekyll build --config _config_staging.yml

When the config option is specified in this manner, jekyll will apply the specified config file when building site:

href="{{'/public/css/bootstrap.min.css' | prepend: site.baseurl | prepend: site.url}}"

transformed to:

href="http://odata-prod-stage.azurewebsites.net/public/css/bootstrap.min.css"

Known dead links referencing odata.org

I left the above links as they were. There was no sense in converting them into relative URLs if that too would result into 404s.

habbes commented 11 months ago

You could check the following instances of absolute URLs and confirm whether they've been retained as such intentionally:

<p>For example; the following specifies the “StreetAddress”, “City”, “Region”, “Country” and “Postal Code” properties of an “Address” TypeTerm applied to a customer entity:</p>
{% highlight xml %}<code>  <metadata:properties xmlns:contact="http://odata.org/vocabularies/contact/v1">
gathogojr commented 10 months ago

@KenitoInc @habbes I came across the following dead links referencing odata.org when working on this PR:

I left the above links as they were. There was no sense in converting them into relative URLs if that too would result into 404s. I also didn't have a valid alternative I could change them to.

gathogojr commented 10 months ago

You could check the following instances of absolute URLs and confirm whether they've been retained as such intentionally:

  • The file _posts/2010-04-13-odata-weekly-roundup-2.html contains the following link with an absolute URL:
<a href="https://www.odata.org/media/6652/%5bmc-csdl%5d%5b1%5d.htm#_Toc246717571">
  • _posts/2010-05-12-odata-roadshow.html contains the following link:
<a href="https://www.odata.org/RoadShowRegistration">Register here</a>
  • pages/odata-icon-usage-guidelines.html contains the following link:
<a href="https://www.odata.org/ ">https://www.odata.org/ </a>
  • pages/documentation/atom-format-v3.html contains the following link:
<a href="https://www.odata.org/OData.html#canonicalurl">Canonical URL</a>
  • pages/documentation/batch-processing-v3.html:
[<a href="https://www.odata.org/media/30002/json">OData:JSON</a>]
  • pages/documentation/odata-version-3-0-core-protocol.hml:
<a href="https://www.odata.org/media/30002/ODataAtomPayload">Atom Payload</a>
  • pages/documentation/overview.html:
<a href="https://www.odata.org/media/16348/[mc-csdl].pdf">[CSDL]</a>
<a href="https://www.odata.org/media/16343/[mc-edmx].pdf">[EDMX]</a>
  • pages/documentation/terminology.html:
[<a href="https://www.odata.org/media/6652/[mc-csdl][1].htm">CDSL</a>]
  • pages/documentation/uri-conventions.html:
<a href="https://www.odata.org/media/6655/[mc-apdsu][1].htm">normative OData specification</a>
  • _posts/2010-03-26-odata-weekly-roundup-1.html:
<a href="http://odata.org/feedback">feedback</a>
  • 2010-06-01-odata-workshops-in-raleigh-charlotte-atlanta-chicago-and-nyc.html:
<a href="http://odata.org/roadshow">OData Roadshow</a>
  • 2010-08-06-enhancing-odata-support-for-querying-derived-types-revisited.html:
<a href="http://odata.org/mailing-list">OData Mailing list</a>
  • _posts/2011-03-16-reference-data-caching.html:
<strong>&lt;link rel="http://odata.org/delta" href="http://</strong> <strong>conferenceorganization/v1/</strong> <strong>sessions/?$deltatoken=B:405973881944444416</strong><strong>"/&gt;<br />
  • posts/2013-08-28-odataquerybuilder-a-cross-browser-javascript-library-for-building-odata-queries.html:
<a href="http://odata.org">http://odata.org</a>
  • pages/documentation/atom-format-v3.html:
<p>For example; the following specifies a value of “Home” for the “PhoneNumberType” ValueTerm applied to the “PhoneNumber” property of a customer:</p>
{% highlight xml %}<code>  <metadata:properties  xmlns:contact="http://odata.org/vocabularies/contact/v1">
<p>For example; the following specifies the “StreetAddress”, “City”, “Region”, “Country” and “Postal Code” properties of an “Address” TypeTerm applied to a customer entity:</p>
{% highlight xml %}<code>  <metadata:properties xmlns:contact="http://odata.org/vocabularies/contact/v1">
  • pages/documentation/common-schema-definition-language-csdl.html:
{% highlight xml %}<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
 <edmx:AnnotationsReference Url="http://odata.org/ann/a">
  <edmx:Include />
 </edmx:AnnotationsReference>
 <edmx:AnnotationsReference Url="http://odata.org/ann/b">
  <edmx:Include TermNamespace="org.example.validation" />
  <edmx:Include TermNamespace="org.example.display" Qualifier="Slate" />
 </edmx:AnnotationsReference>
 <edmx:DataServices ...>
</edmx:Edmx>
{% endhighlight %}
<p>All annotations from <code>http://odata.org/ann/a</code> are included. For <code>http://odata.org/ann/b</code>, only the following annotations are included:</p>
  • _posts/2011-02-21-vocabularies.html:
<p>Then this 'free floating' element is 'annotating' the Email property using the 'http://odata.org/vocabularies/constraints' vocabulary:</p>
<p><em>&lt;Annotation AppliesTo="http://server/service/$metadata/Properties('Namespace.Person.Email')"<br />
xmlns:validation="http://odata.org/vocabularies/constraints"&gt;<br />
&lt;validation:Constraint m:Type="validation:Constraint" &gt;<br />
&lt;validation:Regex&gt;^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,6}$.&lt;/validation:Regex&gt;<br />
&lt;validation:ErrorMessage&gt;Please enter a valid EmailAddress&lt;/validation:ErrorMessage&gt;<br />
&lt;/validation:Constraint&gt;<br />
&lt;/Annotation&gt;</em></p>
<p>Annotation by reference also neatly sidesteps issue (3), i.e. the object annotated is left structurally unchanged, which means we could use a similar approach to annotate data without breaking code (like a javascript path) that relies on a particular structure.</p>
<p>Another nice side-effect of this design is that you can use it 'inside' the CSDL too, simply by removing the address of the metadata service from the AppliesTo url - since we are in the CSDL we can us 'relative addressing':</p>
<p><em>&lt;Annotation AppliesTo="Properties('Namespace.Person.Email')"<br />
xmlns:validation="http://odata.org/vocabularies/constraints"&gt;<br />
&lt;validation:Constraint m:Type="validation:Constraint" &gt;<br />
&lt;validation:Regex&gt;^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,6}$.&lt;/validation:Regex&gt;<br />
&lt;validation:ErrorMessage&gt;Please enter a valid EmailAddress&lt;/validation:ErrorMessage&gt;<br />
&lt;/validation:Constraint&gt;<br />
&lt;/Annotation&gt;</em></p>
<p>Indeed if you have a separate file with many annotations for a particular model, you could group a series of annotations together like this:</p>
<p><em>&lt;Annotations AppliesTo="http://server/service/$metadata/"&gt;<br />
&lt;Annotation AppliesTo="Properties('Namespace.Person.Email')"<br />
xmlns:validation="http://odata.org/vocabularies/constraints"&gt;<br />
&lt;validation:Constraint m:Type="validation:Constraint" &gt;<br />
&lt;validation:Regex&gt;^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,6}$.&lt;/validation:Regex&gt;<br />
&lt;validation:ErrorMessage&gt;Please enter a valid EmailAddress&lt;/validation:ErrorMessage&gt;<br />
&lt;/validation:Constraint&gt;<br />
&lt;/Annotation&gt;<br />
&lt;Annotation AppliesTo="Properties('Namespace.Customer.Email')"<br />
xmlns:validation="http://odata.org/vocabularies/constraints"&gt;<br />
&lt;validation:Constraint m:Type="validation:Constraint" &gt;<br />
&lt;validation:Regex&gt;^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,6}$.&lt;/validation:Regex&gt;<br />
&lt;validation:ErrorMessage&gt;Please enter a valid EmailAddress&lt;/validation:ErrorMessage&gt;<br />
&lt;/validation:Constraint&gt;<br />
&lt;/Annotation&gt;<br />
&lt;/Annotations&gt;</em></p>

@habbes Based on the instances you shared, the following list comprises of dead links and I couldn't identify a valid URL to substitute them with:

The following list comprises of links embedded in code/csdl snippets and they should be fine as is:

I replaced http://odata.org and https://www.odata.org/ with {{site.url}}