| 2878 |
2878 |
|
assert!(!html.contains("robots"), "{html}");
|
| 2879 |
2879 |
|
|
| 2880 |
2880 |
|
// A None emits nothing rather than an empty tag. A preview showing a blank
|
| 2881 |
|
- |
// line reads as a broken page.
|
|
2881 |
+ |
// line reads as a broken page, and an empty `description` is a page telling
|
|
2882 |
+ |
// a search engine it is about nothing.
|
| 2882 |
2883 |
|
assert!(!html.contains("og:description"), "{html}");
|
|
2884 |
+ |
assert!(!html.contains("name=\"description\""), "{html}");
|
| 2883 |
2885 |
|
assert!(!html.contains("og:image"), "{html}");
|
| 2884 |
2886 |
|
assert!(!html.contains("canonical"), "{html}");
|
| 2885 |
2887 |
|
}
|
| 2886 |
2888 |
|
|
|
2889 |
+ |
/// `1e35bc8a`. One summary, three tags: the pair a share sheet reads and the
|
|
2890 |
+ |
/// plain one a search engine reads. MNW's `base.html` emitted all three and the
|
|
2891 |
+ |
/// described document emitted two, so `/pricing` was appending the third
|
|
2892 |
+ |
/// through `Shell::head`.
|
|
2893 |
+ |
#[test]
|
|
2894 |
+ |
fn a_summary_reaches_the_plain_description_meta_and_not_only_the_social_pair() {
|
|
2895 |
+ |
let html = render(&Screen::sidebar_content("Pricing").summarised("What you keep."));
|
|
2896 |
+ |
|
|
2897 |
+ |
assert!(
|
|
2898 |
+ |
html.contains("<meta name=\"description\" content=\"What you keep.\">"),
|
|
2899 |
+ |
"{html}"
|
|
2900 |
+ |
);
|
|
2901 |
+ |
// Beside the pair rather than instead of it. All three say the same thing
|
|
2902 |
+ |
// and are read by different things.
|
|
2903 |
+ |
assert!(
|
|
2904 |
+ |
html.contains("<meta property=\"og:description\" content=\"What you keep.\">"),
|
|
2905 |
+ |
"{html}"
|
|
2906 |
+ |
);
|
|
2907 |
+ |
assert!(
|
|
2908 |
+ |
html.contains("<meta name=\"twitter:description\" content=\"What you keep.\">"),
|
|
2909 |
+ |
"{html}"
|
|
2910 |
+ |
);
|
|
2911 |
+ |
}
|
|
2912 |
+ |
|
|
2913 |
+ |
/// A screen that has told crawlers to go away has nothing to gain from
|
|
2914 |
+ |
/// describing itself to them -- but a noindex page can still be linked, so the
|
|
2915 |
+ |
/// share sheet keeps its preview. The asymmetry is deliberate.
|
|
2916 |
+ |
#[test]
|
|
2917 |
+ |
fn a_screen_that_refuses_indexing_keeps_its_preview_and_drops_its_description() {
|
|
2918 |
+ |
let html = render(
|
|
2919 |
+ |
&Screen::sidebar_content("Downloads")
|
|
2920 |
+ |
.summarised("Your purchases.")
|
|
2921 |
+ |
.indexed(false),
|
|
2922 |
+ |
);
|
|
2923 |
+ |
|
|
2924 |
+ |
assert!(!html.contains("name=\"description\""), "{html}");
|
|
2925 |
+ |
assert!(
|
|
2926 |
+ |
html.contains("<meta property=\"og:description\" content=\"Your purchases.\">"),
|
|
2927 |
+ |
"{html}"
|
|
2928 |
+ |
);
|
|
2929 |
+ |
assert!(
|
|
2930 |
+ |
html.contains("<meta name=\"robots\" content=\"noindex\">"),
|
|
2931 |
+ |
"{html}"
|
|
2932 |
+ |
);
|
|
2933 |
+ |
}
|
|
2934 |
+ |
|
| 2887 |
2935 |
|
#[test]
|
| 2888 |
2936 |
|
fn a_purchased_content_screen_can_say_it_is_not_for_crawlers() {
|
| 2889 |
2937 |
|
// Six of the server's screens. This is the assertion the whole decision
|