Skip to content

Improve page metadata for sharing #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ timezone: America/Lower_Princes
exclude: ["README.md", "config.ru", "Gemfile", "Gemfile.lock", "Procfile", "vendor"]
safe: true
future: true
excerpt_separator: <!--end excerpt-->
page_excerpts: true

kramdown:
syntax_highlighter: rouge
Expand Down
62 changes: 39 additions & 23 deletions _layouts/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
<!DOCTYPE html>
<html lang="en">

{%- if page.title -%}
{%- capture meta_title -%}
{{ page.title | escape }}
{%- endcapture -%}
{%- else -%}
{%- assign meta_title = site.title -%}
{%- endif -%}

{%- if page.excerpt -%}
{%- capture meta_description -%}
{{ page.excerpt | strip_html | strip | escape }}
{%- endcapture -%}
{%- else %}
{%- assign meta_description = site.description -%}
{%- endif -%}

{%- if page.url -%}
{%- capture meta_url -%}
{{ site.url }}{{ page.url }}
{%- endcapture -%}
{%- else -%}
{%- assign meta_url = site.url -%}
{%- endif %}

<head>
<meta charset="utf-8" />
Expand All @@ -10,7 +34,7 @@
<meta name="author" content="Apple Inc." />
<meta name="viewport" content="width=device-width initial-scale=1" />
{% if page.excerpt %}
<meta name="description" content="{{ page.excerpt | strip_html | escape }}">
<meta name="description" content="{{ meta_description }}">
{% endif %}
<link rel="license" href="/LICENSE.txt" />
<link rel="stylesheet" media="all" href="/assets/stylesheets/application.css" />
Expand All @@ -25,41 +49,33 @@
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png" />
<link rel="mask-icon" href="/assets/images/icon-swift.svg" color="#F05339" />
{% if page.atom %}
{%- if page.atom %}
<link rel="alternate" type="application/atom+xml" title="Swift.org (Atom Feed)" href="/atom.xml" />
{% endif %}

{% if page.url %}
{%- if page.url -%}
<link rel="canonical" href="{{ site.url }}{{ page.url }}" />
{%- endif %}
{% if page.robots %}
<meta name="robots" content="{{page.robots}}" />
{% endif %}

<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@SwiftLang" />
{% if page.id %}
<meta name="twitter:title" content="{{ page.title | escape }}" />
<meta name="twitter:description" content="{{ page.excerpt | strip_html | escape }}" />
{% else %}
<meta name="twitter:title" content="{{ site.title }}" />
<meta name="twitter:description" content="{{ site.description | strip_html | escape}}" />
{% endif %}
<meta name="twitter:title" content="{{ meta_title }}" />
<meta name="twitter:description" content="{{ meta_description }}" />

<meta property="og:site_name" content="{{ site.title }}" />
<meta property="og:image" content="{{ site.url }}/apple-touch-icon-180x180.png" />
{% if page.robots %}
<meta name="robots" content="{{page.robots}}" />
{% endif %}
{% if page.id %}
{%- if page.id -%}
<meta property="og:type" content="article" />
<meta property="og:title" content="{{ page.title }}" />
<meta property="og:url" content="{{ site.url }}{{ page.url }}" />
<meta property="og:description" content="{{ page.excerpt | strip_html | escape }}" />
{%- endif %}
<meta property="og:title" content="{{ meta_title }}" />
<meta property="og:url" content="{{ meta_url }}" />
<meta property="og:description" content="{{ meta_description }}" />
{%- if page.id %}
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}" />
<meta property="article:modified_time" content="{{ site.time | date_to_xmlschema }}" />
{% else %}
<meta property="og:title" content="{{ site.title }}" />
<meta property="og:url" content="{{ site.url }}" />
<meta property="og:description" content="{{ site.description | strip_html | escape}}" />
{% endif %}
{%- endif %}
</head>

<body>
Expand Down
1 change: 1 addition & 0 deletions blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: default
title: Blog
atom: true
excerpt: "The Swift.org blog helps to keep the Swift community informed of recent developments in the language, the release roadmap, interesting new features, libraries, tools, as well as announcing project and community initiatives, and developer experiences."
---

{% for post in site.posts %}
Expand Down
1 change: 1 addition & 0 deletions documentation/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: page
title: Documentation
excerpt: "Whether you are new to Swift or an experienced Swift developer, documentation like The Swift Programming Language book, API Guidelines, and reference documentation for tools and libraries, serves as an invaluable resource in discovering all that Swift has to offer. "
---

If you are new to Swift, you may want to check out these additional resources.
Expand Down
1 change: 1 addition & 0 deletions download/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: page
title: Download Swift
excerpt: "Download both releases and development snapshots of Swift for all supported development platforms."
---


Expand Down
1 change: 1 addition & 0 deletions getting-started/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: page
title: Getting Started
excerpt: "Get started with the Swift programming language by downloading and installing the current version. From there you can explore interactively with the REPL. "
---

Here, you’ll find information about the how to use the Swift programming language.
Expand Down
1 change: 1 addition & 0 deletions server/guides/deployment.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: page
title: Deploying to Servers or Public Cloud
excerpt: "Servers built with Swift can be deployed on a variety of public cloud providers. The guides listed on this page show you how."
---

The following guides can help with the deployment to public cloud providers:
Expand Down
3 changes: 1 addition & 2 deletions server/guides/llvm-sanitizers.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ layout: page
title: LLVM TSAN / ASAN
---

For multithreaded and low-level unsafe interfacing server code, the ability to use LLVM's [ThreadSanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html) and
[AddressSanitizer](https://clang.llvm.org/docs/AddressSanitizer.html) can help troubleshoot invalid thread usage and invalid usage/access of memory.
For multithreaded and low-level unsafe interfacing server code, the ability to use LLVM's [ThreadSanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html) and [AddressSanitizer](https://clang.llvm.org/docs/AddressSanitizer.html) can help troubleshoot invalid thread usage and invalid usage/access of memory.

There is a [blog post](/blog/tsan-support-on-linux/) outlining the usage of TSAN.

Expand Down
3 changes: 1 addition & 2 deletions server/guides/memory-leaks-and-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ layout: page
title: Debugging Memory Leaks and Usage
---

There are many different tools for troubleshooting memory leaks both on Linux and macOS, each with different strengths and ease-of-use. One excellent tool is the Xcode's [Memory Graph Debugger](https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/debugging_with_xcode/chapters/special_debugging_workflows.html#//apple_ref/doc/uid/TP40015022-CH9-DontLinkElementID_1).
[Instruments](https://help.apple.com/instruments/mac/10.0/#/dev022f987b) and `leaks` can also be very useful. If you cannot run or reproduce the problem on macOS, there are a number of server-side alternatives below.
There are many different tools for troubleshooting memory leaks both on Linux and macOS, each with different strengths and ease-of-use. One excellent tool is the Xcode's [Memory Graph Debugger](https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/debugging_with_xcode/chapters/special_debugging_workflows.html#//apple_ref/doc/uid/TP40015022-CH9-DontLinkElementID_1). [Instruments](https://help.apple.com/instruments/mac/10.0/#/dev022f987b) and `leaks` can also be very useful. If you cannot run or reproduce the problem on macOS, there are a number of server-side alternatives below.

## Example program

Expand Down
4 changes: 3 additions & 1 deletion server/guides/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ layout: page
title: Debugging Performance Issues
---

First of all, it's very important to make sure that you compiled your Swift code in _release mode_. The performance difference between debug and release builds is huge in Swift. You can compile your Swift code in release mode using
First of all, it's very important to make sure that you compiled your Swift code in _release mode_. The performance difference between debug and release builds is huge in Swift.

You can compile your Swift code in release mode using:

swift build -c release

Expand Down
1 change: 1 addition & 0 deletions server/guides/setup-and-ide-alternatives.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: page
title: Installing Swift and using with IDEs
excerpt: "Swift is supported on a number of platforms, integrated development environments (IDEs), and editors."
---

## Installing Swift
Expand Down
1 change: 1 addition & 0 deletions server/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
redirect_from: "/server-apis/"
layout: page
title: Swift on Server
excerpt: "Swift has unique characteristics that make it specifically suitable for Server applications, including a small memory footprint, fast startup times, and deterministic performance."
---

Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.
Expand Down
2 changes: 1 addition & 1 deletion sswg/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layout: page
title: Swift Server Workgroup (SSWG)
---

The Swift Server workgroup is a steering team that promotes the use of Swift for developing and deploying server applications. The Swift Server workgroup will:
The Swift Server workgroup is a steering team that promotes the use of Swift for developing and deploying server applications. <!--end excerpt--> The Swift Server workgroup will:

* Define and prioritize efforts that address the needs of the Swift server community
* Define and run an incubation process for these efforts to reduce duplication of effort, increase compatibility and promote best practices
Expand Down
1 change: 1 addition & 0 deletions website-governance/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: page
title: Swift.org website governance
excerpt: "The Swift.org website has group of maintainers which includes a subset of the Swift core team and the Swift website workgroup members. The maintainers are in charge of reviewing and merging pull requests from contributors. The Swift.org website source code consists of several distinct parts. Each one of these areas is governed by a slightly different contribution process that matches their nature."
---

See [website overview](/website) for more information about the Swift.org website goals and contribution guidelines.
Expand Down
1 change: 1 addition & 0 deletions website-workgroup/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: page
title: Swift.org website workgroup (SWWG)
excerpt: "The Swift website workgroup is a steering team that helps guide the evolution on the Swift.org website."
---

See [website overview](/website) for more information about the Swift.org website goals, content governance and contribution guidelines.
Expand Down
1 change: 1 addition & 0 deletions website/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: page
title: Swift.org website
excerpt: "Swift.org is the website of the Swift programming language providing newcomers and experienced developers with documentation, announcements, and news about Swift and the Swift community in a safe, friendly environment."
---

Swift.org website goals include:
Expand Down