Skip to content

Instantly share code, notes, and snippets.

@AngryLionAman
Last active October 30, 2019 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AngryLionAman/a0e66c53a41c6ff2ef8938d238ba33b2 to your computer and use it in GitHub Desktop.
Save AngryLionAman/a0e66c53a41c6ff2ef8938d238ba33b2 to your computer and use it in GitHub Desktop.
This is dynamic website so every link automatic generate the meta title and meta description
<c:if test="${questionId ne null}">
<c:catch var="ex">
<c:forEach var="h_seo" items="${SEO.getTitleAndDescripiton(questionId)}">
<title><c:out value="${h_seo.questionTitle}"/>- inquiryhere.com</title>
<meta property="og:title" content="<c:out value="${h_seo.questionTitle}"/>" />
<c:if test="${not empty h_seo.questionDescription and h_seo.questionDescription ne null}">
<meta property="og:description" content="<c:out value="${h_seo.questionDescription}"/>"/>
<meta property="description" content="<c:out value="${h_seo.questionDescription}"/>"/>
</c:if>
<c:if test="${empty h_seo.questionDescription or h_seo.questionDescription eq null}">
<meta property="og:description" content="<c:out value="${h_seo.questionTitle}"/>"/>
<meta property="description" content="<c:out value="${h_seo.questionTitle}"/>"/>
</c:if>
<c:choose>
<c:when test="${not empty h_seo.imageLinkResult and h_seo.imageLinkResult ne null}">
<meta property="og:image" content="${h_seo.imageLinkResult}" />
</c:when>
<c:otherwise>
<meta property="og:image" content="https://www.inquiryhere.com/images/inquiryhere_Logo.PNG" />
</c:otherwise>
</c:choose>
</c:forEach>
<c:set var="myVar" value="inquiryhere.com"/>
<c:forEach items="${SEO.getQuestionTag(questionId)}" var="currentItem" varStatus="stat">
<meta property="article:tag" content="${currentItem}"/>
<c:set var="myVar" value="${myVar},${currentItem}"/>
</c:forEach>
<meta name="keywords" content="${myVar}"/>
</c:catch>
<c:if test="${ex ne null}">
${ex}
</c:if>
</c:if>
-----------------------------------------
This meta tag currently i am using
-----------------------------------------
<title><c:out value="${h_seo.questionTitle}"/>- inquiryhere.com</title>
<meta property="og:title" content="<c:out value="${h_seo.questionTitle}"/>" />
<meta property="og:description" content="<c:out value="${h_seo.questionDescription}"/>"/>
<meta property="description" content="<c:out value="${h_seo.questionDescription}"/>"/>
<meta property="og:image" content="${h_seo.imageLinkResult}" />
<meta name="keywords" content="${myVar}"/>
<meta property="article:tag" content="${currentItem}"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment