Skip to content
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

Use site.title for meta tag if available #100

Merged
merged 3 commits into from
Mar 21, 2016
Merged

Conversation

pathawks
Copy link
Member

This will use site.title (if present) for the feed title when rendering the <link> tag. If site.title is undefined, it will fallback to site.name.

This mirrors the current behavior of the feed itself:

  {% if site.title %}
    <title>{{ site.title | xml_escape }}</title>
  {% elsif site.name %}
    <title>{{ site.name | xml_escape }}</title>
  {% endif %}

@pathawks pathawks added the bug label Mar 20, 2016
@pathawks pathawks self-assigned this Mar 20, 2016
@@ -26,6 +26,14 @@ def url
config["github"]["url"]
end
end

def title
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps

def title
  config["title"] || config["name"]
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to avoid output of title="" if neither is specified.

Am I overthinking this?

%(href="#{url}/#{path}")
]
if title
link_attributes << %(title="#{title}")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this too complicated for what I'm trying to accomplish?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it makes sense here, but here's what we did for Jekyll avatar to solve a similar problem.

@pathawks pathawks force-pushed the pr/fallback-title branch 2 times, most recently from 16fd64a to 83aecf4 Compare March 21, 2016 01:39
@pathawks
Copy link
Member Author

Oh hey 💯

@pathawks pathawks force-pushed the pr/fallback-title branch 2 times, most recently from 2bcacf9 to 25cbb59 Compare March 21, 2016 01:57
@benbalter
Copy link
Contributor

I think this is a lot cleaner (even if slightly over-engineered). 👍

@pathawks
Copy link
Member Author

@jekyllbot: merge +minor

jekyllbot added a commit that referenced this pull request Mar 21, 2016
@jekyllbot jekyllbot merged commit 79c522c into master Mar 21, 2016
@jekyllbot jekyllbot deleted the pr/fallback-title branch March 21, 2016 17:55
jekyllbot added a commit that referenced this pull request Mar 21, 2016
@jekyll jekyll locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants