Closed Allkoman closed 6 years ago
? show me the code
blog/themes/yelee/layout/_partial/post/nav.ejs
文件,在第8行插入<p><span class="post-count">文章字数:</span><%= wordcount(post.content) %></p> //添加本行
,如下:<% if ((post.original != false && !is_page() && theme.copyright) || post.original){ %>
<div class="copyright">
<p><span><%= __('copyright_info.title') %>:</span><a href="<%- url_for(post.path) %>"><%= post.title %></a></p>
<p><span><%= __('copyright_info.author') %>:</span><a href="/" title="<%= __('tooltip.back2home') %>"><%=theme.author%></a></p>
<p><span class="post-count">文章字数:</span><%= wordcount(post.content) %></p> //添加本行
<p><span><%= __('copyright_info.date') %>:</span><%= post.date.format("YYYY-MM-DD, HH:mm:ss") %></p>
<p><span><%= __('copyright_info.updated') %>:</span><%= post.updated.format("YYYY-MM-DD, HH:mm:ss") %></p>
<p>
<span><%= __('copyright_info.url') %>:</span><a class="post-url" href="<%- url_for(post.path) %>" title="<%= post.title %>"><%= post.permalink %></a>
<span class="copy-path" data-clipboard-text="<%= __('copyright_info.from') %> <%= post.permalink %> <%= __('copyright_info.by') %> <%=theme.author%>" title="<%= __('tooltip.copyPath') %>"><i class="fa fa-clipboard"></i></span>
<script> var clipboard = new Clipboard('.copy-path'); </script>
</p>
<p>
<span><%= __('copyright_info.license') %>:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" title="CC BY-NC-SA 4.0 International" target = "_blank">"<%= __('copyright_info.cc') %>"</a> <%= __('copyright_info.notice') %>
</p>
</div>
<% } %>
<% if (post.prev || post.next){ %>
<nav id="article-nav">
<% if (post.prev){ %>
<div id="article-nav-newer" class="article-nav-title">
<a href="<%- url_for(post.prev.path) %>">
<%= post.prev.title %>
</a>
</div>
<% } %>
<% if (post.next){ %>
<div id="article-nav-older" class="article-nav-title">
<a href="<%- url_for(post.next.path) %>">
<%= post.next.title %>
</a>
</div>
<% } %>
</nav>
<% } %>
copyright
可看到多出一项文章字数
:这是我的使用方法,但是在我的博客中有一些页面无法显示正常的数据
markdown 文章源码
title: CodeCademy toc: 1 date: 2017-04-18 15:30:56 tags:
原因:2017年4月18日 星期二 其实是在学英语 说明:学无止境哦。
HTML is the language used to create the web pages you visit everyday. It provides a logical way to structure content for web pages.
HyperText Markup Language
.markup
language is a computer language that defines the structure and presentation of raw text. Markup languages work by surrounding raw text with information the computer can interpret, "marking it up" for processing.A web browser must know what language a document is written in before they can process the contents of the document.
<!DOCTYPE html>
<!DOCTYPE html>
must be the first line of code in all of your HTML documents.Note: If you don't use the doctype declaration, your HTML code will likely still work, however, it's risky. Right now, the browser will correctly assume that you are using HTML5, as HTML5 is the current standard. In the future, however, a new standard will override HTML5. Future browsers may assume you're using a different, newer standard, in which case your document will be interpreted incorrectly. To make sure your document is forever interpreted correctly, always include <!DOCTYPE html> at the very beginning of your HTML documents.
<!DOCTYPE html>
declaration is only the beginning, however. It only tells the browser that you plan on using HTML in the document, it doesn't actually add any HTML structure or content.<html>
tags, like so:<!DOCTYPE html>
<html>
</html>
<html>
and </html>
will be considered HTML code. Without these tags, it's possible that browsers could incorrectly interpret your HTML code and present HTML content in unexpected ways.In the following example, there is one paragraph element, made up of one opening tag (
<p>
) and one closing tag (</p>
):<p>Hello there!</p>
(<html>)
that will contain the rest of your code. Let's also give the browser some information about the page. We can do this by adding a <head>
element.<head>
element will contain information about the page that isn't displayed directly on the actual web page (you'll see an example in the next exercise).<!DOCTYPE html>
<html>
<head>
</head>
</html>
<head>
element contain?<head>
element, by using a <title>
element.<!DOCTYPE html>
<html>
<head>
<title>My Coding Journal</title>
</head>
</html>
<!DOCTYPE html>
<html>
<head>
<title>I'm Learning To Code!</title>
</head>
<body>
</body>
</html>
Note: The rest of the course will use code examples like the one above. To save space, however, code examples will avoid including common elements like the declaration, head, and so on. Unless otherwise specified, you can assume that the code in the example code blocks belongs directly within the HTML file's body.
Congratulations on completing the first unit of HTML & CSS! You are well on your way to becoming a skilled web developer. Let's review what you've learned so far: The <!DOCTYPE html> declaration should always be the first line of code in your HTML files. The element will contain all of your HTML code. Information about the web page, like the title, belongs within the
of the page. You can add a title to your web page by using theelement, inside of the head. Code for visible HTML content will be placed inside of the element. What you learned in this lesson constitutes the required setup for all HTML files. The rest of the course will teach you more about how to add content using HTML and how to style that content using CSS!
<h1>
- used for main headings, all other smaller headings are used for subheadings.
`<h1>BREAKING NEWS</h1>
<p>
.<p>The Nile River is the longest river in the world, measuring over 6,850 kilometers long (approximately 4,260 miles). It flows through eleven countries, including Tanzania, Uganda, Rwanda, Burundi, Congo-Kinshasa, Kenya, Ethiopia, Eritrea, South Sudan, Sudan, and Egypt.</p>
<ul>
element. The <ul>
element, however, cannot hold raw text and cannot automatically format raw text with bullet points. Individual list items must be added to the unordered list using the <li>
element.<ul>
<li>Limes</li>
<li>Tortillas</li>
<li>Chicken</li>
</ul>
<ul>
element and all individual list items were added using <li>
elements.<ol>
element and then add individual list items to the list using <li>
elements. <li>Preheat the oven to 350 degrees.</li>
<li>Mix whole wheat flour, baking soda, and salt.</li>
<li>Cream the butter, sugar in separate bowl.</li>
<li>Add eggs and vanilla extract to bowl.</li>
<a>
and including the text of the link in between the opening and closing tags.<a>This Is A Link To Wikipedia</a>
<a href="https://www.wikipedia.org/">This Is A Link To Wikipedia</a>
href
attribute has been set to the value of the correct URL https://www.wikipedia.org/. The example now shows the correct use of an anchor element.Note: When reading technical documentation, you may come across the term hyperlink. Not to worry, this is simply the technical term for link and, often times, these terms are used interchangeably
<a href="https://en.wikipedia.org/wiki/Brown_bear" target="_blank">The Brown Bear</a>
Note: In this exercise, we've used the terminology "open in a new window." It's highly likely that you are using a modern browser that opens up websites in new tabs, rather than new windows. Before the advent of browsers with tabs, additional browser windows had to be opened to view more websites. The target attribute, when used in modern browsers, will open new websites in a new tab.
<img>
element lets you add images to a web page. This element is special because it does not have a closing tag, it only has an opening tag. This is because the <img>
element is a self-closing element.<img src="https://www.example.com/picture.jpg" />
Note that the
<img>
element has a required attribute called src, which is similar to the href attribute in links. In this case, the value of src must be the URL of the image. Also note that the end of the<img>
element has a forward slash /. This is required for a self-closing element.
<img>
element. The value of alt should be a description of the image.<img src="#" alt="A field of yellow sunflowers" />
If an image fails to load on a web page, a user can mouse over the area originally intended for the image and read a brief description of the image. This is made possible by the description you provide in the alt attribute. Visually impaired users often browse the web with the aid of of screen reading software. When you include the alt attribute, the screen reading software can read the image's description outloud to the visually impaired user. Note: If the image on the web page is not one that conveys any meaningful information to a user (visually impaired or otherwise), the alt attribute should not be used.
<a href="https://en.wikipedia.org/wiki/Opuntia" target="_blank">Prickly Pear</a>
<img>
element with an <a>
element.<a href="https://en.wikipedia.org/wiki/Opuntia" target="_blank"><img src="#" alt="A red prickly pear fruit"/></a>
In the example above, an image of a prickly pear has been turned into a link by wrapping the outside of the <img>
element with an <a>
element.
<html><head></head>
<body><h1>Hello!</h1><p>This is a paragraph!</body>
</html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Hello!</h1>
<p>This is a paragraph!</p>
</body>
</html>
You saw how modifying the spacing between code in an HTML file doesn't affect the positioning of elements in the browser. If you are interested in modifying the spacing in the browser, you can use HTML's line break element: <br />
.
The line break element is one self-closing tag. You can use it anywhere within your HTML code and a line break will be shown in the browser.
Shall I compare thee to a summer's day?<br />
Thou art more lovely and more temperate
The code in the example above will result in an output that looks like the following:
Shall I compare thee to a summer's day?
Thou art more lovely and more temperate
Note: Line breaks are not the standard way of manipulating the positioning of HTML elements, but it's likely that you'll come across them every now and then. In later units, you'll learn more advanced techniques for positioning HTML elements.
<ul>
<li>Violin</li>
<li>Viola</li>
<li>Cello</li>
<li>Bass</li>
<ul>
<!-- and end with -->
. Any characters in between will be treated as a comment.<!-- This is a comment that the browser will not display. -->
<!-- Favorite Films Section -->
<p>The following is a list of my favorite films:</p>
<!-- <a href="#" target="_blank>Codecademy</a> -->
<h1
> through <h6>
.<p>
element.<ul>
element and list items are added using the <li>
element.<ol>
element and list items are added using the <li>
element.<a>
element - don't forget the href attribute!<img>
element - don't forget the src attribute!<img>
elements include the alt attribute.<a>
element.<!-- This is a comment -->
.<style>
element.The <style>
element allows you to write CSS code between its opening and closing tags. To use the <style>
element, it must be placed inside of the head.
<head>
<style>
</style>
</head>
Once <style>
is placed in the web page's head, we can begin writing CSS code.
<head>
<style>
h2 {
font-family: Arial;
}
</style>
</head>
<style>
element allows you to write CSS code within HTML files, this mixture of HTML and CSS can result in code that is difficult to read and maintain.<style>
element in an HTML file, you risk the following two things:<link>
element to link the HTML and CSS files together. The <link>
element must be placed within the head of the HTML file. It is a self-closing tag and requires the following three attributes:<link href="https://www.codecademy.com/stylesheets/style.css" type="text/css" rel="stylesheet">
Note that in the example above the path to the stylesheet is a URL:
<link href="/style.css" type="text/css" rel="stylesheet">
<style>
element allows you to write CSS code within an HTML file.<link>
element, which requires three attributes:md 有多处语法不规范 会导致生成的 html 也不规范。
w3c 检测: https://validator.w3.org/nu/?doc=http%3A%2F%2Fminichao.me%2F2017%2F04%2F18%2Fcodecademy%2F
你的站点主题也是不规范的
我在这里使用了wordcount插件: http://minichao.me/2017/04/17/Hexo-plugins-Issues/ 这里可以看到字数显示存在bug: http://minichao.me/2017/04/18/codecademy/